MCPcopy Index your code
hub / github.com/python-telegram-bot/python-telegram-bot / Poll

Class Poll

src/telegram/_poll.py:786–1334  ·  view source on GitHub ↗

This object contains information about a poll. Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their :attr:`id` is equal. Examples: :any:`Poll Bot ` Args: id (:obj:`str`): Unique p

Source from the content-addressed store, hash-verified

784
785
786class Poll(TelegramObject):
787 """
788 This object contains information about a poll.
789
790 Objects of this class are comparable in terms of equality. Two objects of this class are
791 considered equal, if their :attr:`id` is equal.
792
793 Examples:
794 :any:`Poll Bot <examples.pollbot>`
795
796 Args:
797 id (:obj:`str`): Unique poll identifier.
798 question (:obj:`str`): Poll question, :tg-const:`telegram.Poll.MIN_QUESTION_LENGTH`-
799 :tg-const:`telegram.Poll.MAX_QUESTION_LENGTH` characters.
800 options (Sequence[:class:`~telegram.PollOption`]): List of poll options.
801
802 .. versionchanged:: 20.0
803 |sequenceclassargs|
804 is_closed (:obj:`bool`): :obj:`True`, if the poll is closed.
805 is_anonymous (:obj:`bool`): :obj:`True`, if the poll is anonymous.
806 type (:obj:`str`): Poll type, currently can be :attr:`REGULAR` or :attr:`QUIZ`.
807 allows_multiple_answers (:obj:`bool`): :obj:`True`, if the poll allows multiple answers.
808 members_only (:obj:`bool`): :obj:`True`, if voting is limited to users who have been
809 members of the chat where the poll was originally sent for more than
810 :tg-const:`telegram.Poll.MIN_MEMBERSHIP_HOURS` hours.
811
812 .. versionadded:: 22.8
813 correct_option_id (:obj:`int`, optional): A zero based identifier of the correct answer
814 option. Available only for closed polls in the quiz mode, which were sent
815 (not forwarded), by the bot or to a private chat with the bot.
816
817 .. deprecated:: 22.8
818 Use :paramref:`correct_option_ids` instead.
819 explanation (:obj:`str`, optional): Text that is shown when a user chooses an incorrect
820 answer or taps on the lamp icon in a quiz-style poll,
821 0-:tg-const:`telegram.Poll.MAX_EXPLANATION_LENGTH` characters.
822 explanation_entities (Sequence[:class:`telegram.MessageEntity`], optional): Special
823 entities like usernames, URLs, bot commands, etc. that appear in the
824 :attr:`explanation`. This list is empty if the message does not contain explanation
825 entities.
826
827 .. versionchanged:: 20.0
828
829 * This attribute is now always a (possibly empty) list and never :obj:`None`.
830 * |sequenceclassargs|
831 explanation_media (:class:`telegram.PollMedia`, optional): Media added to the quiz
832 explanation.
833
834 .. versionadded:: 22.8
835 open_period (:obj:`int` | :class:`datetime.timedelta`, optional): Amount of time in seconds
836 the poll will be active after creation.
837
838 .. versionchanged:: v22.2
839 |time-period-input|
840 close_date (:obj:`datetime.datetime`, optional): Point in time (Unix timestamp) when the
841 poll will be automatically closed. Converted to :obj:`datetime.datetime`.
842
843 .. versionchanged:: 20.3

Calls

no outgoing calls

Used in the wild real call sites across dependent graphs

searching dependent graphs…