Add support for spoilers in copy_message

This commit is contained in:
CometovArt 2023-11-08 00:15:16 +03:00 committed by KurimuzonAkuma
parent 34a9b06fbb
commit be19422153
3 changed files with 15 additions and 1 deletions

View File

@ -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
)

View File

@ -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(

View File

@ -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
)