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

Add get_updates method.

This commit is contained in:
eternnoir 2015-09-05 18:10:11 +08:00
parent f7c4b14b77
commit da729069c2

View File

@ -59,6 +59,20 @@ class TeleBot:
if self.__create_threads:
self.worker_pool = util.ThreadPool(num_threads)
def get_Updates(self, offset=None,limit=None, timeout=20):
"""
Use this method to receive incoming updates using long polling (wiki). An Array of Update objects is returned.
:param offset: Integer. Identifier of the first update to be returned.
:param limit: Integer. Limits the number of updates to be retrieved.
:param timeout: Integer. Timeout in seconds for long polling.
:return: array of Updates
"""
json_updates = apihelper.get_updates(self.token, offset, limit, timeout)
ret = []
for ju in json_updates:
ret.append(types.Update.de_json(ju))
return ret
def get_update(self):
"""
Retrieves any updates from the Telegram API.