mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2024-11-25 00:27:46 +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')
|
bot = telegram.Bot('TOKEN')
|
||||||
|
|
||||||
# This will be our global variable to keep the latest update_id when requesting
|
# This will be our global variable to keep the latest update_id when requesting
|
||||||
# for updates. It starts with the latest update_id available.
|
# for updates. It starts with the latest update_id if available.
|
||||||
LAST_UPDATE_ID = bot.getUpdates()[-1].update_id
|
try:
|
||||||
|
LAST_UPDATE_ID = bot.getUpdates()[-1].update_id
|
||||||
|
except IndexError:
|
||||||
|
LAST_UPDATE_ID = None
|
||||||
|
|
||||||
|
|
||||||
def echo():
|
def echo():
|
||||||
|
|
Loading…
Reference in a new issue