diff --git a/telegram/_chatfullinfo.py b/telegram/_chatfullinfo.py index fbdc9d6842f..d4bda7d415a 100644 --- a/telegram/_chatfullinfo.py +++ b/telegram/_chatfullinfo.py @@ -195,6 +195,10 @@ class ChatFullInfo(_ChatBase): chats. location (:class:`telegram.ChatLocation`, optional): For supergroups, the location to which the supergroup is connected. + can_send_paid_media (:obj:`bool`, optional): :obj:`True`, if paid media messages can be + sent or forwarded to the channel chat. The field is available only for channel chats. + + .. versionadded:: NEXT.VERSION Attributes: id (:obj:`int`): Unique identifier for this chat. @@ -345,6 +349,10 @@ class ChatFullInfo(_ChatBase): chats. location (:class:`telegram.ChatLocation`): Optional. For supergroups, the location to which the supergroup is connected. + can_send_paid_media (:obj:`bool`): Optional. :obj:`True`, if paid media messages can be + sent or forwarded to the channel chat. The field is available only for channel chats. + + .. versionadded:: NEXT.VERSION .. _accent colors: https://core.telegram.org/bots/api#accent-colors .. _topics: https://telegram.org/blog/topics-in-groups-collectible-usernames#topics-in-groups @@ -360,6 +368,7 @@ class ChatFullInfo(_ChatBase): "business_intro", "business_location", "business_opening_hours", + "can_send_paid_media", "can_set_sticker_set", "custom_emoji_sticker_set_name", "description", @@ -434,6 +443,7 @@ def __init__( custom_emoji_sticker_set_name: Optional[str] = None, linked_chat_id: Optional[int] = None, location: Optional[ChatLocation] = None, + can_send_paid_media: Optional[bool] = None, *, api_kwargs: Optional[JSONDict] = None, ): @@ -496,6 +506,7 @@ def __init__( self.business_intro: Optional[BusinessIntro] = business_intro self.business_location: Optional[BusinessLocation] = business_location self.business_opening_hours: Optional[BusinessOpeningHours] = business_opening_hours + self.can_send_paid_media: Optional[bool] = can_send_paid_media @classmethod def de_json( diff --git a/tests/test_chatfullinfo.py b/tests/test_chatfullinfo.py index b547e4de913..ee9d697ca71 100644 --- a/tests/test_chatfullinfo.py +++ b/tests/test_chatfullinfo.py @@ -55,13 +55,15 @@ def chat_full_info(bot): bio=TestChatFullInfoBase.bio, linked_chat_id=TestChatFullInfoBase.linked_chat_id, location=TestChatFullInfoBase.location, - has_private_forwards=True, - has_protected_content=True, - has_visible_history=True, - join_to_send_messages=True, - join_by_request=True, - has_restricted_voice_and_video_messages=True, - is_forum=True, + has_private_forwards=TestChatFullInfoBase.has_private_forwards, + has_protected_content=TestChatFullInfoBase.has_protected_content, + has_visible_history=TestChatFullInfoBase.has_visible_history, + join_to_send_messages=TestChatFullInfoBase.join_to_send_messages, + join_by_request=TestChatFullInfoBase.join_by_request, + has_restricted_voice_and_video_messages=( + TestChatFullInfoBase.has_restricted_voice_and_video_messages + ), + is_forum=TestChatFullInfoBase.is_forum, active_usernames=TestChatFullInfoBase.active_usernames, emoji_status_custom_emoji_id=TestChatFullInfoBase.emoji_status_custom_emoji_id, emoji_status_expiration_date=TestChatFullInfoBase.emoji_status_expiration_date, @@ -76,10 +78,11 @@ def chat_full_info(bot): business_intro=TestChatFullInfoBase.business_intro, business_location=TestChatFullInfoBase.business_location, business_opening_hours=TestChatFullInfoBase.business_opening_hours, - birthdate=Birthdate(1, 1), + birthdate=TestChatFullInfoBase.birthdate, personal_chat=TestChatFullInfoBase.personal_chat, - first_name="first_name", - last_name="last_name", + first_name=TestChatFullInfoBase.first_name, + last_name=TestChatFullInfoBase.last_name, + can_send_paid_media=TestChatFullInfoBase.can_send_paid_media, ) chat.set_bot(bot) chat._unfreeze() @@ -136,6 +139,7 @@ class TestChatFullInfoBase: personal_chat = Chat(3, "private", "private") first_name = "first_name" last_name = "last_name" + can_send_paid_media = True class TestChatFullInfoWithoutRequest(TestChatFullInfoBase): @@ -188,6 +192,7 @@ def test_de_json(self, bot): "personal_chat": self.personal_chat.to_dict(), "first_name": self.first_name, "last_name": self.last_name, + "can_send_paid_media": self.can_send_paid_media, } cfi = ChatFullInfo.de_json(json_dict, bot) assert cfi.id == self.id_ @@ -232,6 +237,7 @@ def test_de_json(self, bot): assert cfi.first_name == self.first_name assert cfi.last_name == self.last_name assert cfi.max_reaction_count == self.max_reaction_count + assert cfi.can_send_paid_media == self.can_send_paid_media def test_de_json_localization(self, bot, raw_bot, tz_bot): json_dict = { @@ -305,6 +311,7 @@ def test_to_dict(self, chat_full_info): assert cfi_dict["personal_chat"] == cfi.personal_chat.to_dict() assert cfi_dict["first_name"] == cfi.first_name assert cfi_dict["last_name"] == cfi.last_name + assert cfi_dict["can_send_paid_media"] == cfi.can_send_paid_media assert cfi_dict["max_reaction_count"] == cfi.max_reaction_count