Error handling when no updates available

This commit is contained in:
leandrotoledo 2015-07-15 07:47:13 -03:00
parent 6b5c55ad79
commit 9f27537176

View file

@ -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():