Add the suppress_embeds parameter to send methods

Modified the following methods:

- abc.Messageable.send
- Webhook.send
- SyncWebhook.send
- InteractionResponse.send_message
This commit is contained in:
Stocker
2022-03-05 22:19:33 -05:00
committed by GitHub
parent 82464419ce
commit 554d2d7c99
4 changed files with 50 additions and 5 deletions

View File

@ -1310,6 +1310,7 @@ class Webhook(BaseWebhook):
view: View = MISSING,
thread: Snowflake = MISSING,
wait: Literal[True],
suppress_embeds: bool = MISSING,
) -> WebhookMessage:
...
@ -1330,6 +1331,7 @@ class Webhook(BaseWebhook):
view: View = MISSING,
thread: Snowflake = MISSING,
wait: Literal[False] = ...,
suppress_embeds: bool = MISSING,
) -> None:
...
@ -1349,6 +1351,7 @@ class Webhook(BaseWebhook):
view: View = MISSING,
thread: Snowflake = MISSING,
wait: bool = False,
suppress_embeds: bool = False,
) -> Optional[WebhookMessage]:
"""|coro|
@ -1417,6 +1420,10 @@ class Webhook(BaseWebhook):
thread: :class:`~discord.abc.Snowflake`
The thread to send this webhook to.
.. versionadded:: 2.0
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
Raises
@ -1447,8 +1454,10 @@ class Webhook(BaseWebhook):
previous_mentions: Optional[AllowedMentions] = getattr(self._state, 'allowed_mentions', None)
if content is None:
content = MISSING
if ephemeral:
flags = MessageFlags._from_value(64)
if ephemeral or suppress_embeds:
flags = MessageFlags._from_value(0)
flags.ephemeral = ephemeral
flags.suppress_embeds = suppress_embeds
else:
flags = MISSING