1
0
mirror of https://github.com/eternnoir/pyTelegramBotAPI.git synced 2023-08-10 21:12:57 +03:00

Update __init__.py

This commit is contained in:
4yBa4oK 2015-07-19 19:53:35 +03:00
parent 010df3ed71
commit 78c2be4bd8

View File

@ -105,10 +105,11 @@ class TeleBot:
"""
updates = apihelper.get_updates(self.token, offset=(self.last_update_id + 1), timeout=20)
new_messages = []
self.last_update_id = updates[-1]['update_id']
for update in updates:
msg = types.Message.de_json(update['message'])
new_messages.append(msg)
if updates:
self.last_update_id = updates[-1]['update_id']
for update in updates:
msg = types.Message.de_json(update['message'])
new_messages.append(msg)
if len(new_messages) > 0:
self.process_new_messages(new_messages)