Answer the question
In order to leave comments, you need to log in
Why is the message not being edited inline with the Telebot button?
Everything seems to be correct, but it gives an error
ERROR - TeleBot: "A request to the Telegram API was unsuccessful. Error code: 400. Description: Bad Request: message to edit not found"
@bot.callback_query_handler(func=lambda call: True)
def handler_call(call):
chat_id = call.message.from_user.id
message_id = call.message.message_id
if call.data == 'start_shift':
print(chat_id)
print(message_id)
bot.edit_message_text(
chat_id=chat_id,
message_id=message_id,
text='Вы начали смену',
reply_markup=menu.end_shift_k)
base.set_active(chat_id,call.message.from_user.username)
@bot.message_handler(commands=['start'])
def start_command(msg):
if msg.from_user.id == settings.admin_id:
bot.send_message(msg.from_user.id,'Меню админа: ',reply_markup=menu.admin_k)
Answer the question
In order to leave comments, you need to log in
Because you need to pass the chat ID to the chat_id parameter ( call.message.chat.id ) , and you are passing the bot ID ( call.message.from_user.id ).
Since the message in the call is the message to which the button is attached, and the message was sent to you by a bot, the sender is the bot ID, not your chat ID.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question