Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions changes/unreleased/5232.eie6iBtaicy9eTpwYTVPAs.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
features = "Bot API 10.0 Polls"
[[pull_requests]]
uid = "5232"
author_uids = ["aelkheir"]
closes_threads = []
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
7 changes: 7 additions & 0 deletions docs/source/telegram.at-tree.rst
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,20 @@ Available Types
telegram.inputmediaanimation
telegram.inputmediaaudio
telegram.inputmediadocument
telegram.inputmedialocation
telegram.inputmediaphoto
telegram.inputmediasticker
telegram.inputmediavenue
telegram.inputmediavideo
telegram.inputpaidmedia
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 @@ -154,6 +159,8 @@ Available Types
telegram.photosize
telegram.poll
telegram.pollanswer
telegram.pollmedia
telegram.polloption
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
==============

.. autoclass:: telegram.InputPollMedia
:members:
:show-inheritance:
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
====================

.. autoclass:: telegram.InputPollOptionMedia
:members:
:show-inheritance:
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 @@ -157,13 +157,18 @@
"InputMediaAnimation",
"InputMediaAudio",
"InputMediaDocument",
"InputMediaLocation",
"InputMediaPhoto",
"InputMediaSticker",
"InputMediaVenue",
"InputMediaVideo",
"InputMessageContent",
"InputPaidMedia",
"InputPaidMediaPhoto",
"InputPaidMediaVideo",
"InputPollMedia",
"InputPollOption",
"InputPollOptionMedia",
"InputProfilePhoto",
"InputProfilePhotoAnimated",
"InputProfilePhotoStatic",
Expand Down Expand Up @@ -231,6 +236,7 @@
"PhotoSize",
"Poll",
"PollAnswer",
"PollMedia",
"PollOption",
"PollOptionAdded",
"PollOptionDeleted",
Expand Down Expand Up @@ -435,11 +441,16 @@
InputMediaAnimation,
InputMediaAudio,
InputMediaDocument,
InputMediaLocation,
InputMediaPhoto,
InputMediaSticker,
InputMediaVenue,
InputMediaVideo,
InputPaidMedia,
InputPaidMediaPhoto,
InputPaidMediaVideo,
InputPollMedia,
InputPollOptionMedia,
)
from ._files.inputprofilephoto import (
InputProfilePhoto,
Expand Down Expand Up @@ -579,6 +590,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 @@ -128,6 +128,7 @@
InputMediaDocument,
InputMediaPhoto,
InputMediaVideo,
InputPollMedia,
InputProfilePhoto,
InputSticker,
InputStoryContent,
Expand Down Expand Up @@ -7627,6 +7628,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 @@ -7769,6 +7774,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 @@ -7837,6 +7863,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 @@ -61,6 +61,7 @@
InputMediaPhoto,
InputMediaVideo,
InputPaidMedia,
InputPollMedia,
InputPollOption,
LabeledPrice,
LinkPreviewOptions,
Expand Down Expand Up @@ -2305,6 +2306,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 @@ -2363,6 +2368,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