diff --git a/discord/webhook/async_.py b/discord/webhook/async_.py index 9ce18bbe49d8..19bf408ccfd8 100644 --- a/discord/webhook/async_.py +++ b/discord/webhook/async_.py @@ -1594,6 +1594,7 @@ async def send( wait: Literal[True], suppress_embeds: bool = MISSING, silent: bool = MISSING, + voice_message: bool = MISSING, ) -> WebhookMessage: ... @@ -1617,6 +1618,7 @@ async def send( wait: Literal[False] = ..., suppress_embeds: bool = MISSING, silent: bool = MISSING, + voice_message: bool = MISSING, ) -> None: ... @@ -1639,6 +1641,7 @@ async def send( wait: bool = False, suppress_embeds: bool = False, silent: bool = False, + voice_message: bool = False, ) -> Optional[WebhookMessage]: """|coro| @@ -1724,6 +1727,10 @@ async def send( in the UI, but will not actually send a notification. .. versionadded:: 2.2 + voice_message: :class:`bool` + Whether to send this message as a voice message. This will only work with audio files. + + .. versionadded:: 2.3 Raises -------- @@ -1754,11 +1761,12 @@ async def send( previous_mentions: Optional[AllowedMentions] = getattr(self._state, 'allowed_mentions', None) if content is None: content = MISSING - if ephemeral or suppress_embeds or silent: + if ephemeral or suppress_embeds or silent or voice_message: flags = MessageFlags._from_value(0) flags.ephemeral = ephemeral flags.suppress_embeds = suppress_embeds flags.suppress_notifications = silent + flags.voice = voice_message else: flags = MISSING diff --git a/discord/webhook/sync.py b/discord/webhook/sync.py index 7da6ada70818..dc2d99149f33 100644 --- a/discord/webhook/sync.py +++ b/discord/webhook/sync.py @@ -870,6 +870,7 @@ def send( wait: Literal[True], suppress_embeds: bool = MISSING, silent: bool = MISSING, + voice_message: bool = MISSING, ) -> SyncWebhookMessage: ... @@ -891,6 +892,7 @@ def send( wait: Literal[False] = ..., suppress_embeds: bool = MISSING, silent: bool = MISSING, + voice_message: bool = MISSING, ) -> None: ... @@ -911,6 +913,7 @@ def send( wait: bool = False, suppress_embeds: bool = False, silent: bool = False, + voice_message: bool = False, ) -> Optional[SyncWebhookMessage]: """Sends a message using the webhook. @@ -975,6 +978,10 @@ def send( in the UI, but will not actually send a notification. .. versionadded:: 2.2 + voice_message: :class:`bool` + Whether to send this message as a voice message. This will only work with audio files. + + .. versionadded:: 2.3 Raises -------- @@ -1004,10 +1011,11 @@ def send( if content is None: content = MISSING - if suppress_embeds or silent: + if suppress_embeds or silent or voice_message: flags = MessageFlags._from_value(0) flags.suppress_embeds = suppress_embeds flags.suppress_notifications = silent + flags.voice = voice_message else: flags = MISSING