Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions telebot/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -6916,16 +6916,13 @@ class Poll(JsonDeserializable):
:param allows_multiple_answers: True, if the poll allows multiple answers
:type allows_multiple_answers: :obj:`bool`

:param correct_option_id: 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.
:param correct_option_id: 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.
:type correct_option_id: :obj:`int`

:param explanation: Optional. Text that is shown when a user chooses an incorrect answer or taps on the lamp icon in a
quiz-style poll, 0-200 characters
:param explanation: Optional. Text that is shown when a user chooses an incorrect answer or taps on the lamp icon in a quiz-style poll, 0-200 characters
:type explanation: :obj:`str`

:param explanation_entities: Optional. Special entities like usernames, URLs, bot commands, etc. that appear in
the explanation
:param explanation_entities: Optional. Special entities like usernames, URLs, bot commands, etc. that appear in the explanation
:type explanation_entities: :obj:`list` of :class:`telebot.types.MessageEntity`

:param open_period: Optional. Amount of time in seconds the poll will be active after creation
Expand All @@ -6934,6 +6931,9 @@ class Poll(JsonDeserializable):
:param close_date: Optional. Point in time (Unix timestamp) when the poll will be automatically closed
:type close_date: :obj:`int`

:param question_entities: Optional. Special entities that appear in the question. Currently, only custom emoji entities are allowed in poll questions
:type question_entities: :obj:`list` of :class:`telebot.types.MessageEntity`

:return: Instance of the class
:rtype: :class:`telebot.types.Poll`
"""
Expand All @@ -6948,6 +6948,8 @@ def de_json(cls, json_string):
obj['options'] = options or None
if 'explanation_entities' in obj:
obj['explanation_entities'] = Message.parse_entities(obj['explanation_entities'])
if 'question_entities' in obj:
obj['question_entities'] = Message.parse_entities(obj['question_entities'])
return cls(**obj)

# noinspection PyShadowingBuiltins
Expand All @@ -6956,7 +6958,8 @@ def __init__(
question, options,
poll_id=None, total_voter_count=None, is_closed=None, is_anonymous=None, type=None,
allows_multiple_answers=None, correct_option_id=None, explanation=None, explanation_entities=None,
open_period=None, close_date=None, poll_type=None, **kwargs):
open_period=None, close_date=None, poll_type=None, question_entities=None,
**kwargs):
self.id: str = poll_id
self.question: str = question
self.options: List[PollOption] = options
Expand All @@ -6972,6 +6975,7 @@ def __init__(
self.correct_option_id: int = correct_option_id
self.explanation: str = explanation
self.explanation_entities: List[MessageEntity] = explanation_entities
self.question_entities: List[MessageEntity] = question_entities
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need some function to convert these entities into html i think; can you do that now or do we postpone it for later?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did it in the same way as other entities in this class. Thus if we want to have some function (I did not get which one) - we can do it later for all such entities.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

something like html_caption or html_text

self.open_period: int = open_period
self.close_date: int = close_date

Expand Down