Answer the question
In order to leave comments, you need to log in
Why does it give an error when editing the inline Telegram Bot button?
@bot.callback_query_handler(func = lambda call: True)
def answer(call):
chat_id = call.message.id
message_id = call.message.id
if call.data == 'item1':
bot.edit_message_text(chat_id, message_id, 'Ответ 1')
elif call.data == 'item2':
bot.edit_message_text(chat_id, message_id, 'Ответ 2')
Answer the question
In order to leave comments, you need to log in
Corrected code:
@bot.callback_query_handler(func = lambda call: True)
def answer(call):
if call.data == 'item1':
bot.edit_message_text(chat_id = call.message.chat.id, message_id = call.message.id, text = 'Ответ 1')
elif call.data == 'item2':
bot.edit_message_text(chat_id, message_id, 'Ответ 2')
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question