Skip to content

Updates to the poll section in bot API 9.6#5202

Open
ouyooung wants to merge 7 commits intopython-telegram-bot:api-9.6-centralfrom
ouyooung:api-9.6-polls
Open

Updates to the poll section in bot API 9.6#5202
ouyooung wants to merge 7 commits intopython-telegram-bot:api-9.6-centralfrom
ouyooung:api-9.6-polls

Conversation

@ouyooung
Copy link
Copy Markdown
Contributor

@ouyooung ouyooung commented Apr 7, 2026

Check-list for PRs

  • Added .. versionadded:: NEXT.VERSION, .. versionchanged:: NEXT.VERSION, .. deprecated:: NEXT.VERSION or ``.. versionremoved:: NEXT.VERSION` to the docstrings for user facing changes (for methods/class descriptions, arguments and attributes)
  • Created new or adapted existing unit tests
  • Documented code changes according to the CSI standard
  • Added myself alphabetically to AUTHORS.rst (optional)
  • Added new classes & modules to the docs and all suitable __all__ s
  • Checked the Stability Policy in case of deprecations or changes to documented behavior

If the PR contains API changes (otherwise, you can ignore this passage)

  • Checked the Bot API specific sections of the Stability Policy

  • Created a PR to remove functionality deprecated in the previous Bot API release (see here)

  • New Classes

    • Added self._id_attrs and corresponding documentation
    • __init__ accepts api_kwargs as keyword-only
  • Added New Shortcuts

    • In telegram.Chat & telegram.User for all methods that accept chat/user_id
    • In telegram.Message for all methods that accept chat_id and message_id
    • For new telegram.Message shortcuts: Added quote argument if methods accept reply_to_message_id
    • In telegram.CallbackQuery for all methods that accept either chat_id and message_id or inline_message_id
  • If Relevant

    • Added new constants at telegram.constants and shortcuts to them as class variables
    • Linked new and existing constants in docstrings instead of hard-coded numbers and strings
    • Added new message types to telegram.Message.effective_attachment
    • Added new handlers for new update types
    • Added new filters for new message (sub)types
    • Added or updated documentation for the changed class(es) and/or method(s)
    • Added the new method(s) to _extbot.py
    • Added or updated bot_methods.rst
    • Updated the Bot API version number in all places: README.rst (including the badge) and telegram.constants.BOT_API_VERSION_INFO
    • Added logic for arbitrary callback data in telegram.ext.ExtBot for new methods that either accept a reply_markup in some form or have a return type that is/contains telegram.Message

Copy link
Copy Markdown
Member

@harshil21 harshil21 left a comment

Choose a reason for hiding this comment

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

Good work so far! About the deprecated things in this API update, this PR shows how we've done it in the past. Note the comments in the code which says "tags", and the warnings which are raised in the code if something deprecated is used. Can you implement that too?

Comment on lines -3239 to 3241
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,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this change is breaking. allows_multiple_answers should not be reordered.


CorrectOptionID: TypeAlias = Literal[0, 1, 2, 3, 4, 5, 6, 7, 8, 9] # pylint: disable=invalid-name

CorrectOptionIds: TypeAlias = tuple[Literal[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], ...]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

where is this documented to go up to 11?

Comment on lines +3241 to +3245
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,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

all the new options should be added after allow_paid_broadcast

message_effect_id: str | None = None,
allow_paid_broadcast: bool | None = None,
*,
reply_to_message_id: int | None = None,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

please revert this change of reordering.

Comment on lines +7601 to +7610
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,
Copy link
Copy Markdown
Member

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.py applies here too.

allows_revoting (:obj:`bool`): :obj:`True`, if the poll allows to change the chosen
answer options

.. versionadded:: NEXT.VERSION
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

same thing here, move the docstring down, and also make this an optional argument for now. Don't forget to add the "tag" comment down in the __init__ too

description_parse_mode: str | None = None,
description_entities: Sequence["MessageEntity"] | None = None,
*,
reply_to_message_id: int | None = None,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

revert this change

Also used in the :paramref:`~telegram.Bot.send_poll.close_date` parameter of
:meth:`telegram.Bot.send_poll`.

.. versionadded:: NEXT.VERSION
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this should be a ..versionchanged and mention that this was changed from 600 to 2628000 since bot api 9.6.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you delete this file, and instead add the new entry to the 5196 file like I did here?

ouyooung and others added 3 commits April 9, 2026 12:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants