Bump Version to v22.1 by Bibo-Joshi · Pull Request #4791 · python-telegram-bot/python-telegram-bot · GitHub
Skip to content
Merged
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/22.1_2025-05-15/4791.QycEvQbiaiJKraKDhAfFWM.toml
40 changes: 20 additions & 20 deletions telegram/_bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -9386,7 +9386,7 @@ async def gift_premium_subscription(
"""
Gifts a Telegram Premium subscription to the given user.

.. versionadded:: NEXT.VERSION
.. versionadded:: 22.1

Args:
user_id (:obj:`int`): Unique identifier of the target user who will receive a Telegram
Expand Down Expand Up @@ -9506,7 +9506,7 @@ async def get_business_account_gifts(
Returns the gifts received and owned by a managed business account. Requires the
:attr:`~telegram.BusinessBotRights.can_view_gifts_and_stars` business bot right.

.. versionadded:: NEXT.VERSION
.. versionadded:: 22.1

Args:
business_connection_id (:obj:`str`): Unique identifier of the business connection.
Expand Down Expand Up @@ -9572,7 +9572,7 @@ async def get_business_account_star_balance(
Returns the amount of Telegram Stars owned by a managed business account. Requires the
:attr:`~telegram.BusinessBotRights.can_view_gifts_and_stars` business bot right.

.. versionadded:: NEXT.VERSION
.. versionadded:: 22.1

Args:
business_connection_id (:obj:`str`): Unique identifier of the business connection.
Expand Down Expand Up @@ -9613,7 +9613,7 @@ async def read_business_message(
Marks incoming message as read on behalf of a business account.
Requires the :attr:`~telegram.BusinessBotRights.can_read_messages` business bot right.

.. versionadded:: NEXT.VERSION
.. versionadded:: 22.1

Args:
business_connection_id (:obj:`str`): Unique identifier of the business connection on
Expand Down Expand Up @@ -9663,7 +9663,7 @@ async def delete_business_messages(
:attr:`~telegram.BusinessBotRights.can_delete_all_messages` business bot right to delete
any message.

.. versionadded:: NEXT.VERSION
.. versionadded:: 22.1

Args:
business_connection_id (:obj:`int` | :obj:`str`): Unique identifier of the business
Expand Down Expand Up @@ -9716,7 +9716,7 @@ async def post_story(
Posts a story on behalf of a managed business account. Requires the
:attr:`~telegram.BusinessBotRights.can_manage_stories` business bot right.

.. versionadded:: NEXT.VERSION
.. versionadded:: 22.1

Args:
business_connection_id (:obj:`str`): Unique identifier of the business connection.
Expand Down Expand Up @@ -9805,7 +9805,7 @@ async def edit_story(
Edits a story previously posted by the bot on behalf of a managed business account.
Requires the :attr:`~telegram.BusinessBotRights.can_manage_stories` business bot right.

.. versionadded:: NEXT.VERSION
.. versionadded:: 22.1

Args:
business_connection_id (:obj:`str`): Unique identifier of the business connection.
Expand Down Expand Up @@ -9878,7 +9878,7 @@ async def delete_story(
Deletes a story previously posted by the bot on behalf of a managed business account.
Requires the :attr:`~telegram.BusinessBotRights.can_manage_stories` business bot right.

.. versionadded:: NEXT.VERSION
.. versionadded:: 22.1

Args:
business_connection_id (:obj:`str`): Unique identifier of the business connection.
Expand Down Expand Up @@ -9920,7 +9920,7 @@ async def set_business_account_name(
Changes the first and last name of a managed business account. Requires the
:attr:`~telegram.BusinessBotRights.can_edit_name` business bot right.

.. versionadded:: NEXT.VERSION
.. versionadded:: 22.1

Args:
business_connection_id (:obj:`int` | :obj:`str`): Unique identifier of the business
Expand Down Expand Up @@ -9967,7 +9967,7 @@ async def set_business_account_username(
Changes the username of a managed business account. Requires the
:attr:`~telegram.BusinessBotRights.can_edit_username` business bot right.

.. versionadded:: NEXT.VERSION
.. versionadded:: 22.1

Args:
business_connection_id (:obj:`str`): Unique identifier of the business connection.
Expand Down Expand Up @@ -10009,7 +10009,7 @@ async def set_business_account_bio(
Changes the bio of a managed business account. Requires the
:attr:`~telegram.BusinessBotRights.can_edit_bio` business bot right.

.. versionadded:: NEXT.VERSION
.. versionadded:: 22.1

Args:
business_connection_id (:obj:`str`): Unique identifier of the business connection.
Expand Down Expand Up @@ -10053,7 +10053,7 @@ async def set_business_account_gift_settings(
Requires the :attr:`~telegram.BusinessBotRights.can_change_gift_settings` business
bot right.

.. versionadded:: NEXT.VERSION
.. versionadded:: 22.1

Args:
business_connection_id (:obj:`str`): Unique identifier of the business
Expand Down Expand Up @@ -10101,7 +10101,7 @@ async def set_business_account_profile_photo(
Requires the :attr:`~telegram.BusinessBotRights.can_edit_profile_photo` business
bot right.

.. versionadded:: NEXT.VERSION
.. versionadded:: 22.1

Args:
business_connection_id (:obj:`str`): Unique identifier of the business connection.
Expand Down Expand Up @@ -10148,7 +10148,7 @@ async def remove_business_account_profile_photo(
Requires the :attr:`~telegram.BusinessBotRights.can_edit_profile_photo` business
bot right.

.. versionadded:: NEXT.VERSION
.. versionadded:: 22.1

Args:
business_connection_id (:obj:`str`): Unique identifier of the business connection.
Expand Down Expand Up @@ -10192,7 +10192,7 @@ async def convert_gift_to_stars(
Converts a given regular gift to Telegram Stars. Requires the
:attr:`~telegram.BusinessBotRights.can_convert_gifts_to_stars` business bot right.

.. versionadded:: NEXT.VERSION
.. versionadded:: 22.1

Args:
business_connection_id (:obj:`str`): Unique identifier of the business
Expand Down Expand Up @@ -10239,7 +10239,7 @@ async def upgrade_gift(
Additionally requires the :attr:`~telegram.BusinessBotRights.can_transfer_stars` business
bot right if the upgrade is paid.

.. versionadded:: NEXT.VERSION
.. versionadded:: 22.1

Args:
business_connection_id (:obj:`str`): Unique identifier of the business
Expand Down Expand Up @@ -10296,7 +10296,7 @@ async def transfer_gift(
Requires :attr:`~telegram.BusinessBotRights.can_transfer_stars` business bot right if the
transfer is paid.

.. versionadded:: NEXT.VERSION
.. versionadded:: 22.1

Args:
business_connection_id (:obj:`str`): Unique identifier of the business
Expand Down Expand Up @@ -10349,7 +10349,7 @@ async def transfer_business_account_stars(
Transfers Telegram Stars from the business account balance to the bot's balance. Requires
the :attr:`~telegram.BusinessBotRights.can_transfer_stars` business bot right.

.. versionadded:: NEXT.VERSION
.. versionadded:: 22.1

Args:
business_connection_id (:obj:`str`): Unique identifier of the business
Expand Down Expand Up @@ -10840,8 +10840,8 @@ async def send_gift(
The gift can't be converted to Telegram Stars by the receiver.

.. versionadded:: 21.8
.. versionchanged:: NEXT.VERSION
Bot API 8.3 made :paramref:`user_id` optional. In version NEXT.VERSION, the methods
.. versionchanged:: 22.1
Bot API 8.3 made :paramref:`user_id` optional. In version 22.1, the methods
signature was changed accordingly.

Args:
Expand Down
18 changes: 9 additions & 9 deletions telegram/_business.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class BusinessBotRights(TelegramObject):
Objects of this class are comparable in terms of equality.
Two objects of this class are considered equal, if all their attributes are equal.

.. versionadded:: NEXT.VERSION
.. versionadded:: 22.1

Args:
can_reply (:obj:`bool`, optional): True, if the bot can send and edit messages in the
Expand Down Expand Up @@ -194,7 +194,7 @@ class BusinessConnection(TelegramObject):
:attr:`rights`, and :attr:`is_enabled` are equal.

.. versionadded:: 21.1
.. versionchanged:: NEXT.VERSION
.. versionchanged:: 22.1
Equality comparison now considers :attr:`rights` instead of :attr:`can_reply`.

Args:
Expand All @@ -206,12 +206,12 @@ class BusinessConnection(TelegramObject):
can_reply (:obj:`bool`, optional): True, if the bot can act on behalf of the business
account in chats that were active in the last 24 hours.

.. deprecated:: NEXT.VERSION
.. deprecated:: 22.1
Bot API 9.0 deprecated this argument in favor of :paramref:`rights`.
is_enabled (:obj:`bool`): True, if the connection is active.
rights (:class:`BusinessBotRights`, optional): Rights of the business bot.

.. versionadded:: NEXT.VERSION
.. versionadded:: 22.1

Attributes:
id (:obj:`str`): Unique identifier of the business connection.
Expand All @@ -222,7 +222,7 @@ class BusinessConnection(TelegramObject):
is_enabled (:obj:`bool`): True, if the connection is active.
rights (:class:`BusinessBotRights`): Optional. Rights of the business bot.

.. versionadded:: NEXT.VERSION
.. versionadded:: 22.1
"""

__slots__ = (
Expand All @@ -243,7 +243,7 @@ def __init__(
date: dtm.datetime,
can_reply: Optional[bool] = None,
# temporarily optional to account for changed signature
# tags: deprecated NEXT.VERSION; bot api 9.0
# tags: deprecated 22.1; bot api 9.0
is_enabled: Optional[bool] = None,
rights: Optional[BusinessBotRights] = None,
*,
Expand All @@ -255,7 +255,7 @@ def __init__(
if can_reply is not None:
warn(
PTBDeprecationWarning(
version="NEXT.VERSION",
version="22.1",
message=build_deprecation_warning_message(
deprecated_name="can_reply",
new_name="rights",
Expand Down Expand Up @@ -291,14 +291,14 @@ def can_reply(self) -> Optional[bool]:
""":obj:`bool`: Optional. True, if the bot can act on behalf of the business account in
chats that were active in the last 24 hours.

.. deprecated:: NEXT.VERSION
.. deprecated:: 22.1
Bot API 9.0 deprecated this argument in favor of :attr:`rights`
"""
warn_about_deprecated_attr_in_property(
deprecated_attr_name="can_reply",
new_attr_name="rights",
bot_api_version="9.0",
ptb_version="NEXT.VERSION",
ptb_version="22.1",
)
return self._can_reply

Expand Down
4 changes: 2 additions & 2 deletions telegram/_chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -3524,7 +3524,7 @@ async def transfer_gift(

For the documentation of the arguments, please see :meth:`telegram.Bot.transfer_gift`.

.. versionadded:: NEXT.VERSION
.. versionadded:: 22.1

Returns:
:obj:`bool`: On success, :obj:`True` is returned.
Expand Down Expand Up @@ -3621,7 +3621,7 @@ async def read_business_message(
For the documentation of the arguments, please see
:meth:`telegram.Bot.read_business_message`.

.. versionadded:: NEXT.VERSION
.. versionadded:: 22.1

Returns:
:obj:`bool`: On success, :obj:`True` is returned.
Expand Down
14 changes: 7 additions & 7 deletions telegram/_chatfullinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class ChatFullInfo(_ChatBase):
accepted_gift_types (:class:`telegram.AcceptedGiftTypes`): Information about types of
gifts that are accepted by the chat or by the corresponding user for private chats.

.. versionadded:: NEXT.VERSION
.. versionadded:: 22.1
title (:obj:`str`, optional): Title, for supergroups, channels and group chats.
username (:obj:`str`, optional): Username, for private chats, supergroups and channels if
available.
Expand Down Expand Up @@ -215,7 +215,7 @@ class ChatFullInfo(_ChatBase):

.. versionadded:: 21.11

.. deprecated:: NEXT.VERSION
.. deprecated:: 22.1
Bot API 9.0 introduced :paramref:`accepted_gift_types`, replacing this argument.
Hence, this argument will be removed in future versions.

Expand All @@ -236,7 +236,7 @@ class ChatFullInfo(_ChatBase):
accepted_gift_types (:class:`telegram.AcceptedGiftTypes`): Information about types of
gifts that are accepted by the chat or by the corresponding user for private chats.

.. versionadded:: NEXT.VERSION
.. versionadded:: 22.1
title (:obj:`str`, optional): Title, for supergroups, channels and group chats.
username (:obj:`str`, optional): Username, for private chats, supergroups and channels if
available.
Expand Down Expand Up @@ -469,7 +469,7 @@ def __init__(
linked_chat_id: Optional[int] = None,
location: Optional[ChatLocation] = None,
can_send_paid_media: Optional[bool] = None,
# tags: deprecated NEXT.VERSION; bot api 9.0
# tags: deprecated 22.1; bot api 9.0
can_send_gift: Optional[bool] = None,
# temporarily optional to account for changed signature
accepted_gift_types: Optional[AcceptedGiftTypes] = None,
Expand All @@ -492,7 +492,7 @@ def __init__(
if can_send_gift is not None:
warn(
PTBDeprecationWarning(
"NEXT.VERSION",
"22.1",
build_deprecation_warning_message(
deprecated_name="can_send_gift",
new_name="accepted_gift_types",
Expand Down Expand Up @@ -562,7 +562,7 @@ def can_send_gift(self) -> Optional[bool]:
"""
:obj:`bool`: Optional. :obj:`True`, if gifts can be sent to the chat.

.. deprecated:: NEXT.VERSION
.. deprecated:: 22.1
As Bot API 9.0 replaces this attribute with :attr:`accepted_gift_types`, this attribute
will be removed in future versions.

Expand All @@ -571,7 +571,7 @@ def can_send_gift(self) -> Optional[bool]:
deprecated_attr_name="can_send_gift",
new_attr_name="accepted_gift_types",
bot_api_version="9.0",
ptb_version="NEXT.VERSION",
ptb_version="22.1",
stacklevel=2,
)
return self._can_send_gift
Expand Down
6 changes: 3 additions & 3 deletions telegram/_files/_inputstorycontent.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class InputStoryContent(TelegramObject):
* :class:`telegram.InputStoryContentPhoto`
* :class:`telegram.InputStoryContentVideo`

.. versionadded:: NEXT.VERSION
.. versionadded:: 22.1

Args:
type (:obj:`str`): Type of the content.
Expand Down Expand Up @@ -72,7 +72,7 @@ def _parse_file_input(file_input: FileInput) -> Union[str, InputFile]:
class InputStoryContentPhoto(InputStoryContent):
"""Describes a photo to post as a story.

.. versionadded:: NEXT.VERSION
.. versionadded:: 22.1

Args:
photo (:term:`file object` | :obj:`bytes` | :class:`pathlib.Path` | :obj:`str`, \
Expand Down Expand Up @@ -109,7 +109,7 @@ class InputStoryContentVideo(InputStoryContent):
"""
Describes a video to post as a story.

.. versionadded:: NEXT.VERSION
.. versionadded:: 22.1

Args:
video (:term:`file object` | :obj:`bytes` | :class:`pathlib.Path` | :obj:`str`, \
Expand Down
6 changes: 3 additions & 3 deletions telegram/_files/inputprofilephoto.py
Loading