Closed kingofnull closed 6 years ago
Read the doc here: https://github.com/eternnoir/pyTelegramBotAPI#callback-query-handler
You can also use anything of the query within the lambda to distinct callback processing methods. For example:
@bot.callback_query_handler(lambda query: query.data == "sdss")
def process_callback_1(query):
pass
@bot.callback_query_handler(lambda query: query.data in ["ds", "sds"])
def process_callback_2(query):
pass
Thanks but how to update the message?
bot.edit_message_text(chat_id, message_id, new_text, ...)
or any other edit_message_xxx.
See details here: https://core.telegram.org/bots/api#updating-messages
I know but where are chat id and message id in query ?
Bro, spend 10 minutes to read the docs! Bot API doc is really small and well structured.
https://core.telegram.org/bots/api#callbackquery
query.message.chat.id query.message.message_id
Thanks I done it before but in another way, I found chat_id in json
property of message not directly in message property. I think documentation of pyTelegramBotAPI is not complete and should cover this. Also there are other function in telegram bot API which didn't mention in pyTelegramBotAPI's documentation and I don't know how to use them.
bot.edit_message_text(chat_id, message_id, new_text, ...)
or any other edit_message_xxx.See details here: https://core.telegram.org/bots/api#updating-messages
bro how to delete a message?
bot.edit_message_text(chat_id, message_id, new_text, ...)
or any other edit_message_xxx. See details here: https://core.telegram.org/bots/api#updating-messagesbro how to delete a message?
call this method: https://pytba.readthedocs.io/en/latest/sync_version/index.html#telebot.TeleBot.delete_message
Thanks to this thread.
Please answer these questions before submitting your issue. Thanks!
this show the inline buttons:
but how we should set callback query handler for inline buttons?