Как через Telebot отправить сообщение в котором написано "Жди 15 сек" через секунду изменяется "Жди 14 сек". ИЗМЕНЯЕТСЯ а не удаляется.
Вот код который писал я:
bot.send_message(message.chat.id, 'Ждите... 15')
time.sleep(1)
bot.edit_message_text(message.chat.id, message.message_id, 'Ждите... 14')
time.sleep(1)
bot.edit_message_text(message.chat.id, message.message_id, 'Ждите... 13')
time.sleep(1)
bot.edit_message_text(message.chat.id, message.message_id, 'Ждите... 12')
time.sleep(1)
bot.edit_message_text(message.chat.id, message.message_id, 'Ждите... 11')
time.sleep(1)
bot.edit_message_text(message.chat.id, message.message_id, 'Ждите... 10')
time.sleep(1)
bot.edit_message_text(message.chat.id, message.message_id, 'Ждите... 9')
time.sleep(1)
bot.edit_message_text(message.chat.id, message.message_id, 'Ждите... 8')
time.sleep(1)
bot.edit_message_text(message.chat.id, message.message_id, 'Ждите... 7')
time.sleep(1)
bot.edit_message_text(message.chat.id, message.message_id, 'Ждите... 6')
time.sleep(1)
bot.edit_message_text(message.chat.id, message.message_id, 'Ждите... 5')
time.sleep(1)
bot.edit_message_text(message.chat.id, message.message_id, 'Ждите... 4')
time.sleep(1)
bot.edit_message_text(message.chat.id, message.message_id, 'Ждите... 3')
time.sleep(1)
bot.edit_message_text(message.chat.id, message.message_id, 'Ждите... 2')
time.sleep(1)
bot.edit_message_text(message.chat.id, message.message_id, 'Ждите... 1')
Вот лог из консоли:
2020-08-24 20:57:15,502 (util.py:68 WorkerThread1) ERROR - TeleBot: "ApiException occurred, args=('A request to the Telegram API was unsuccessful. The server returned HTTP 400 Bad Request. Response body:\n[b\'{"ok":false,"error_code":400,"description":"Bad Request: chat not found"}\']',)
Traceback (most recent call last):
File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\telebot\util.py", line 62, in run
task(*args, **kwargs)
File "C:\Users\User\Desktop\blocked.py", line 52, in dadas
bot.edit_message_text(message.message_id, 'Ждите... 14')
File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\telebot\__init__.py", line 1185, in edit_message_text
disable_web_page_preview, reply_markup)
File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\telebot\apihelper.py", line 772, in edit_message_text
return _make_request(token, method_url, params=payload, method='post')
File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\telebot\apihelper.py", line 69, in _make_request
return _check_result(method_name, result)['result']
File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\telebot\apihelper.py", line 88, in _check_result
raise ApiException(msg, method_name, result)
telebot.apihelper.ApiException: A request to the Telegram API was unsuccessful. The server returned HTTP 400 Bad Request. Response body:
[b'{"ok":false,"error_code":400,"description":"Bad Request: chat not found"}']
"
2020-08-24 20:57:15,506 (__init__.py:455 MainThread) ERROR - TeleBot: "A request to the Telegram API was unsuccessful. The server returned HTTP 400 Bad Request. Response body:
[b'{"ok":false,"error_code":400,"description":"Bad Request: chat not found"}']"