From cc4aa8a2d376e9624648d7fbd145b87639c30ef9 Mon Sep 17 00:00:00 2001 From: KurimuzonAkuma Date: Wed, 15 May 2024 18:54:23 +0300 Subject: [PATCH] Fix copy methods spoilers --- pyrogram/methods/messages/copy_media_group.py | 15 ++++++++++++++- pyrogram/types/messages_and_media/message.py | 5 +---- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/pyrogram/methods/messages/copy_media_group.py b/pyrogram/methods/messages/copy_media_group.py index 5e0f22e7..3a88cfd4 100644 --- a/pyrogram/methods/messages/copy_media_group.py +++ b/pyrogram/methods/messages/copy_media_group.py @@ -30,6 +30,7 @@ class CopyMediaGroup: from_chat_id: Union[int, str], message_id: int, captions: Union[List[str], str] = None, + has_spoilers: Union[List[bool], bool] = None, disable_notification: bool = None, message_thread_id: int = None, reply_to_message_id: int = None, @@ -137,7 +138,19 @@ class CopyMediaGroup: else: raise ValueError("Message with this type can't be copied.") - media = utils.get_input_media_from_file_id(file_id=file_id) + media = utils.get_input_media_from_file_id( + file_id=file_id, + has_spoiler=( + has_spoilers[i] + if isinstance(has_spoilers, list) + and i < len(has_spoilers) + else ( + has_spoilers + if isinstance(has_spoilers, bool) + else message.has_media_spoiler + ) + ), + ) multi_media.append( raw.types.InputSingleMedia( media=media, diff --git a/pyrogram/types/messages_and_media/message.py b/pyrogram/types/messages_and_media/message.py index bfd02490..42b9564e 100644 --- a/pyrogram/types/messages_and_media/message.py +++ b/pyrogram/types/messages_and_media/message.py @@ -4102,9 +4102,6 @@ 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. - business_connection_id (``str``, *optional*): Unique identifier of the business connection on behalf of which the message will be sent. @@ -4158,7 +4155,7 @@ class Message(Object, Update): quote_entities=quote_entities, schedule_date=schedule_date, protect_content=protect_content, - has_spoiler=has_spoiler, + has_spoiler=self.has_media_spoiler if has_spoiler is None else has_spoiler, business_connection_id=business_connection_id, reply_markup=self.reply_markup if reply_markup is object else reply_markup )