diff --git a/pyrogram/types/messages_and_media/message.py b/pyrogram/types/messages_and_media/message.py index 2fa21c4e..9e1c7e1a 100644 --- a/pyrogram/types/messages_and_media/message.py +++ b/pyrogram/types/messages_and_media/message.py @@ -128,6 +128,9 @@ class Message(Object, Update): Signature of the post author for messages in channels, or the custom title of an anonymous group administrator. + has_protected_content (``str``, *optional*): + True, if the message can't be forwarded. + text (``str``, *optional*): For text messages, the actual UTF-8 text of the message, 0-4096 characters. If the message contains entities (bold, italic, ...) you can access *text.markdown* or @@ -312,6 +315,7 @@ class Message(Object, Update): edit_date: int = None, media_group_id: str = None, author_signature: str = None, + has_protected_content: bool = None, text: Str = None, entities: List["types.MessageEntity"] = None, caption_entities: List["types.MessageEntity"] = None, @@ -382,6 +386,7 @@ class Message(Object, Update): self.edit_date = edit_date self.media_group_id = media_group_id self.author_signature = author_signature + self.has_protected_content = has_protected_content self.text = text self.entities = entities self.caption_entities = caption_entities @@ -743,6 +748,7 @@ class Message(Object, Update): else None ), author_signature=message.post_author, + has_protected_content=message.noforwards, forward_from=forward_from, forward_sender_name=forward_sender_name, forward_from_chat=forward_from_chat, diff --git a/pyrogram/types/user_and_chats/chat.py b/pyrogram/types/user_and_chats/chat.py index 5ba68aac..3324cc98 100644 --- a/pyrogram/types/user_and_chats/chat.py +++ b/pyrogram/types/user_and_chats/chat.py @@ -83,6 +83,9 @@ class Chat(Object): It is accurate only in case the owner has set the chat photo, otherwise the dc_id will be the one assigned to the administrator who set the current chat photo. + has_protected_content (``bool``, *optional*): + True, if messages from the chat can't be forwarded to other chats. + invite_link (``str``, *optional*): Chat invite link, for groups, supergroups and channels. Returned only in :meth:`~pyrogram.Client.get_chat`. @@ -139,6 +142,7 @@ class Chat(Object): bio: str = None, description: str = None, dc_id: int = None, + has_protected_content: bool = None, invite_link: str = None, pinned_message=None, sticker_set_name: str = None, @@ -167,6 +171,7 @@ class Chat(Object): self.bio = bio self.description = description self.dc_id = dc_id + self.has_protected_content = has_protected_content self.invite_link = invite_link self.pinned_message = pinned_message self.sticker_set_name = sticker_set_name @@ -211,6 +216,7 @@ class Chat(Object): permissions=types.ChatPermissions._parse(getattr(chat, "default_banned_rights", None)), members_count=getattr(chat, "participants_count", None), dc_id=getattr(getattr(chat, "photo", None), "dc_id", None), + has_protected_content=chat.noforwards, client=client ) @@ -234,6 +240,7 @@ class Chat(Object): permissions=types.ChatPermissions._parse(getattr(channel, "default_banned_rights", None)), members_count=getattr(channel, "participants_count", None), dc_id=getattr(getattr(channel, "photo", None), "dc_id", None), + has_protected_content=channel.noforwards, client=client )