Reputation: 25
I'm trying to implement something "looks like" animated countdown in my telegram bot:
sent=bot.send_message(message.chat.id,'5')
time.sleep(1)
bot.edit_message_text('4',message.chat.id,sent.message_id)
time.sleep(1)
bot.edit_message_text('3',message.chat.id,sent.message_id)
time.sleep(1)
bot.edit_message_text('2',message.chat.id,sent.message_id)
time.sleep(1)
bot.edit_message_text('1',message.chat.id,sent.message_id)
time.sleep(1)
bot.edit_message_text('0',message.chat.id,sent.message_id)
Sometimes it works well, but sometimes I get the error:
A request to the Telegram API was unsuccessful. The server returned HTTP 400 Bad Request. Response body:error_code:400,description:"Bad Request: message is not modified
Upvotes: 1
Views: 2373
Reputation: 115
I personally don't recommend you to send requests to telegram so often in a small timespan. You might end up with a time out for too many requests. My two suggestions for you here:
Upvotes: 0