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

Class PollOption

telebot/types.py:7676–7735  ·  view source on GitHub ↗

This object contains information about one answer option in a poll. Telegram Documentation: https://core.telegram.org/bots/api#polloption :param persistent_id: Unique identifier of the option, persistent on option addition and deletion :type persistent_id: :obj:`str` :param t

Source from the content-addressed store, hash-verified

7674
7675
7676class PollOption(JsonDeserializable):
7677 """
7678 This object contains information about one answer option in a poll.
7679
7680 Telegram Documentation: https://core.telegram.org/bots/api#polloption
7681
7682 :param persistent_id: Unique identifier of the option, persistent on option addition and deletion
7683 :type persistent_id: :obj:`str`
7684
7685 :param text: Option text, 1-100 characters
7686 :type text: :obj:`str`
7687
7688 :param text_entities: Optional. Special entities that appear in the option text. Currently, only custom emoji entities are allowed in poll option texts
7689 :type text_entities: :obj:`list` of :class:`telebot.types.MessageEntity`
7690
7691 :param media: Optional. Media added to the poll option
7692 :type media: :class:`telebot.types.PollMedia`
7693
7694 :param voter_count: Number of users that voted for this option
7695 :type voter_count: :obj:`int`
7696
7697 :param added_by_user: Optional. User who added the option; omitted if the option wasn't added by a user after poll creation
7698 :type added_by_user: :class:`telebot.types.User`
7699
7700 :param added_by_chat: Optional. Chat that added the option; omitted if the option wasn't added by a chat after poll creation
7701 :type added_by_chat: :class:`telebot.types.Chat`
7702
7703 :param addition_date: Optional. Point in time (Unix timestamp) when the option was added; omitted if the option existed in the original poll
7704 :type addition_date: :obj:`int`
7705
7706 :return: Instance of the class
7707 :rtype: :class:`telebot.types.PollOption`
7708 """
7709 @classmethod
7710 def de_json(cls, json_string):
7711 if json_string is None: return None
7712 obj = cls.check_json(json_string, dict_copy=False)
7713 if 'text_entities' in obj:
7714 obj['text_entities'] = Message.parse_entities(obj['text_entities'])
7715 if 'added_by_user' in obj:
7716 obj['added_by_user'] = User.de_json(obj['added_by_user'])
7717 if 'added_by_chat' in obj:
7718 obj['added_by_chat'] = Chat.de_json(obj['added_by_chat'])
7719 if 'media' in obj:
7720 obj['media'] = PollMedia.de_json(obj['media'])
7721 return cls(**obj)
7722
7723 def __init__(self, text, persistent_id, voter_count = 0, text_entities=None, added_by_user=None, added_by_chat=None, addition_date=None, media=None, **kwargs):
7724 self.text: str = text
7725 self.persistent_id: str = persistent_id
7726 self.voter_count: int = voter_count
7727 self.text_entities: Optional[List[MessageEntity]] = text_entities
7728 self.added_by_user: Optional[User] = added_by_user
7729 self.added_by_chat: Optional[Chat] = added_by_chat
7730 self.addition_date: Optional[int] = addition_date
7731 self.media: Optional[PollMedia] = media
7732 # Converted in _convert_poll_options
7733 # def to_json(self):

Callers 1

addMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…