Y
Y
Yatagarashy2022-04-13 22:07:49
Python
Yatagarashy, 2022-04-13 22:07:49

Error while using TeleBot python?

Hi everyone, I've been coding in python for a week now and I've come across a bug

import telebot
from telebot import types


bot = telebot.TeleBot('token')

@bot.message_handler(commands=['start'])
def button(message):
    markup = types.InlineKeyboardMarkup(row_width=1)
    item = types.InlineKeyboardButton('Как дела?', callback_data='question_1')
    markup.add(item)

    bot.send_message(message.chat.id, 'Привет', reply_markup=markup)

@bot.callback_query_handler(func=lambda call:True)
def callback(call):
    if call.message:
        if call.data == 'question_1':
            bot.edit_message_text(chat_id=call.message.chat.id, message_id=call.message.chat.id, text='намана')

bot.polling(non_stop=True)


and I get this error:

2022-04-13 21:55:42,735 (__init__.py:688 MainThread) ERROR - TeleBot: "A request to the Telegram API was unsuccessful. Error code: 400. Description: Bad Request: message to edit not found"

Who understands this, please respond

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Nesterov, 2022-04-13
@AlexNest

Open the translator and put the error text there. Then carefully check what value you specify for the message parameter in the corresponding method.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question