mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-09-06 09:56:09 +00:00
Add support for silent messages
This commit is contained in:
@ -1315,6 +1315,7 @@ class Messageable:
|
||||
mention_author: bool = ...,
|
||||
view: View = ...,
|
||||
suppress_embeds: bool = ...,
|
||||
silent: bool = ...,
|
||||
) -> Message:
|
||||
...
|
||||
|
||||
@ -1334,6 +1335,7 @@ class Messageable:
|
||||
mention_author: bool = ...,
|
||||
view: View = ...,
|
||||
suppress_embeds: bool = ...,
|
||||
silent: bool = ...,
|
||||
) -> Message:
|
||||
...
|
||||
|
||||
@ -1353,6 +1355,7 @@ class Messageable:
|
||||
mention_author: bool = ...,
|
||||
view: View = ...,
|
||||
suppress_embeds: bool = ...,
|
||||
silent: bool = ...,
|
||||
) -> Message:
|
||||
...
|
||||
|
||||
@ -1372,6 +1375,7 @@ class Messageable:
|
||||
mention_author: bool = ...,
|
||||
view: View = ...,
|
||||
suppress_embeds: bool = ...,
|
||||
silent: bool = ...,
|
||||
) -> Message:
|
||||
...
|
||||
|
||||
@ -1392,6 +1396,7 @@ class Messageable:
|
||||
mention_author: Optional[bool] = None,
|
||||
view: Optional[View] = None,
|
||||
suppress_embeds: bool = False,
|
||||
silent: bool = False,
|
||||
) -> Message:
|
||||
"""|coro|
|
||||
|
||||
@ -1472,6 +1477,11 @@ class Messageable:
|
||||
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
|
||||
--------
|
||||
@ -1514,10 +1524,12 @@ class Messageable:
|
||||
if view and not hasattr(view, '__discord_ui_view__'):
|
||||
raise TypeError(f'view parameter must be View not {view.__class__.__name__}')
|
||||
|
||||
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
|
||||
|
||||
|
Reference in New Issue
Block a user