- class telegram.Poll(*args, **kwargs)¶
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
int, optional) – 0-based identifier of the correct answer option. Available only for polls in the quiz mode, which are closed, or was sent (not forwarded) by the bot or to the private chat with the bot.
Optional. Text that is shown when a user chooses an incorrect answer or taps on the lamp icon in a quiz-style poll.
Special entities like usernames, URLs, bot commands, etc. that appear in the
explanation. This list is empty if the message does not contain explanation entities.
Changed in version 20.0: This attribute is now always a (possibly empty) list and never
Optional. Point in time when the poll will be automatically closed.
str. It contains entities from this polls explanation filtered by their
typeattribute as the key, and the text that each entity belongs to as the value of the
This method should always be used instead of the
explanation_entitiesattribute, since it calculates the correct substring from the message text based on UTF-16 codepoints. See
parse_explanation_entityfor more info.
A dictionary of entities mapped to the text that belongs to them, calculated based on UTF-16 codepoints.
- Return type
Returns the text from a given
This method is present because Telegram calculates the offset and length in UTF-16 codepoint pairs, which some versions of Python don’t handle automatically. (That is, you can’t just slice
Message.textwith the offset and length.)