The user sends some /command
to the bot, and the bot responds to it with some message with InlineKeyboardMarkup
. But every user in the chat can interact with that InlineKeyboardMarkup
...
async def hello(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
query = update.callback_query
await query.answer()
await query.edit_message_text('Hello!')
...
if __name__ == '__main__':
...
application.add_handler(CallbackQueryHandler(hello))
...
I need to avoid it, so the bot will ignore clicks on keyboard from other users.
I tried to store command sender and message ID in application.chat_data
, so I can check if the user allowed to interact with a certain keyboard, but maybe there are some built-in ways to realize it in telegram.ext
, or maybe you know a better way to implement it.
user24808143 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.