diff --git a/pyrogram/methods/messages/send_animation.py b/pyrogram/methods/messages/send_animation.py index 5952138e..61b62cfa 100644 --- a/pyrogram/methods/messages/send_animation.py +++ b/pyrogram/methods/messages/send_animation.py @@ -39,6 +39,7 @@ class SendAnimation: unsave: bool = False, parse_mode: Optional["enums.ParseMode"] = None, caption_entities: List["types.MessageEntity"] = None, + has_spoiler: bool = None, duration: int = 0, width: int = 0, height: int = 0, @@ -89,6 +90,9 @@ class SendAnimation: caption_entities (List of :obj:`~pyrogram.types.MessageEntity`): List of special entities that appear in the caption, which can be specified instead of *parse_mode*. + has_spoiler (``bool``, *optional*): + Pass True if the animation needs to be covered with a spoiler animation. + duration (``int``, *optional*): Duration of sent animation in seconds. @@ -185,6 +189,7 @@ class SendAnimation: mime_type=self.guess_mime_type(animation) or "video/mp4", file=file, thumb=thumb, + spoiler=has_spoiler, attributes=[ raw.types.DocumentAttributeVideo( supports_streaming=True, @@ -198,7 +203,8 @@ class SendAnimation: ) elif re.match("^https?://", animation): media = raw.types.InputMediaDocumentExternal( - url=animation + url=animation, + spoiler=has_spoiler ) else: media = utils.get_input_media_from_file_id(animation, FileType.ANIMATION) @@ -209,6 +215,7 @@ class SendAnimation: mime_type=self.guess_mime_type(file_name or animation.name) or "video/mp4", file=file, thumb=thumb, + spoiler=has_spoiler, attributes=[ raw.types.DocumentAttributeVideo( supports_streaming=True, diff --git a/pyrogram/methods/messages/send_photo.py b/pyrogram/methods/messages/send_photo.py index dfdea312..d597bf7c 100644 --- a/pyrogram/methods/messages/send_photo.py +++ b/pyrogram/methods/messages/send_photo.py @@ -37,6 +37,7 @@ class SendPhoto: caption: str = "", parse_mode: Optional["enums.ParseMode"] = None, caption_entities: List["types.MessageEntity"] = None, + has_spoiler: bool = None, ttl_seconds: int = None, disable_notification: bool = None, message_thread_id: int = None, @@ -79,6 +80,9 @@ class SendPhoto: caption_entities (List of :obj:`~pyrogram.types.MessageEntity`): List of special entities that appear in the caption, which can be specified instead of *parse_mode*. + has_spoiler (``bool``, *optional*): + Pass True if the photo needs to be covered with a spoiler animation. + ttl_seconds (``int``, *optional*): Self-Destruct Timer. If you set a timer, the photo will self-destruct in *ttl_seconds* @@ -154,12 +158,14 @@ class SendPhoto: file = await self.save_file(photo, progress=progress, progress_args=progress_args) media = raw.types.InputMediaUploadedPhoto( file=file, - ttl_seconds=ttl_seconds + ttl_seconds=ttl_seconds, + spoiler=has_spoiler, ) elif re.match("^https?://", photo): media = raw.types.InputMediaPhotoExternal( url=photo, - ttl_seconds=ttl_seconds + ttl_seconds=ttl_seconds, + spoiler=has_spoiler ) else: media = utils.get_input_media_from_file_id(photo, FileType.PHOTO, ttl_seconds=ttl_seconds) @@ -167,7 +173,8 @@ class SendPhoto: file = await self.save_file(photo, progress=progress, progress_args=progress_args) media = raw.types.InputMediaUploadedPhoto( file=file, - ttl_seconds=ttl_seconds + ttl_seconds=ttl_seconds, + spoiler=has_spoiler ) while True: diff --git a/pyrogram/methods/messages/send_video.py b/pyrogram/methods/messages/send_video.py index 01917c6a..088b85ab 100644 --- a/pyrogram/methods/messages/send_video.py +++ b/pyrogram/methods/messages/send_video.py @@ -38,6 +38,7 @@ class SendVideo: caption: str = "", parse_mode: Optional["enums.ParseMode"] = None, caption_entities: List["types.MessageEntity"] = None, + has_spoiler: bool = None, ttl_seconds: int = None, duration: int = 0, width: int = 0, @@ -86,6 +87,9 @@ class SendVideo: caption_entities (List of :obj:`~pyrogram.types.MessageEntity`): List of special entities that appear in the caption, which can be specified instead of *parse_mode*. + has_spoiler (``bool``, *optional*): + Pass True if the video needs to be covered with a spoiler animation. + ttl_seconds (``int``, *optional*): Self-Destruct Timer. If you set a timer, the video will self-destruct in *ttl_seconds* @@ -190,6 +194,7 @@ class SendVideo: mime_type=self.guess_mime_type(video) or "video/mp4", file=file, ttl_seconds=ttl_seconds, + spoiler=has_spoiler, thumb=thumb, attributes=[ raw.types.DocumentAttributeVideo( @@ -204,7 +209,8 @@ class SendVideo: elif re.match("^https?://", video): media = raw.types.InputMediaDocumentExternal( url=video, - ttl_seconds=ttl_seconds + ttl_seconds=ttl_seconds, + spoiler=has_spoiler ) else: media = utils.get_input_media_from_file_id(video, FileType.VIDEO, ttl_seconds=ttl_seconds) @@ -215,6 +221,7 @@ class SendVideo: mime_type=self.guess_mime_type(file_name or video.name) or "video/mp4", file=file, ttl_seconds=ttl_seconds, + spoiler=has_spoiler, thumb=thumb, attributes=[ raw.types.DocumentAttributeVideo(