Add no_sound parameter to send_video methods

This commit is contained in:
KurimuzonAkuma 2024-03-14 11:26:00 +03:00
parent 48de16b10e
commit 0bf78fab5a
5 changed files with 27 additions and 0 deletions

View File

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

View File

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

View File

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

View File

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

View File

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