Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
e59d903
Reapply accediently remove line by (#5196)
aelkheir May 10, 2026
1c17ebd
Add new `{Input*,Poll}` classes
aelkheir May 10, 2026
66f0fcd
Add chango fragment for PR #5232
aelkheir May 10, 2026
0c9c5e7
Add new fields to `_poll.py` classes
aelkheir May 12, 2026
675dc7c
Deprecat `InputPollOption.de_json()`
aelkheir May 12, 2026
d443a03
Decrease minimum number of poll options from 2 to 1
aelkheir May 17, 2026
66c4054
Add new params to Bot.send_poll
aelkheir May 17, 2026
311bbb3
Doc fix
aelkheir May 17, 2026
55c9a1b
Update Poll(Option) initializers in tests
aelkheir May 17, 2026
d6be680
A bunch of other doc fixes
aelkheir May 17, 2026
f259d9e
Fix a test_official failure
aelkheir May 17, 2026
fdb0962
Merge remote-tracking branch 'upstream/api-10.0-central' into api-10.…
aelkheir May 31, 2026
b64e967
Fix another test_official failure
aelkheir May 31, 2026
68b9bdf
Apply required workaround to `option_persistent_ids`
aelkheir May 31, 2026
d9c87a0
Add some notes to changelog
aelkheir May 31, 2026
cba3adc
Revert "Reapply accediently remove line by (#5196)"
aelkheir May 31, 2026
68839f4
Remove reliance on unreachable fixture
aelkheir May 31, 2026
39dc2db
Fix `not frozen correctly` failures
aelkheir Jun 1, 2026
afffcbf
Pass missing required args in test files
aelkheir Jun 1, 2026
55984f1
review: docs suggestions
aelkheir Jun 2, 2026
9616cd7
review: use `TypeAlias` instead of multiple inheritence
aelkheir Jun 3, 2026
d6457de
review: deprecate positional passing of `filename`
aelkheir Jun 4, 2026
2bcd366
Mention `de_json` deprecation in changelog
aelkheir Jun 4, 2026
eae1e91
review: fix typo
aelkheir Jun 4, 2026
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
19 changes: 18 additions & 1 deletion changes/unreleased/5196.7keq7yJhXbMb9RyShLHz4D.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,21 @@
features = "Full Support for Bot API 9.6"
features = """
Full Support for Bot API 9.6

.. warning::

- Bot API 9.6 replaces the field ``correct_option_id`` of ``Poll`` with the new field ``correct_option_ids``. The field ``correct_option_id`` is still present in PTB for backward compatibility, but it will be removed in future releases.

- Bot API 9.6 replaces the argument ``correct_option_id`` of ``Bot.send_poll`` with the new argument ``correct_option_ids``. The argument ``correct_option_id`` is still present in PTB for backward compatibility, but it will be removed in future releases.

- Bot API 9.6 introduces a now required argument ``persistent_id`` to ``PollOption``. For backward compatibility, the argument is currently still marked as optional in the signature and its presence is enforced through a runtime check. In future versions, this argument will be made required in the signature as well.

- Bot API 9.6 introduces a now required argument ``option_persistent_ids`` to ``PollAnswer``. For backward compatibility, the argument is currently still marked as optional in the signature and its presence is enforced through a runtime check. In future versions, this argument will be made required in the signature as well.

- Bot API 9.6 introduces a now required argument ``allows_revoting`` to ``Poll``. For backward compatibility, the argument is currently still marked as optional in the signature and its presence is enforced through a runtime check. In future versions, this argument will be made required in the signature as well.


Please make sure to update your code accordingly to avoid potential issues in the future. We recommend using keyword arguments to ensure compatibility with future updates.
"""

pull_requests = [
{ uid = "5196", author_uid = "harshil21" },
Expand Down
26 changes: 25 additions & 1 deletion changes/unreleased/5229.87PBN4GFkuAaDhhgFwCYkY.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,32 @@
highlights = "Full Support for Bot API 10.0"
features = """
Full Support for Bot API 10.0

.. warning::

- Bot API 10.0 introduces a now required argument ``members_only`` to ``Poll``. For backward compatibility, the argument is currently still marked as optional in the signature and its presence is enforced through a runtime check. In future versions, this argument will be made required in the signature as well.

Please make sure to update your code accordingly to avoid potential issues in the future. We recommend using keyword arguments to ensure compatibility with future updates.
"""

deprecations = """
* Deprecated passing the ``filename`` parameter positionally to the classes:

* ``InputMediaAnimation``
* ``InputMediaAudio``
* ``InputMediaPhoto``
* ``InputMediaDocument``
* ``InputMediaVideo``

Please pass ``filename`` as a keyword argument instead, as this parameter will become keyword-only in the future.

* Deprecated ``InputPollOption.de_json``. The class ``InputPollOption`` is input only and its ``de_json`` method will be removed in future versions. The Bot API 10.0 ``media`` field of ``InputPollOption`` will not be included for deserialization.

"""

pull_requests = [
{ uid = "5229", author_uid = "aelkheir", closes_threads = ["5228"] },
{ uid = "5230", author_uid = "harshil21" },
{ uid = "5235", author_uid = "harshil21" },
{ uid = "5238", author_uid = "harshil21" },
{ uid = "5232", author_uid = "aelkheir" },
]
1 change: 1 addition & 0 deletions docs/auxil/sphinx_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
"_BaseMedium": "TelegramObject",
"_CredentialsBase": "TelegramObject",
"_ChatBase": "TelegramObject",
"_BaseInputMedia": "TelegramObject",
}


Expand Down
6 changes: 6 additions & 0 deletions docs/source/telegram.at-tree.rst
Original file line number Diff line number Diff line change
Expand Up @@ -103,16 +103,21 @@ Available Types
telegram.inputmediaaudio
telegram.inputmediadocument
telegram.inputmedialivephoto
telegram.inputmedialocation
telegram.inputmediaphoto
telegram.inputmediasticker
telegram.inputmediavenue
telegram.inputmediavideo
telegram.inputpaidmedia
telegram.inputpaidmedialivephoto
telegram.inputpaidmediaphoto
telegram.inputpaidmediavideo
telegram.inputpollmedia
telegram.inputprofilephoto
telegram.inputprofilephotoanimated
telegram.inputprofilephotostatic
telegram.inputpolloption
telegram.inputpolloptionmedia
telegram.inputstorycontent
telegram.inputstorycontentphoto
telegram.inputstorycontentvideo
Expand Down Expand Up @@ -159,6 +164,7 @@ Available Types
telegram.photosize
telegram.poll
telegram.pollanswer
telegram.pollmedia
telegram.polloptionadded
telegram.polloptiondeleted
telegram.preparedkeyboardbutton
Expand Down
6 changes: 6 additions & 0 deletions docs/source/telegram.inputmedialocation.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
InputMediaLocation
==================

.. autoclass:: telegram.InputMediaLocation
:members:
:show-inheritance:
6 changes: 6 additions & 0 deletions docs/source/telegram.inputmediasticker.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
InputMediaSticker
=================

.. autoclass:: telegram.InputMediaSticker
:members:
:show-inheritance:
6 changes: 6 additions & 0 deletions docs/source/telegram.inputmediavenue.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
InputMediaVenue
===============

.. autoclass:: telegram.InputMediaVenue
:members:
:show-inheritance:
6 changes: 6 additions & 0 deletions docs/source/telegram.inputpollmedia.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
InputPollMedia
==============

.. versionadded:: NEXT.VERSION

.. autoclass:: telegram.InputPollMedia
6 changes: 6 additions & 0 deletions docs/source/telegram.inputpolloptionmedia.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
InputPollOptionMedia
====================

.. versionadded:: NEXT.VERSION

.. autoclass:: telegram.InputPollOptionMedia
6 changes: 6 additions & 0 deletions docs/source/telegram.pollmedia.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
PollMedia
=========

.. autoclass:: telegram.PollMedia
:members:
:show-inheritance:
12 changes: 12 additions & 0 deletions src/telegram/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,19 @@
"InputMediaAudio",
"InputMediaDocument",
"InputMediaLivePhoto",
"InputMediaLocation",
"InputMediaPhoto",
"InputMediaSticker",
"InputMediaVenue",
"InputMediaVideo",
"InputMessageContent",
"InputPaidMedia",
"InputPaidMediaLivePhoto",
"InputPaidMediaPhoto",
"InputPaidMediaVideo",
"InputPollMedia",
"InputPollOption",
"InputPollOptionMedia",
"InputProfilePhoto",
"InputProfilePhotoAnimated",
"InputProfilePhotoStatic",
Expand Down Expand Up @@ -236,6 +241,7 @@
"PhotoSize",
"Poll",
"PollAnswer",
"PollMedia",
"PollOption",
"PollOptionAdded",
"PollOptionDeleted",
Expand Down Expand Up @@ -442,12 +448,17 @@
InputMediaAudio,
InputMediaDocument,
InputMediaLivePhoto,
InputMediaLocation,
InputMediaPhoto,
InputMediaSticker,
InputMediaVenue,
InputMediaVideo,
InputPaidMedia,
InputPaidMediaLivePhoto,
InputPaidMediaPhoto,
InputPaidMediaVideo,
InputPollMedia,
InputPollOptionMedia,
)
from ._files.inputprofilephoto import (
InputProfilePhoto,
Expand Down Expand Up @@ -589,6 +600,7 @@
InputPollOption,
Poll,
PollAnswer,
PollMedia,
PollOption,
PollOptionAdded,
PollOptionDeleted,
Expand Down
30 changes: 30 additions & 0 deletions src/telegram/_bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@
InputMediaLivePhoto,
InputMediaPhoto,
InputMediaVideo,
InputPollMedia,
InputProfilePhoto,
InputSticker,
InputStoryContent,
Expand Down Expand Up @@ -7638,6 +7639,10 @@ async def send_poll(
description_parse_mode: str | None = None,
description_entities: Sequence["MessageEntity"] | None = None,
shuffle_options: bool | None = None,
members_only: bool | None = None,
country_codes: Sequence[str] | None = None,
explanation_media: "InputPollMedia | None" = None,
media: "InputPollMedia | None" = None,
*,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
reply_to_message_id: int | None = None,
Expand Down Expand Up @@ -7780,6 +7785,27 @@ async def send_poll(
shuffle_options (:obj:`bool`, optional): :obj:`True`, if the poll options must be
shown in random order

.. versionadded:: NEXT.VERSION
members_only (:obj:`bool`, optional): :obj:`True`, if voting is limited to users who
have been members of the chat where the poll is being sent for more than
:tg-const:`telegram.Poll.MIN_MEMBERSHIP_HOURS` hours; for channel chats only

.. versionadded:: NEXT.VERSION
country_codes (Sequence[:obj:`str`], optional): A list of
0-:tg-const:`telegram.constants.PollLimit.MAX_COUNTRY_CODES` two-letter
``ISO 3166-1 alpha-2`` country codes indicating the countries from which users can
vote in the poll; for channel chats only. Use ``"FT"`` as a country code to allow
users with anonymous numbers to vote. If omitted or empty, then users from any
country can participate in the poll.

.. versionadded:: NEXT.VERSION
explanation_media (:class:`telegram.InputPollMedia`, optional): Media added to the quiz
explanation

.. versionadded:: NEXT.VERSION
media (:class:`telegram.InputPollMedia`, optional): Media added to the poll
description.

.. versionadded:: NEXT.VERSION

Keyword Args:
Expand Down Expand Up @@ -7848,6 +7874,10 @@ async def send_poll(
"close_date": close_date,
"question_parse_mode": question_parse_mode,
"question_entities": question_entities,
"members_only": members_only,
"country_codes": country_codes,
"explanation_media": explanation_media,
"media": media,
}

return await self._send_message(
Expand Down
9 changes: 9 additions & 0 deletions src/telegram/_chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
InputMediaPhoto,
InputMediaVideo,
InputPaidMedia,
InputPollMedia,
InputPollOption,
LabeledPrice,
LinkPreviewOptions,
Expand Down Expand Up @@ -2382,6 +2383,10 @@ async def send_poll(
description: str | None = None,
description_parse_mode: str | None = None,
description_entities: Sequence["MessageEntity"] | None = None,
members_only: bool | None = None,
country_codes: Sequence[str] | None = None,
explanation_media: "InputPollMedia | None" = None,
media: "InputPollMedia | None" = None,
*,
reply_to_message_id: int | None = None,
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
Expand Down Expand Up @@ -2440,6 +2445,10 @@ async def send_poll(
description_entities=description_entities,
hide_results_until_closes=hide_results_until_closes,
allow_adding_options=allow_adding_options,
members_only=members_only,
country_codes=country_codes,
explanation_media=explanation_media,
media=media,
)

async def send_copy(
Expand Down
Loading
Loading