From be19422153d2aa77e7688fc7f80e4348da458845 Mon Sep 17 00:00:00 2001 From: CometovArt Date: Wed, 8 Nov 2023 00:15:16 +0300 Subject: [PATCH] Add support for spoilers in copy_message --- pyrogram/methods/messages/copy_message.py | 5 +++++ pyrogram/methods/messages/send_cached_media.py | 6 +++++- pyrogram/types/messages_and_media/message.py | 5 +++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/pyrogram/methods/messages/copy_message.py b/pyrogram/methods/messages/copy_message.py index 74ea2bb7..0ef82064 100644 --- a/pyrogram/methods/messages/copy_message.py +++ b/pyrogram/methods/messages/copy_message.py @@ -40,6 +40,7 @@ class CopyMessage: reply_to_message_id: int = None, schedule_date: datetime = None, protect_content: bool = None, + has_spoiler: bool = None, reply_markup: Union[ "types.InlineKeyboardMarkup", "types.ReplyKeyboardMarkup", @@ -97,6 +98,9 @@ class CopyMessage: protect_content (``bool``, *optional*): Protects the contents of the sent message from forwarding and saving. + has_spoiler (``bool``, *optional*): + True, if the message media is covered by a spoiler animation. + 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. @@ -123,5 +127,6 @@ class CopyMessage: reply_to_message_id=reply_to_message_id, schedule_date=schedule_date, protect_content=protect_content, + has_spoiler=has_spoiler, reply_markup=reply_markup ) diff --git a/pyrogram/methods/messages/send_cached_media.py b/pyrogram/methods/messages/send_cached_media.py index af458c9b..612720e7 100644 --- a/pyrogram/methods/messages/send_cached_media.py +++ b/pyrogram/methods/messages/send_cached_media.py @@ -40,6 +40,7 @@ class SendCachedMedia: quote_entities: List["types.MessageEntity"] = None, schedule_date: datetime = None, protect_content: bool = None, + has_spoiler: bool = None, invert_media: bool = None, reply_markup: Union[ "types.InlineKeyboardMarkup", @@ -102,6 +103,9 @@ class SendCachedMedia: protect_content (``bool``, *optional*): Protects the contents of the sent message from forwarding and saving. + has_spoiler (``bool``, *optional*): + True, if the message media is covered by a spoiler animation. + invert_media (``bool``, *optional*): Invert media. @@ -123,7 +127,7 @@ class SendCachedMedia: r = await self.invoke( raw.functions.messages.SendMedia( peer=peer, - media=utils.get_input_media_from_file_id(file_id), + media=utils.get_input_media_from_file_id(file_id, has_spoiler=has_spoiler), silent=disable_notification or None, invert_media=invert_media, reply_to=utils.get_reply_to( diff --git a/pyrogram/types/messages_and_media/message.py b/pyrogram/types/messages_and_media/message.py index e8411782..a933d30d 100644 --- a/pyrogram/types/messages_and_media/message.py +++ b/pyrogram/types/messages_and_media/message.py @@ -3523,6 +3523,7 @@ class Message(Object, Update): quote_entities: List["types.MessageEntity"] = None, schedule_date: datetime = None, protect_content: bool = None, + has_spoiler: bool = None, reply_markup: Union[ "types.InlineKeyboardMarkup", "types.ReplyKeyboardMarkup", @@ -3591,6 +3592,9 @@ class Message(Object, Update): protect_content (``bool``, *optional*): Protects the contents of the sent message from forwarding and saving. + has_spoiler (``bool``, *optional*): + True, if the message media is covered by a spoiler animation. + 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. @@ -3637,6 +3641,7 @@ class Message(Object, Update): quote_entities=quote_entities, schedule_date=schedule_date, protect_content=protect_content, + has_spoiler=has_spoiler, reply_markup=self.reply_markup if reply_markup is object else reply_markup )