Add support for silent messages

This commit is contained in:
Rapptz
2023-02-08 15:40:33 -05:00
parent 93ed1646d2
commit 183675be74
5 changed files with 60 additions and 6 deletions

View File

@ -870,6 +870,7 @@ class SyncWebhook(BaseWebhook):
thread_name: str = MISSING,
wait: Literal[True],
suppress_embeds: bool = MISSING,
silent: bool = MISSING,
) -> SyncWebhookMessage:
...
@ -890,6 +891,7 @@ class SyncWebhook(BaseWebhook):
thread_name: str = MISSING,
wait: Literal[False] = ...,
suppress_embeds: bool = MISSING,
silent: bool = MISSING,
) -> None:
...
@ -909,6 +911,7 @@ class SyncWebhook(BaseWebhook):
thread_name: str = MISSING,
wait: bool = False,
suppress_embeds: bool = False,
silent: bool = False,
) -> Optional[SyncWebhookMessage]:
"""Sends a message using the webhook.
@ -968,6 +971,11 @@ class SyncWebhook(BaseWebhook):
Whether to suppress embeds for the message. This sends the message without any embeds if set to ``True``.
.. versionadded:: 2.0
silent: :class:`bool`
Whether to suppress push and desktop notifications for the message. This will increment the mention counter
in the UI, but will not actually send a notification.
.. versionadded:: 2.2
Raises
--------
@ -997,8 +1005,10 @@ class SyncWebhook(BaseWebhook):
if content is None:
content = MISSING
if suppress_embeds:
flags = MessageFlags._from_value(4)
if suppress_embeds or silent:
flags = MessageFlags._from_value(0)
flags.suppress_embeds = suppress_embeds
flags.suppress_notifications = silent
else:
flags = MISSING