-
Notifications
You must be signed in to change notification settings - Fork 6k
Updates to the poll section in bot API 9.6 #5202
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: api-9.6-central
Are you sure you want to change the base?
Changes from all commits
fd0e1b8
f10126b
348de47
6f9967f
c848c17
a5c214e
c6aa05e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -102,6 +102,7 @@ | |
| from telegram._utils.types import ( | ||
| BaseUrl, | ||
| CorrectOptionID, | ||
| CorrectOptionIds, | ||
| FileInput, | ||
| JSONDict, | ||
| ODVInput, | ||
|
|
@@ -7596,9 +7597,17 @@ async def send_poll( | |
| options: Sequence["str | InputPollOption"], | ||
| is_anonymous: bool | None = None, | ||
| type: str | None = None, # pylint: disable=redefined-builtin | ||
| allows_multiple_answers: bool | None = None, | ||
| correct_option_id: CorrectOptionID | None = None, | ||
| allows_multiple_answers: bool | None = None, | ||
| allows_revoting: bool | None = None, | ||
| allow_adding_options: bool | None = None, | ||
| hide_results_until_closes: bool | None = None, | ||
| correct_option_ids: CorrectOptionIds | None = None, | ||
| is_closed: bool | None = None, | ||
| description: str | None = None, | ||
| description_parse_mode: str | None = None, | ||
| description_entities: Sequence["MessageEntity"] | None = None, | ||
| shuffle_options: bool | None = None, | ||
| disable_notification: ODVInput[bool] = DEFAULT_NONE, | ||
| reply_markup: "ReplyMarkup | None" = None, | ||
| explanation: str | None = None, | ||
|
|
@@ -7652,6 +7661,25 @@ async def send_poll( | |
| multiple answers, ignored for polls in quiz mode, defaults to :obj:`False`. | ||
| correct_option_id (:obj:`int`, optional): 0-based identifier of the correct answer | ||
| option, required for polls in quiz mode. | ||
| allows_revoting (:obj:`bool`, optional): :obj:`True`, if the poll allows to | ||
| change the chosen answer options, defaults to :obj:`False` for quizzes and to :obj:`True` for regular polls | ||
|
|
||
| .. versionadded:: NEXT.VERSION | ||
| allow_adding_options (:obj:`bool`, optional): :obj:`True`, if answer options can be | ||
| added to the poll after creation; not supported for anonymous polls and quizzes | ||
|
|
||
| .. versionadded:: NEXT.VERSION | ||
| shuffle_options (:obj:`bool`, optional): :obj:`True`, if the poll options must be | ||
| shown in random order | ||
|
|
||
| .. versionadded:: NEXT.VERSION | ||
| hide_results_until_closes (:obj:`bool`, optional): :obj:`True`, if poll results | ||
| must be shown only after the poll closes | ||
|
|
||
| .. versionadded:: NEXT.VERSION | ||
| correct_option_ids (Sequence[:class:`int`], optional): A list of monotonically increasing 0-based identifiers of the correct answer options, required for polls in quiz mode. | ||
|
|
||
| .. versionadded:: NEXT.VERSION | ||
|
Comment on lines
+7664
to
+7682
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. all these new documentation should be after the |
||
| explanation (:obj:`str`, optional): Text that is shown when a user chooses an incorrect | ||
| answer or taps on the lamp icon in a quiz-style poll, | ||
| 0-:tg-const:`telegram.Poll.MAX_EXPLANATION_LENGTH` characters with at most | ||
|
|
@@ -7682,6 +7710,21 @@ async def send_poll( | |
| |tz-naive-dtms| | ||
| is_closed (:obj:`bool`, optional): Pass :obj:`True`, if the poll needs to be | ||
| immediately closed. This can be useful for poll preview. | ||
| description (:obj:`str`, optional): Description of the poll to be sent, | ||
| 0-:tg-const:`telegram.Poll.MAX_DESCRIPTION_CHARACTERS` characters | ||
| after entities parsing. | ||
|
|
||
| .. versionadded:: NEXT.VERSION | ||
| description_parse_mode (:obj:`str`, optional): Mode for parsing entities | ||
| in the poll description. See the constants | ||
| in :class:`telegram.constants.ParseMode` | ||
|
|
||
| .. versionadded:: NEXT.VERSION | ||
| description_entities (Sequence[:class:`telegram.MessageEntity`], optional): A | ||
| JSON-serialized list of special entities that appear in the poll description, | ||
| which can be specified instead of :paramref:`description_parse_mode` | ||
|
|
||
| .. versionadded:: NEXT.VERSION | ||
| disable_notification (:obj:`bool`, optional): |disable_notification| | ||
| protect_content (:obj:`bool`, optional): |protect_content| | ||
|
|
||
|
|
@@ -7756,7 +7799,15 @@ async def send_poll( | |
| "type": type, | ||
| "allows_multiple_answers": allows_multiple_answers, | ||
| "correct_option_id": correct_option_id, | ||
| "allow_adding_options": allow_adding_options, | ||
| "allows_revoting": allows_revoting, | ||
| "shuffle_options": shuffle_options, | ||
| "hide_results_until_closes": hide_results_until_closes, | ||
| "correct_option_ids": correct_option_ids, | ||
| "is_closed": is_closed, | ||
| "description": description, | ||
| "description_parse_mode": description_parse_mode, | ||
| "description_entities": description_entities, | ||
| "explanation": explanation, | ||
| "explanation_entities": explanation_entities, | ||
| "open_period": open_period, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,6 +34,7 @@ | |
| from telegram._utils.defaultvalue import DEFAULT_NONE | ||
| from telegram._utils.types import ( | ||
| CorrectOptionID, | ||
| CorrectOptionIds, | ||
| FileInput, | ||
| JSONDict, | ||
| ODVInput, | ||
|
|
@@ -2296,9 +2297,17 @@ async def send_poll( | |
| question_entities: Sequence["MessageEntity"] | None = None, | ||
| message_effect_id: str | None = None, | ||
| allow_paid_broadcast: bool | None = None, | ||
| shuffle_options: bool | None = None, | ||
| allows_revoting: bool | None = None, | ||
| correct_option_ids: CorrectOptionIds | None = None, | ||
| allow_adding_options: bool | None = None, | ||
| hide_results_until_closes: bool | None = None, | ||
| description: str | None = None, | ||
| description_parse_mode: str | None = None, | ||
| description_entities: Sequence["MessageEntity"] | None = None, | ||
| *, | ||
| reply_to_message_id: int | None = None, | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. revert this too |
||
| allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, | ||
| reply_to_message_id: int | None = None, | ||
| read_timeout: ODVInput[float] = DEFAULT_NONE, | ||
| write_timeout: ODVInput[float] = DEFAULT_NONE, | ||
| connect_timeout: ODVInput[float] = DEFAULT_NONE, | ||
|
|
@@ -2323,6 +2332,9 @@ async def send_poll( | |
| type=type, # pylint=pylint, | ||
| allows_multiple_answers=allows_multiple_answers, | ||
| correct_option_id=correct_option_id, | ||
| allows_revoting=allows_revoting, | ||
| shuffle_options=shuffle_options, | ||
| correct_option_ids=correct_option_ids, | ||
| is_closed=is_closed, | ||
| disable_notification=disable_notification, | ||
| reply_to_message_id=reply_to_message_id, | ||
|
|
@@ -2346,6 +2358,11 @@ async def send_poll( | |
| business_connection_id=business_connection_id, | ||
| question_parse_mode=question_parse_mode, | ||
| question_entities=question_entities, | ||
| description=description, | ||
| description_parse_mode=description_parse_mode, | ||
| description_entities=description_entities, | ||
| hide_results_until_closes=hide_results_until_closes, | ||
| allow_adding_options=allow_adding_options, | ||
| ) | ||
|
|
||
| async def send_copy( | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -65,7 +65,7 @@ | |
| from telegram._payment.invoice import Invoice | ||
| from telegram._payment.refundedpayment import RefundedPayment | ||
| from telegram._payment.successfulpayment import SuccessfulPayment | ||
| from telegram._poll import Poll | ||
| from telegram._poll import Poll, PollOptionAdded, PollOptionDeleted | ||
| from telegram._proximityalerttriggered import ProximityAlertTriggered | ||
| from telegram._reply import ReplyParameters | ||
| from telegram._shared import ChatShared, UsersShared | ||
|
|
@@ -80,6 +80,7 @@ | |
| from telegram._utils.strings import TextEncoding | ||
| from telegram._utils.types import ( | ||
| CorrectOptionID, | ||
| CorrectOptionIds, | ||
| JSONDict, | ||
| MarkdownVersion, | ||
| ODVInput, | ||
|
|
@@ -689,6 +690,18 @@ class Message(MaybeInaccessibleMessage): | |
| supergroups only | ||
|
|
||
| .. versionadded:: 22.7 | ||
| poll_option_added (:class:`telegram.PollOptionAdded`, optional): Service message: | ||
| answer option was added to a poll. | ||
|
|
||
| .. versionadded:: NEXT.VERSION | ||
| poll_option_deleted (:class:`telegram.PollOptionDeleted`, optional): Service message: | ||
| answer option was deleted from a poll. | ||
|
|
||
| .. versionadded:: NEXT.VERSION | ||
| reply_to_poll_option_id (:obj:`str`, optional): Persistent | ||
| identifier of the specific poll option that is being replied to. | ||
|
|
||
| .. versionadded:: NEXT.VERSION | ||
|
|
||
| Attributes: | ||
| message_id (:obj:`int`): Unique message identifier inside this chat. In specific instances | ||
|
|
@@ -1105,6 +1118,18 @@ class Message(MaybeInaccessibleMessage): | |
| supergroups only | ||
|
|
||
| .. versionadded:: 22.7 | ||
| poll_option_added (:class:`telegram.PollOptionAdded`): Optional. Service message: | ||
| answer option was added to a poll. | ||
|
|
||
| .. versionadded:: NEXT.VERSION | ||
| poll_option_deleted (:class:`telegram.PollOptionDeleted`): Optional. Service message: | ||
| answer option was deleted from a poll. | ||
|
|
||
| .. versionadded:: NEXT.VERSION | ||
| reply_to_poll_option_id (:obj:`str`): Optional. Persistent | ||
| identifier of the specific poll option that is being replied to. | ||
|
|
||
| .. versionadded:: NEXT.VERSION | ||
|
|
||
| .. |custom_emoji_no_md1_support| replace:: Since custom emoji entities are not supported by | ||
| :attr:`~telegram.constants.ParseMode.MARKDOWN`, this method now raises a | ||
|
|
@@ -1191,12 +1216,15 @@ class Message(MaybeInaccessibleMessage): | |
| "photo", | ||
| "pinned_message", | ||
| "poll", | ||
| "poll_option_added", | ||
| "poll_option_deleted", | ||
| "proximity_alert_triggered", | ||
| "quote", | ||
| "refunded_payment", | ||
| "reply_markup", | ||
| "reply_to_checklist_task_id", | ||
| "reply_to_message", | ||
| "reply_to_poll_option_id", | ||
| "reply_to_story", | ||
| "sender_boost_count", | ||
| "sender_business_bot", | ||
|
|
@@ -1315,6 +1343,8 @@ def __init__( | |
| effect_id: str | None = None, | ||
| show_caption_above_media: bool | None = None, | ||
| paid_media: PaidMediaInfo | None = None, | ||
| poll_option_added: PollOptionAdded | None = None, | ||
| poll_option_deleted: PollOptionDeleted | None = None, | ||
|
Comment on lines
+1346
to
+1347
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. these parameters should be added after |
||
| refunded_payment: RefundedPayment | None = None, | ||
| gift: GiftInfo | None = None, | ||
| unique_gift: UniqueGiftInfo | None = None, | ||
|
|
@@ -1337,6 +1367,7 @@ def __init__( | |
| chat_owner_changed: ChatOwnerChanged | None = None, | ||
| chat_owner_left: ChatOwnerLeft | None = None, | ||
| sender_tag: str | None = None, | ||
| reply_to_poll_option_id: str | None = None, | ||
| *, | ||
| api_kwargs: JSONDict | None = None, | ||
| ): | ||
|
|
@@ -1467,6 +1498,9 @@ def __init__( | |
| self.chat_owner_changed: ChatOwnerChanged | None = chat_owner_changed | ||
| self.chat_owner_left: ChatOwnerLeft | None = chat_owner_left | ||
| self.sender_tag: str | None = sender_tag | ||
| self.poll_option_added: PollOptionAdded | None = poll_option_added | ||
| self.poll_option_deleted: PollOptionDeleted | None = poll_option_deleted | ||
| self.reply_to_poll_option_id: str | None = reply_to_poll_option_id | ||
|
|
||
| self._effective_attachment = DEFAULT_NONE | ||
|
|
||
|
|
@@ -3464,24 +3498,32 @@ async def reply_poll( | |
| explanation: str | None = None, | ||
| explanation_parse_mode: ODVInput[str] = DEFAULT_NONE, | ||
| open_period: TimePeriod | None = None, | ||
| close_date: int | (dtm.datetime | None) = None, | ||
| close_date: int | dtm.datetime | None = None, | ||
| explanation_entities: Sequence["MessageEntity"] | None = None, | ||
| protect_content: ODVInput[bool] = DEFAULT_NONE, | ||
| message_thread_id: ODVInput[int] = DEFAULT_NONE, | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please revert this change |
||
| message_thread_id: int | None = None, | ||
| reply_parameters: "ReplyParameters | None" = None, | ||
| question_parse_mode: ODVInput[str] = DEFAULT_NONE, | ||
| question_entities: Sequence["MessageEntity"] | None = None, | ||
| message_effect_id: str | None = None, | ||
| allow_paid_broadcast: bool | None = None, | ||
| shuffle_options: bool | None = None, | ||
| allows_revoting: bool | None = None, | ||
| correct_option_ids: CorrectOptionIds | None = None, | ||
| allow_adding_options: bool | None = None, | ||
| hide_results_until_closes: bool | None = None, | ||
| description: str | None = None, | ||
| description_parse_mode: str | None = None, | ||
| description_entities: Sequence["MessageEntity"] | None = None, | ||
| *, | ||
| reply_to_message_id: int | None = None, | ||
| allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE, | ||
| do_quote: bool | (_ReplyKwargs | None) = None, | ||
|
Comment on lines
-3477
to
-3479
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please revert these changes |
||
| reply_to_message_id: int | None = None, | ||
| read_timeout: ODVInput[float] = DEFAULT_NONE, | ||
| write_timeout: ODVInput[float] = DEFAULT_NONE, | ||
| connect_timeout: ODVInput[float] = DEFAULT_NONE, | ||
| pool_timeout: ODVInput[float] = DEFAULT_NONE, | ||
| api_kwargs: JSONDict | None = None, | ||
| do_quote: bool | (_ReplyKwargs | None) = None, | ||
| ) -> "Message": | ||
| """Shortcut for:: | ||
|
|
||
|
|
@@ -3522,6 +3564,9 @@ async def reply_poll( | |
| type=type, | ||
| allows_multiple_answers=allows_multiple_answers, | ||
| correct_option_id=correct_option_id, | ||
| allows_revoting=allows_revoting, | ||
| shuffle_options=shuffle_options, | ||
| correct_option_ids=correct_option_ids, | ||
| is_closed=is_closed, | ||
| disable_notification=disable_notification, | ||
| reply_parameters=effective_reply_parameters, | ||
|
|
@@ -3543,6 +3588,11 @@ async def reply_poll( | |
| question_entities=question_entities, | ||
| message_effect_id=message_effect_id, | ||
| allow_paid_broadcast=allow_paid_broadcast, | ||
| description=description, | ||
| description_parse_mode=description_parse_mode, | ||
| description_entities=description_entities, | ||
| hide_results_until_closes=hide_results_until_closes, | ||
| allow_adding_options=allow_adding_options, | ||
| ) | ||
|
|
||
| async def reply_dice( | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the same thing I said about the parameters in
extbot.pyapplies here too.