MCPcopy Create free account
hub / github.com/eternnoir/pyTelegramBotAPI / get_updates

Method get_updates

telebot/async_telebot.py:221–251  ·  view source on GitHub ↗

Use this method to receive incoming updates using long polling (wiki). An Array of Update objects is returned. Telegram documentation: https://core.telegram.org/bots/api#getupdates :param offset: Identifier of the first update to be returned. Must be greater by one than t

(self, offset: Optional[int]=None, limit: Optional[int]=None,
        timeout: Optional[int]=20, allowed_updates: Optional[List]=None, request_timeout: Optional[int]=None)

Source from the content-addressed store, hash-verified

219 await asyncio_helper.session_manager.session.close()
220
221 async def get_updates(self, offset: Optional[int]=None, limit: Optional[int]=None,
222 timeout: Optional[int]=20, allowed_updates: Optional[List]=None, request_timeout: Optional[int]=None) -> List[types.Update]:
223 """
224 Use this method to receive incoming updates using long polling (wiki). An Array of Update objects is returned.
225
226 Telegram documentation: https://core.telegram.org/bots/api#getupdates
227
228
229 :param offset: Identifier of the first update to be returned. Must be greater by one than the highest among the identifiers of previously received updates.
230 By default, updates starting with the earliest unconfirmed update are returned. An update is considered confirmed as soon as getUpdates is called with an offset
231 higher than its update_id. The negative offset can be specified to retrieve updates starting from -offset update from the end of the updates queue.
232 All previous updates will forgotten.
233 :type offset: :obj:`int`, optional
234
235 :param limit: Limits the number of updates to be retrieved. Values between 1-100 are accepted. Defaults to 100.
236 :type limit: :obj:`int`, optional
237
238 :param timeout: Request connection timeout
239 :type timeout: :obj:`int`, optional
240
241 :param allowed_updates: Array of string. List the types of updates you want your bot to receive.
242 :type allowed_updates: :obj:`list`, optional
243
244 :param request_timeout: Timeout in seconds for request.
245 :type request_timeout: :obj:`int`, optional
246
247 :return: An Array of Update objects is returned.
248 :rtype: :obj:`list` of :class:`telebot.types.Update`
249 """
250 json_updates = await asyncio_helper.get_updates(self.token, offset, limit, timeout, allowed_updates, request_timeout)
251 return [types.Update.de_json(ju) for ju in json_updates]
252
253 def _setup_change_detector(self, path_to_watch: str) -> None:
254 try:

Callers 2

_process_pollingMethod · 0.95
skip_updatesMethod · 0.95

Calls 1

de_jsonMethod · 0.45

Tested by

no test coverage detected