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

Method get_updates

telebot/__init__.py:632–665  ·  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[str]]=None,
            long_polling_timeout: int=20)

Source from the content-addressed store, hash-verified

630
631
632 def get_updates(self, offset: Optional[int]=None, limit: Optional[int]=None,
633 timeout: Optional[int]=20, allowed_updates: Optional[List[str]]=None,
634 long_polling_timeout: int=20) -> List[types.Update]:
635 """
636 Use this method to receive incoming updates using long polling (wiki). An Array of Update objects is returned.
637
638 Telegram documentation: https://core.telegram.org/bots/api#getupdates
639
640
641 :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.
642 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
643 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.
644 All previous updates will forgotten.
645 :type offset: :obj:`int`, optional
646
647 :param limit: Limits the number of updates to be retrieved. Values between 1-100 are accepted. Defaults to 100.
648 :type limit: :obj:`int`, optional
649
650 :param timeout: Request connection timeout
651 :type timeout: :obj:`int`, optional
652
653 :param allowed_updates: Array of string. List the types of updates you want your bot to receive.
654 :type allowed_updates: :obj:`list`, optional
655
656 :param long_polling_timeout: Timeout in seconds for long polling.
657 :type long_polling_timeout: :obj:`int`, optional
658
659 :return: An Array of Update objects is returned.
660 :rtype: :obj:`list` of :class:`telebot.types.Update`
661 """
662 json_updates = apihelper.get_updates(
663 self.token, offset=offset, limit=limit, timeout=timeout, allowed_updates=allowed_updates,
664 long_polling_timeout=long_polling_timeout)
665 return [types.Update.de_json(ju) for ju in json_updates]
666
667 def __skip_updates(self):
668 """

Callers 2

__skip_updatesMethod · 0.95
__retrieve_updatesMethod · 0.95

Calls 1

de_jsonMethod · 0.45

Tested by

no test coverage detected