If a user sends some /commands
to the bot, and the bot responds to it with some messages using libraryInlineKeyboardMarkup
. 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))
...
It is expected to avoid it, so the bot will ignore clicks on keyboard from other users.
One had tried to store command sender and message ID in application.chat_data
, so as to check if the user is allowed to interact with a certain keyboard, but maybe there are some built-in ways to realize it in `telegram.ext’. Kindly help.
user24808143 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.