From f6625192d02b882068fa0e70eaef124479b37ef2 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Mon, 3 Jan 2022 11:12:24 +0100 Subject: [PATCH] Add parameter protect_content to send_* methods --- pyrogram/methods/bots/send_game.py | 5 +++++ pyrogram/methods/messages/copy_message.py | 5 +++++ pyrogram/methods/messages/forward_messages.py | 9 +++++++-- pyrogram/methods/messages/send_animation.py | 5 +++++ pyrogram/methods/messages/send_audio.py | 5 +++++ pyrogram/methods/messages/send_contact.py | 5 +++++ pyrogram/methods/messages/send_dice.py | 5 +++++ pyrogram/methods/messages/send_document.py | 5 +++++ pyrogram/methods/messages/send_location.py | 5 +++++ pyrogram/methods/messages/send_media_group.py | 7 ++++++- pyrogram/methods/messages/send_message.py | 7 ++++++- pyrogram/methods/messages/send_photo.py | 5 +++++ pyrogram/methods/messages/send_poll.py | 5 +++++ pyrogram/methods/messages/send_sticker.py | 5 +++++ pyrogram/methods/messages/send_venue.py | 5 +++++ pyrogram/methods/messages/send_video.py | 5 +++++ pyrogram/methods/messages/send_video_note.py | 5 +++++ pyrogram/methods/messages/send_voice.py | 5 +++++ pyrogram/types/messages_and_media/message.py | 6 ++++++ 19 files changed, 100 insertions(+), 4 deletions(-) diff --git a/pyrogram/methods/bots/send_game.py b/pyrogram/methods/bots/send_game.py index 8f6d10ab..f6e6a340 100644 --- a/pyrogram/methods/bots/send_game.py +++ b/pyrogram/methods/bots/send_game.py @@ -30,6 +30,7 @@ class SendGame(Scaffold): game_short_name: str, disable_notification: bool = None, reply_to_message_id: int = None, + protect_content: bool = None, reply_markup: Union[ "types.InlineKeyboardMarkup", "types.ReplyKeyboardMarkup", @@ -55,6 +56,9 @@ class SendGame(Scaffold): reply_to_message_id (``int``, *optional*): If the message is a reply, ID of the original message. + protect_content (``bool``, *optional*): + Protects the contents of the sent message from forwarding and saving. + reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup`, *optional*): An object for an inline keyboard. If empty, one ‘Play game_title’ button will be shown automatically. If not empty, the first button must launch the game. @@ -80,6 +84,7 @@ class SendGame(Scaffold): silent=disable_notification or None, reply_to_msg_id=reply_to_message_id, random_id=self.rnd_id(), + noforwards=protect_content, reply_markup=await reply_markup.write(self) if reply_markup else None ) ) diff --git a/pyrogram/methods/messages/copy_message.py b/pyrogram/methods/messages/copy_message.py index 3250ac89..5e886949 100644 --- a/pyrogram/methods/messages/copy_message.py +++ b/pyrogram/methods/messages/copy_message.py @@ -37,6 +37,7 @@ class CopyMessage(Scaffold): disable_notification: bool = None, reply_to_message_id: int = None, schedule_date: int = None, + protect_content: bool = None, reply_markup: Union[ "types.InlineKeyboardMarkup", "types.ReplyKeyboardMarkup", @@ -88,6 +89,9 @@ class CopyMessage(Scaffold): schedule_date (``int``, *optional*): Date when the message will be automatically sent. Unix time. + protect_content (``bool``, *optional*): + Protects the contents of the sent message from forwarding and saving. + reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.ForceReply`, *optional*): Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. @@ -112,5 +116,6 @@ class CopyMessage(Scaffold): disable_notification=disable_notification, reply_to_message_id=reply_to_message_id, schedule_date=schedule_date, + protect_content=protect_content, reply_markup=reply_markup ) diff --git a/pyrogram/methods/messages/forward_messages.py b/pyrogram/methods/messages/forward_messages.py index b67e50ec..9218bf6e 100644 --- a/pyrogram/methods/messages/forward_messages.py +++ b/pyrogram/methods/messages/forward_messages.py @@ -30,7 +30,8 @@ class ForwardMessages(Scaffold): from_chat_id: Union[int, str], message_ids: Union[int, Iterable[int]], disable_notification: bool = None, - schedule_date: int = None + schedule_date: int = None, + protect_content: bool = None ) -> Union["types.Message", List["types.Message"]]: """Forward messages of any kind. @@ -56,6 +57,9 @@ class ForwardMessages(Scaffold): schedule_date (``int``, *optional*): Date when the message will be automatically sent. Unix time. + protect_content (``bool``, *optional*): + Protects the contents of the sent message from forwarding and saving. + Returns: :obj:`~pyrogram.types.Message` | List of :obj:`~pyrogram.types.Message`: In case *message_ids* was an integer, the single forwarded message is returned, otherwise, in case *message_ids* was an iterable, @@ -82,7 +86,8 @@ class ForwardMessages(Scaffold): id=message_ids, silent=disable_notification or None, random_id=[self.rnd_id() for _ in message_ids], - schedule_date=schedule_date + schedule_date=schedule_date, + noforwards=protect_content ) ) diff --git a/pyrogram/methods/messages/send_animation.py b/pyrogram/methods/messages/send_animation.py index d365ae56..d1ee9585 100644 --- a/pyrogram/methods/messages/send_animation.py +++ b/pyrogram/methods/messages/send_animation.py @@ -46,6 +46,7 @@ class SendAnimation(Scaffold): disable_notification: bool = None, reply_to_message_id: int = None, schedule_date: int = None, + protect_content: bool = None, reply_markup: Union[ "types.InlineKeyboardMarkup", "types.ReplyKeyboardMarkup", @@ -116,6 +117,9 @@ class SendAnimation(Scaffold): schedule_date (``int``, *optional*): Date when the message will be automatically sent. Unix time. + protect_content (``bool``, *optional*): + Protects the contents of the sent message from forwarding and saving. + reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.ForceReply`, *optional*): Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. @@ -222,6 +226,7 @@ class SendAnimation(Scaffold): reply_to_msg_id=reply_to_message_id, random_id=self.rnd_id(), schedule_date=schedule_date, + noforwards=protect_content, reply_markup=await reply_markup.write(self) if reply_markup else None, **await utils.parse_text_entities(self, caption, parse_mode, caption_entities) ) diff --git a/pyrogram/methods/messages/send_audio.py b/pyrogram/methods/messages/send_audio.py index 4fa683a9..eeb45f65 100644 --- a/pyrogram/methods/messages/send_audio.py +++ b/pyrogram/methods/messages/send_audio.py @@ -45,6 +45,7 @@ class SendAudio(Scaffold): disable_notification: bool = None, reply_to_message_id: int = None, schedule_date: int = None, + protect_content: bool = None, reply_markup: Union[ "types.InlineKeyboardMarkup", "types.ReplyKeyboardMarkup", @@ -113,6 +114,9 @@ class SendAudio(Scaffold): schedule_date (``int``, *optional*): Date when the message will be automatically sent. Unix time. + protect_content (``bool``, *optional*): + Protects the contents of the sent message from forwarding and saving. + reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.ForceReply`, *optional*): Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. @@ -217,6 +221,7 @@ class SendAudio(Scaffold): reply_to_msg_id=reply_to_message_id, random_id=self.rnd_id(), schedule_date=schedule_date, + noforwards=protect_content, reply_markup=await reply_markup.write(self) if reply_markup else None, **await utils.parse_text_entities(self, caption, parse_mode, caption_entities) ) diff --git a/pyrogram/methods/messages/send_contact.py b/pyrogram/methods/messages/send_contact.py index 6317a829..f744fab0 100644 --- a/pyrogram/methods/messages/send_contact.py +++ b/pyrogram/methods/messages/send_contact.py @@ -34,6 +34,7 @@ class SendContact(Scaffold): disable_notification: bool = None, reply_to_message_id: int = None, schedule_date: int = None, + protect_content: bool = None, reply_markup: Union[ "types.InlineKeyboardMarkup", "types.ReplyKeyboardMarkup", @@ -71,6 +72,9 @@ class SendContact(Scaffold): schedule_date (``int``, *optional*): Date when the message will be automatically sent. Unix time. + protect_content (``bool``, *optional*): + Protects the contents of the sent message from forwarding and saving. + reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.ForceReply`, *optional*): Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. @@ -97,6 +101,7 @@ class SendContact(Scaffold): reply_to_msg_id=reply_to_message_id, random_id=self.rnd_id(), schedule_date=schedule_date, + noforwards=protect_content, reply_markup=await reply_markup.write(self) if reply_markup else None ) ) diff --git a/pyrogram/methods/messages/send_dice.py b/pyrogram/methods/messages/send_dice.py index 4b7422b3..6c7f70cd 100644 --- a/pyrogram/methods/messages/send_dice.py +++ b/pyrogram/methods/messages/send_dice.py @@ -31,6 +31,7 @@ class SendDice(Scaffold): disable_notification: bool = None, reply_to_message_id: int = None, schedule_date: int = None, + protect_content: bool = None, reply_markup: Union[ "types.InlineKeyboardMarkup", "types.ReplyKeyboardMarkup", @@ -63,6 +64,9 @@ class SendDice(Scaffold): schedule_date (``int``, *optional*): Date when the message will be automatically sent. Unix time. + protect_content (``bool``, *optional*): + Protects the contents of the sent message from forwarding and saving. + reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.ForceReply`, *optional*): Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. @@ -91,6 +95,7 @@ class SendDice(Scaffold): reply_to_msg_id=reply_to_message_id, random_id=self.rnd_id(), schedule_date=schedule_date, + noforwards=protect_content, reply_markup=await reply_markup.write(self) if reply_markup else None, message="" ) diff --git a/pyrogram/methods/messages/send_document.py b/pyrogram/methods/messages/send_document.py index a7e34285..3661b255 100644 --- a/pyrogram/methods/messages/send_document.py +++ b/pyrogram/methods/messages/send_document.py @@ -43,6 +43,7 @@ class SendDocument(Scaffold): disable_notification: bool = None, reply_to_message_id: int = None, schedule_date: int = None, + protect_content: bool = None, reply_markup: Union[ "types.InlineKeyboardMarkup", "types.ReplyKeyboardMarkup", @@ -105,6 +106,9 @@ class SendDocument(Scaffold): schedule_date (``int``, *optional*): Date when the message will be automatically sent. Unix time. + protect_content (``bool``, *optional*): + Protects the contents of the sent message from forwarding and saving. + reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.ForceReply`, *optional*): Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. @@ -194,6 +198,7 @@ class SendDocument(Scaffold): reply_to_msg_id=reply_to_message_id, random_id=self.rnd_id(), schedule_date=schedule_date, + noforwards=protect_content, reply_markup=await reply_markup.write(self) if reply_markup else None, **await utils.parse_text_entities(self, caption, parse_mode, caption_entities) ) diff --git a/pyrogram/methods/messages/send_location.py b/pyrogram/methods/messages/send_location.py index e70d9661..1bc3b032 100644 --- a/pyrogram/methods/messages/send_location.py +++ b/pyrogram/methods/messages/send_location.py @@ -32,6 +32,7 @@ class SendLocation(Scaffold): disable_notification: bool = None, reply_to_message_id: int = None, schedule_date: int = None, + protect_content: bool = None, reply_markup: Union[ "types.InlineKeyboardMarkup", "types.ReplyKeyboardMarkup", @@ -63,6 +64,9 @@ class SendLocation(Scaffold): schedule_date (``int``, *optional*): Date when the message will be automatically sent. Unix time. + protect_content (``bool``, *optional*): + Protects the contents of the sent message from forwarding and saving. + reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.ForceReply`, *optional*): Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. @@ -89,6 +93,7 @@ class SendLocation(Scaffold): reply_to_msg_id=reply_to_message_id, random_id=self.rnd_id(), schedule_date=schedule_date, + noforwards=protect_content, reply_markup=await reply_markup.write(self) if reply_markup else None ) ) diff --git a/pyrogram/methods/messages/send_media_group.py b/pyrogram/methods/messages/send_media_group.py index 4073ddec..dc8ca7f0 100644 --- a/pyrogram/methods/messages/send_media_group.py +++ b/pyrogram/methods/messages/send_media_group.py @@ -44,6 +44,7 @@ class SendMediaGroup(Scaffold): disable_notification: bool = None, reply_to_message_id: int = None, schedule_date: int = None, + protect_content: bool = None, ) -> List["types.Message"]: """Send a group of photos or videos as an album. @@ -66,6 +67,9 @@ class SendMediaGroup(Scaffold): schedule_date (``int``, *optional*): Date when the message will be automatically sent. Unix time. + protect_content (``bool``, *optional*): + Protects the contents of the sent message from forwarding and saving. + Returns: List of :obj:`~pyrogram.types.Message`: On success, a list of the sent messages is returned. @@ -377,7 +381,8 @@ class SendMediaGroup(Scaffold): multi_media=multi_media, silent=disable_notification or None, reply_to_msg_id=reply_to_message_id, - schedule_date=schedule_date + schedule_date=schedule_date, + noforwards=protect_content ), sleep_threshold=60 ) diff --git a/pyrogram/methods/messages/send_message.py b/pyrogram/methods/messages/send_message.py index 552a233b..54fcfe48 100644 --- a/pyrogram/methods/messages/send_message.py +++ b/pyrogram/methods/messages/send_message.py @@ -34,6 +34,7 @@ class SendMessage(Scaffold): disable_notification: bool = None, reply_to_message_id: int = None, schedule_date: int = None, + protect_content: bool = None, reply_markup: Union[ "types.InlineKeyboardMarkup", "types.ReplyKeyboardMarkup", @@ -75,6 +76,9 @@ class SendMessage(Scaffold): schedule_date (``int``, *optional*): Date when the message will be automatically sent. Unix time. + protect_content (``bool``, *optional*): + Protects the contents of the sent message from forwarding and saving. + reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.ForceReply`, *optional*): Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. @@ -132,7 +136,8 @@ class SendMessage(Scaffold): schedule_date=schedule_date, reply_markup=await reply_markup.write(self) if reply_markup else None, message=message, - entities=entities + entities=entities, + noforwards=protect_content ) ) diff --git a/pyrogram/methods/messages/send_photo.py b/pyrogram/methods/messages/send_photo.py index fcc3c04c..ff695589 100644 --- a/pyrogram/methods/messages/send_photo.py +++ b/pyrogram/methods/messages/send_photo.py @@ -41,6 +41,7 @@ class SendPhoto(Scaffold): disable_notification: bool = None, reply_to_message_id: int = None, schedule_date: int = None, + protect_content: bool = None, reply_markup: Union[ "types.InlineKeyboardMarkup", "types.ReplyKeyboardMarkup", @@ -93,6 +94,9 @@ class SendPhoto(Scaffold): schedule_date (``int``, *optional*): Date when the message will be automatically sent. Unix time. + protect_content (``bool``, *optional*): + Protects the contents of the sent message from forwarding and saving. + reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.ForceReply`, *optional*): Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. @@ -172,6 +176,7 @@ class SendPhoto(Scaffold): reply_to_msg_id=reply_to_message_id, random_id=self.rnd_id(), schedule_date=schedule_date, + noforwards=protect_content, reply_markup=await reply_markup.write(self) if reply_markup else None, **await utils.parse_text_entities(self, caption, parse_mode, caption_entities) ) diff --git a/pyrogram/methods/messages/send_poll.py b/pyrogram/methods/messages/send_poll.py index dc0ccf17..6fbb0aab 100644 --- a/pyrogram/methods/messages/send_poll.py +++ b/pyrogram/methods/messages/send_poll.py @@ -36,6 +36,7 @@ class SendPoll(Scaffold): disable_notification: bool = None, reply_to_message_id: int = None, schedule_date: int = None, + protect_content: bool = None, reply_markup: Union[ "types.InlineKeyboardMarkup", "types.ReplyKeyboardMarkup", @@ -83,6 +84,9 @@ class SendPoll(Scaffold): schedule_date (``int``, *optional*): Date when the message will be automatically sent. Unix time. + protect_content (``bool``, *optional*): + Protects the contents of the sent message from forwarding and saving. + reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.ForceReply`, *optional*): Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. @@ -117,6 +121,7 @@ class SendPoll(Scaffold): reply_to_msg_id=reply_to_message_id, random_id=self.rnd_id(), schedule_date=schedule_date, + noforwards=protect_content, reply_markup=await reply_markup.write(self) if reply_markup else None ) ) diff --git a/pyrogram/methods/messages/send_sticker.py b/pyrogram/methods/messages/send_sticker.py index c7ae122a..144bba37 100644 --- a/pyrogram/methods/messages/send_sticker.py +++ b/pyrogram/methods/messages/send_sticker.py @@ -37,6 +37,7 @@ class SendSticker(Scaffold): disable_notification: bool = None, reply_to_message_id: int = None, schedule_date: int = None, + protect_content: bool = None, reply_markup: Union[ "types.InlineKeyboardMarkup", "types.ReplyKeyboardMarkup", @@ -71,6 +72,9 @@ class SendSticker(Scaffold): schedule_date (``int``, *optional*): Date when the message will be automatically sent. Unix time. + protect_content (``bool``, *optional*): + Protects the contents of the sent message from forwarding and saving. + reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.ForceReply`, *optional*): Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. @@ -150,6 +154,7 @@ class SendSticker(Scaffold): reply_to_msg_id=reply_to_message_id, random_id=self.rnd_id(), schedule_date=schedule_date, + noforwards=protect_content, reply_markup=await reply_markup.write(self) if reply_markup else None, message="" ) diff --git a/pyrogram/methods/messages/send_venue.py b/pyrogram/methods/messages/send_venue.py index 7dbae7a0..557aa673 100644 --- a/pyrogram/methods/messages/send_venue.py +++ b/pyrogram/methods/messages/send_venue.py @@ -36,6 +36,7 @@ class SendVenue(Scaffold): disable_notification: bool = None, reply_to_message_id: int = None, schedule_date: int = None, + protect_content: bool = None, reply_markup: Union[ "types.InlineKeyboardMarkup", "types.ReplyKeyboardMarkup", @@ -80,6 +81,9 @@ class SendVenue(Scaffold): schedule_date (``int``, *optional*): Date when the message will be automatically sent. Unix time. + protect_content (``bool``, *optional*): + Protects the contents of the sent message from forwarding and saving. + reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.ForceReply`, *optional*): Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. @@ -113,6 +117,7 @@ class SendVenue(Scaffold): reply_to_msg_id=reply_to_message_id, random_id=self.rnd_id(), schedule_date=schedule_date, + noforwards=protect_content, reply_markup=await reply_markup.write(self) if reply_markup else None ) ) diff --git a/pyrogram/methods/messages/send_video.py b/pyrogram/methods/messages/send_video.py index d42846ed..23563175 100644 --- a/pyrogram/methods/messages/send_video.py +++ b/pyrogram/methods/messages/send_video.py @@ -47,6 +47,7 @@ class SendVideo(Scaffold): disable_notification: bool = None, reply_to_message_id: int = None, schedule_date: int = None, + protect_content: bool = None, reply_markup: Union[ "types.InlineKeyboardMarkup", "types.ReplyKeyboardMarkup", @@ -122,6 +123,9 @@ class SendVideo(Scaffold): schedule_date (``int``, *optional*): Date when the message will be automatically sent. Unix time. + protect_content (``bool``, *optional*): + Protects the contents of the sent message from forwarding and saving. + reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.ForceReply`, *optional*): Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. @@ -228,6 +232,7 @@ class SendVideo(Scaffold): reply_to_msg_id=reply_to_message_id, random_id=self.rnd_id(), schedule_date=schedule_date, + noforwards=protect_content, reply_markup=await reply_markup.write(self) if reply_markup else None, **await utils.parse_text_entities(self, caption, parse_mode, caption_entities) ) diff --git a/pyrogram/methods/messages/send_video_note.py b/pyrogram/methods/messages/send_video_note.py index 91ba93fe..231e1498 100644 --- a/pyrogram/methods/messages/send_video_note.py +++ b/pyrogram/methods/messages/send_video_note.py @@ -39,6 +39,7 @@ class SendVideoNote(Scaffold): disable_notification: bool = None, reply_to_message_id: int = None, schedule_date: int = None, + protect_content: bool = None, reply_markup: Union[ "types.InlineKeyboardMarkup", "types.ReplyKeyboardMarkup", @@ -85,6 +86,9 @@ class SendVideoNote(Scaffold): schedule_date (``int``, *optional*): Date when the message will be automatically sent. Unix time. + protect_content (``bool``, *optional*): + Protects the contents of the sent message from forwarding and saving. + reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.ForceReply`, *optional*): Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. @@ -174,6 +178,7 @@ class SendVideoNote(Scaffold): reply_to_msg_id=reply_to_message_id, random_id=self.rnd_id(), schedule_date=schedule_date, + noforwards=protect_content, reply_markup=await reply_markup.write(self) if reply_markup else None, message="" ) diff --git a/pyrogram/methods/messages/send_voice.py b/pyrogram/methods/messages/send_voice.py index c534767b..9828ccf8 100644 --- a/pyrogram/methods/messages/send_voice.py +++ b/pyrogram/methods/messages/send_voice.py @@ -41,6 +41,7 @@ class SendVoice(Scaffold): disable_notification: bool = None, reply_to_message_id: int = None, schedule_date: int = None, + protect_content: bool = None, reply_markup: Union[ "types.InlineKeyboardMarkup", "types.ReplyKeyboardMarkup", @@ -91,6 +92,9 @@ class SendVoice(Scaffold): schedule_date (``int``, *optional*): Date when the message will be automatically sent. Unix time. + protect_content (``bool``, *optional*): + Protects the contents of the sent message from forwarding and saving. + reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.ForceReply`, *optional*): Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. @@ -178,6 +182,7 @@ class SendVoice(Scaffold): reply_to_msg_id=reply_to_message_id, random_id=self.rnd_id(), schedule_date=schedule_date, + noforwards=protect_content, reply_markup=await reply_markup.write(self) if reply_markup else None, **await utils.parse_text_entities(self, caption, parse_mode, caption_entities) ) diff --git a/pyrogram/types/messages_and_media/message.py b/pyrogram/types/messages_and_media/message.py index 9306a894..9690baf9 100644 --- a/pyrogram/types/messages_and_media/message.py +++ b/pyrogram/types/messages_and_media/message.py @@ -2924,6 +2924,7 @@ class Message(Object, Update): disable_notification: bool = None, reply_to_message_id: int = None, schedule_date: int = None, + protect_content: bool = None, reply_markup: Union[ "types.InlineKeyboardMarkup", "types.ReplyKeyboardMarkup", @@ -2979,6 +2980,9 @@ class Message(Object, Update): schedule_date (``int``, *optional*): Date when the message will be automatically sent. Unix time. + protect_content (``bool``, *optional*): + Protects the contents of the sent message from forwarding and saving. + reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.ForceReply`, *optional*): Additional interface options. An object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user. @@ -3008,6 +3012,7 @@ class Message(Object, Update): disable_notification=disable_notification, reply_to_message_id=reply_to_message_id, schedule_date=schedule_date, + protect_content=protect_content, reply_markup=self.reply_markup if reply_markup is object else reply_markup ) elif self.media: @@ -3017,6 +3022,7 @@ class Message(Object, Update): disable_notification=disable_notification, reply_to_message_id=reply_to_message_id, schedule_date=schedule_date, + protect_content=protect_content, reply_markup=self.reply_markup if reply_markup is object else reply_markup )