diff --git a/discord/abc.py b/discord/abc.py index f4e2808a0..1141ce7a0 100644 --- a/discord/abc.py +++ b/discord/abc.py @@ -1435,6 +1435,7 @@ class Messageable: reference: Union[Message, MessageReference, PartialMessage] = ..., mention_author: bool = ..., suppress_embeds: bool = ..., + silent: bool = ..., ) -> Message: ... @@ -1452,6 +1453,7 @@ class Messageable: reference: Union[Message, MessageReference, PartialMessage] = ..., mention_author: bool = ..., suppress_embeds: bool = ..., + silent: bool = ..., ) -> Message: ... @@ -1469,6 +1471,7 @@ class Messageable: reference: Union[Message, MessageReference, PartialMessage] = ..., mention_author: bool = ..., suppress_embeds: bool = ..., + silent: bool = ..., ) -> Message: ... @@ -1486,6 +1489,7 @@ class Messageable: reference: Union[Message, MessageReference, PartialMessage] = ..., mention_author: bool = ..., suppress_embeds: bool = ..., + silent: bool = ..., ) -> Message: ... @@ -1503,6 +1507,7 @@ class Messageable: reference: Optional[Union[Message, MessageReference, PartialMessage]] = None, mention_author: Optional[bool] = None, suppress_embeds: bool = False, + silent: bool = False, ) -> Message: """|coro| @@ -1566,6 +1571,11 @@ class Messageable: suppress_embeds: :class:`bool` 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.0 Raises @@ -1608,10 +1618,12 @@ class Messageable: else: reference_dict = MISSING - if suppress_embeds: + if suppress_embeds or silent: from .message import MessageFlags # circular import - flags = MessageFlags._from_value(4) + flags = MessageFlags._from_value(0) + flags.suppress_embeds = suppress_embeds + flags.suppress_notifications = silent else: flags = MISSING diff --git a/discord/flags.py b/discord/flags.py index bb8ea9a29..1d1af7c37 100644 --- a/discord/flags.py +++ b/discord/flags.py @@ -577,6 +577,22 @@ class MessageFlags(BaseFlags): """ return 256 + @flag_value + def suppress_notifications(self): + """:class:`bool`: Returns ``True`` if the message will not trigger push and desktop notifications. + + .. versionadded:: 2.0 + """ + return 4096 + + @alias_flag_value + def silent(self): + """:class:`bool`: Alias for :attr:`suppress_notifications`. + + .. versionadded:: 2.0 + """ + return 4096 + @fill_with_flags() class PublicUserFlags(BaseFlags): diff --git a/discord/webhook/async_.py b/discord/webhook/async_.py index aee7f2dee..6db801729 100644 --- a/discord/webhook/async_.py +++ b/discord/webhook/async_.py @@ -1321,6 +1321,7 @@ class Webhook(BaseWebhook): thread_name: str = MISSING, wait: Literal[True], suppress_embeds: bool = MISSING, + silent: bool = MISSING, ) -> WebhookMessage: ... @@ -1341,6 +1342,7 @@ class Webhook(BaseWebhook): thread_name: str = MISSING, wait: Literal[False] = ..., suppress_embeds: bool = MISSING, + silent: bool = MISSING, ) -> None: ... @@ -1360,6 +1362,7 @@ class Webhook(BaseWebhook): thread_name: str = MISSING, wait: bool = False, suppress_embeds: bool = False, + silent: bool = False, ) -> Optional[WebhookMessage]: """|coro| @@ -1425,6 +1428,11 @@ class Webhook(BaseWebhook): suppress_embeds: :class:`bool` 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.0 Raises @@ -1454,9 +1462,10 @@ class Webhook(BaseWebhook): previous_mentions: Optional[AllowedMentions] = getattr(self._state, 'allowed_mentions', None) if content is None: content = MISSING - if suppress_embeds: + if suppress_embeds or silent: flags = MessageFlags._from_value(0) flags.suppress_embeds = suppress_embeds + flags.suppress_notifications = silent else: flags = MISSING diff --git a/discord/webhook/sync.py b/discord/webhook/sync.py index 0fcce9e43..cad7823fd 100644 --- a/discord/webhook/sync.py +++ b/discord/webhook/sync.py @@ -869,6 +869,7 @@ class SyncWebhook(BaseWebhook): thread_name: str = MISSING, wait: Literal[True], suppress_embeds: bool = MISSING, + silent: bool = MISSING, ) -> SyncWebhookMessage: ... @@ -889,6 +890,7 @@ class SyncWebhook(BaseWebhook): thread_name: str = MISSING, wait: Literal[False] = ..., suppress_embeds: bool = MISSING, + silent: bool = MISSING, ) -> None: ... @@ -908,6 +910,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. @@ -966,6 +969,11 @@ class SyncWebhook(BaseWebhook): suppress_embeds: :class:`bool` 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.0 Raises @@ -996,8 +1004,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