From 0bf78fab5a3982ffb535d91c907318a7f2d9a377 Mon Sep 17 00:00:00 2001 From: KurimuzonAkuma Date: Thu, 14 Mar 2024 11:26:00 +0300 Subject: [PATCH] Add no_sound parameter to send_video methods --- pyrogram/methods/messages/send_media_group.py | 2 ++ pyrogram/methods/messages/send_video.py | 7 +++++++ pyrogram/types/input_media/input_media_video.py | 6 ++++++ pyrogram/types/messages_and_media/message.py | 6 ++++++ pyrogram/types/messages_and_media/story.py | 6 ++++++ 5 files changed, 27 insertions(+) diff --git a/pyrogram/methods/messages/send_media_group.py b/pyrogram/methods/messages/send_media_group.py index c6c2fa37..eac7b80a 100644 --- a/pyrogram/methods/messages/send_media_group.py +++ b/pyrogram/methods/messages/send_media_group.py @@ -201,6 +201,7 @@ class SendMediaGroup: thumb=await self.save_file(i.thumb), spoiler=i.has_spoiler, mime_type=self.guess_mime_type(i.media) or "video/mp4", + nosound_video=i.no_sound, attributes=[ raw.types.DocumentAttributeVideo( supports_streaming=i.supports_streaming or None, @@ -252,6 +253,7 @@ class SendMediaGroup: thumb=await self.save_file(i.thumb), spoiler=i.has_spoiler, mime_type=self.guess_mime_type(getattr(i.media, "name", "video.mp4")) or "video/mp4", + nosound_video=i.no_sound, attributes=[ raw.types.DocumentAttributeVideo( supports_streaming=i.supports_streaming or None, diff --git a/pyrogram/methods/messages/send_video.py b/pyrogram/methods/messages/send_video.py index 51809c4d..203fc409 100644 --- a/pyrogram/methods/messages/send_video.py +++ b/pyrogram/methods/messages/send_video.py @@ -56,6 +56,7 @@ class SendVideo: quote_offset: int = None, schedule_date: datetime = None, protect_content: bool = None, + no_sound: bool = None, reply_markup: Union[ "types.InlineKeyboardMarkup", "types.ReplyKeyboardMarkup", @@ -155,6 +156,10 @@ class SendVideo: protect_content (``bool``, *optional*): Protects the contents of the sent message from forwarding and saving. + no_sound (``bool``, *optional*): + Pass True, if the uploaded video is a video message with no sound. + Doesn't work for external links. + 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. @@ -216,6 +221,7 @@ class SendVideo: ttl_seconds=ttl_seconds, spoiler=has_spoiler, thumb=thumb, + nosound_video=no_sound, attributes=[ raw.types.DocumentAttributeVideo( supports_streaming=supports_streaming or None, @@ -243,6 +249,7 @@ class SendVideo: ttl_seconds=ttl_seconds, spoiler=has_spoiler, thumb=thumb, + nosound_video=no_sound, attributes=[ raw.types.DocumentAttributeVideo( supports_streaming=supports_streaming or None, diff --git a/pyrogram/types/input_media/input_media_video.py b/pyrogram/types/input_media/input_media_video.py index ab1823d3..6ab7a1a6 100644 --- a/pyrogram/types/input_media/input_media_video.py +++ b/pyrogram/types/input_media/input_media_video.py @@ -66,6 +66,10 @@ class InputMediaVideo(InputMedia): has_spoiler (``bool``, *optional*): Pass True if the photo needs to be covered with a spoiler animation. + + no_sound (``bool``, *optional*): + Pass True, if the uploaded video is a video message with no sound. + Doesn't work for external links. """ def __init__( @@ -80,6 +84,7 @@ class InputMediaVideo(InputMedia): duration: int = 0, supports_streaming: bool = True, has_spoiler: bool = None, + no_sound: bool = None, ): super().__init__(media, caption, parse_mode, caption_entities) @@ -89,3 +94,4 @@ class InputMediaVideo(InputMedia): self.duration = duration self.supports_streaming = supports_streaming self.has_spoiler = has_spoiler + self.no_sound = no_sound diff --git a/pyrogram/types/messages_and_media/message.py b/pyrogram/types/messages_and_media/message.py index b20c5936..1c680f3c 100644 --- a/pyrogram/types/messages_and_media/message.py +++ b/pyrogram/types/messages_and_media/message.py @@ -2982,6 +2982,7 @@ class Message(Object, Update): reply_to_message_id: int = None, quote_text: str = None, quote_entities: List["types.MessageEntity"] = None, + no_sound: bool = None, reply_markup: Union[ "types.InlineKeyboardMarkup", "types.ReplyKeyboardMarkup", @@ -3072,6 +3073,10 @@ class Message(Object, Update): quote_entities (List of :obj:`~pyrogram.types.MessageEntity`): List of special entities that appear in quote text, which can be specified instead of *parse_mode*. + no_sound (``bool``, *optional*): + Pass True, if the uploaded video is a video message with no sound. + Doesn't work for external links. + 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. @@ -3133,6 +3138,7 @@ class Message(Object, Update): reply_to_message_id=reply_to_message_id, quote_text=quote_text, quote_entities=quote_entities, + no_sound=no_sound, reply_markup=reply_markup, progress=progress, progress_args=progress_args diff --git a/pyrogram/types/messages_and_media/story.py b/pyrogram/types/messages_and_media/story.py index d9a2eb21..c8a3feaa 100644 --- a/pyrogram/types/messages_and_media/story.py +++ b/pyrogram/types/messages_and_media/story.py @@ -1036,6 +1036,7 @@ class Story(Object, Update): file_name: str = None, supports_streaming: bool = True, disable_notification: bool = None, + no_sound: bool = None, reply_markup: Union[ "types.InlineKeyboardMarkup", "types.ReplyKeyboardMarkup", @@ -1113,6 +1114,10 @@ class Story(Object, Update): Sends the message silently. Users will receive a notification with no sound. + no_sound (``bool``, *optional*): + Pass True, if the uploaded video is a video message with no sound. + Doesn't work for external links. + 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. @@ -1162,6 +1167,7 @@ class Story(Object, Update): file_name=file_name, supports_streaming=supports_streaming, disable_notification=disable_notification, + no_sound=no_sound, reply_to_story_id=self.id, reply_markup=reply_markup, progress=progress,