escarbot/inline.py (view raw)
1from telegram import Update
2from telegram.ext import ContextTypes
3from escarbot.config import INLINE_SEP
4from escarbot.replace import feedback
5
6inline_mapping = [ ("feedback", feedback) ]
7
8async def inline_handler(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
9 query = update.callback_query
10 data = query.data
11
12 for t in inline_mapping:
13 if data.startswith(t[0]):
14 actual_data = data.split(INLINE_SEP, maxsplit=1)[1]
15 await t[1](update, context, actual_data)
16 return
17
18 await query.answer("Questo tasto non fa nulla.")
19 return