Skip to content

Commit c11a51e

Browse files
committed
feat: add no_sound parameter to the send_video
1 parent 2f0d388 commit c11a51e

File tree

4 files changed

+21
-0
lines changed

4 files changed

+21
-0
lines changed

hydrogram/methods/messages/send_media_group.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ async def send_media_group(
173173
thumb=await self.save_file(i.thumb),
174174
spoiler=i.has_spoiler,
175175
mime_type=self.guess_mime_type(i.media) or "video/mp4",
176+
nosound_video=True,
176177
attributes=[
177178
raw.types.DocumentAttributeVideo(
178179
supports_streaming=i.supports_streaming or None,
@@ -228,6 +229,7 @@ async def send_media_group(
228229
getattr(i.media, "name", "video.mp4")
229230
)
230231
or "video/mp4",
232+
nosound_video=True,
231233
attributes=[
232234
raw.types.DocumentAttributeVideo(
233235
supports_streaming=i.supports_streaming or None,

hydrogram/methods/messages/send_video.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ async def send_video(
4343
parse_mode: enums.ParseMode | None = None,
4444
caption_entities: list[types.MessageEntity] | None = None,
4545
has_spoiler: bool | None = None,
46+
no_sound: bool | None = None,
4647
ttl_seconds: int | None = None,
4748
duration: int = 0,
4849
width: int = 0,
@@ -95,6 +96,10 @@ async def send_video(
9596
has_spoiler (``bool``, *optional*):
9697
Pass True if the video needs to be covered with a spoiler animation.
9798
99+
no_sound (``bool``, *optional*):
100+
Pass True if the video you are uploading is a video message with no sound.
101+
Does not work for external links.
102+
98103
ttl_seconds (``int``, *optional*):
99104
Self-Destruct Timer.
100105
If you set a timer, the video will self-destruct in *ttl_seconds*
@@ -201,6 +206,7 @@ async def progress(current, total):
201206
ttl_seconds=ttl_seconds,
202207
spoiler=has_spoiler,
203208
thumb=thumb,
209+
nosound_video=no_sound,
204210
attributes=[
205211
raw.types.DocumentAttributeVideo(
206212
supports_streaming=supports_streaming or None,
@@ -230,6 +236,7 @@ async def progress(current, total):
230236
ttl_seconds=ttl_seconds,
231237
spoiler=has_spoiler,
232238
thumb=thumb,
239+
nosound_video=no_sound,
233240
attributes=[
234241
raw.types.DocumentAttributeVideo(
235242
supports_streaming=supports_streaming or None,

hydrogram/types/input_media/input_media_video.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@ class InputMediaVideo(InputMedia):
7171
7272
has_spoiler (``bool``, *optional*):
7373
Pass True if the photo needs to be covered with a spoiler animation.
74+
75+
no_sound (``bool``, *optional*):
76+
Pass True if the video you are uploading is a video message with no sound.
77+
Does not work for external links.
7478
"""
7579

7680
def __init__(
@@ -85,6 +89,7 @@ def __init__(
8589
duration: int = 0,
8690
supports_streaming: bool = True,
8791
has_spoiler: bool | None = None,
92+
no_sound: bool | None = None,
8893
):
8994
super().__init__(media, caption, parse_mode, caption_entities)
9095

@@ -94,3 +99,4 @@ def __init__(
9499
self.duration = duration
95100
self.supports_streaming = supports_streaming
96101
self.has_spoiler = has_spoiler
102+
self.no_sound = no_sound

hydrogram/types/messages_and_media/message.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2729,6 +2729,7 @@ async def reply_video(
27292729
supports_streaming: bool = True,
27302730
disable_notification: bool | None = None,
27312731
reply_to_message_id: int | None = None,
2732+
no_sound: bool | None = False,
27322733
reply_markup: types.InlineKeyboardMarkup
27332734
| types.ReplyKeyboardMarkup
27342735
| types.ReplyKeyboardRemove
@@ -2806,6 +2807,10 @@ async def reply_video(
28062807
reply_to_message_id (``int``, *optional*):
28072808
If the message is a reply, ID of the original message.
28082809
2810+
no_sound (``bool``, *optional*):
2811+
Pass True if the video you are uploading is a video message with no sound.
2812+
Does not work for external links.
2813+
28092814
reply_markup (:obj:`~hydrogram.types.InlineKeyboardMarkup` | :obj:`~hydrogram.types.ReplyKeyboardMarkup` | :obj:`~hydrogram.types.ReplyKeyboardRemove` | :obj:`~hydrogram.types.ForceReply`, *optional*):
28102815
Additional interface options. An object for an inline keyboard, custom reply keyboard,
28112816
instructions to remove reply keyboard or to force a reply from the user.
@@ -2862,6 +2867,7 @@ async def reply_video(
28622867
supports_streaming=supports_streaming,
28632868
disable_notification=disable_notification,
28642869
reply_to_message_id=reply_to_message_id,
2870+
no_sound=no_sound,
28652871
reply_markup=reply_markup,
28662872
progress=progress,
28672873
progress_args=progress_args,

0 commit comments

Comments
 (0)