mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2024-11-21 22:56:38 +01:00
Error handling when no updates available
This commit is contained in:
parent
6b5c55ad79
commit
9f27537176
1 changed files with 5 additions and 2 deletions
|
@ -9,8 +9,11 @@ import time
|
|||
bot = telegram.Bot('TOKEN')
|
||||
|
||||
# This will be our global variable to keep the latest update_id when requesting
|
||||
# for updates. It starts with the latest update_id available.
|
||||
LAST_UPDATE_ID = bot.getUpdates()[-1].update_id
|
||||
# for updates. It starts with the latest update_id if available.
|
||||
try:
|
||||
LAST_UPDATE_ID = bot.getUpdates()[-1].update_id
|
||||
except IndexError:
|
||||
LAST_UPDATE_ID = None
|
||||
|
||||
|
||||
def echo():
|
||||
|
|
Loading…
Reference in a new issue