Answer the question
In order to leave comments, you need to log in
Error in telepy library (py Telegram Bot API) edit_message_text. How to edit a message not in callback?
Error:
(__init__.py:489 MainThread) ERROR - TeleBot: "A request to the Telegram API was unsuccessful. Error code: 400. Description: Bad Request: message can't be edited
"
@bot.message_handler(commands=['show_buttons'])
def sb(message):
cid = message.chat.id
keyb = types.ReplyKeyboardMarkup(resize_keyboard = True)
b1 = types.KeyboardButton('Привет!')
b2 = types.KeyboardButton('Сколько у меня подписчиков?')
keyb.add(b1, b2)
bot.send_message(chat_id = cid, text = 'Процесс показания кнопок: 0%', reply_markup = None)
for i in range(0,101,int(12.5)):
sleep(0.20)
if i == 100:
bot.edit_message_text(chat_id = cid, message_id = 1, text = 'Кнопки успешно показаны', reply_markup = keyb)
else:
bot.edit_message_text(chat_id = cid, message_id = 1, text = 'Процесс показания кнопок:', str(i) + '%', reply_markup = None)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question