Skip to content

Commit

Permalink
Add missing suppress_embeds kwarg to InteractionResponse.edit_message
Browse files Browse the repository at this point in the history
  • Loading branch information
Soheab committed Dec 10, 2023
1 parent d9f8115 commit f6182e5
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions discord/interactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -851,6 +851,7 @@ async def edit_message(
view: Optional[View] = MISSING,
allowed_mentions: Optional[AllowedMentions] = MISSING,
delete_after: Optional[float] = None,
suppress_embeds: bool = MISSING,
) -> None:
"""|coro|
Expand Down Expand Up @@ -886,6 +887,13 @@ async def edit_message(
then it is silently ignored.
.. versionadded:: 2.2
suppress_embeds: :class:`bool`
Whether to suppress embeds for the message. This removes
all the embeds if set to ``True``. If set to ``False``
this brings the embeds back if they were suppressed.
Using this parameter requires :attr:`~.Permissions.manage_messages`.
.. versionadded:: 2.4
Raises
-------
Expand Down Expand Up @@ -917,6 +925,12 @@ async def edit_message(
if view is not MISSING and message_id is not None:
state.prevent_view_updates_for(message_id)

if suppress_embeds is not MISSING:
flags = MessageFlags._from_value(0)
flags.suppress_embeds = suppress_embeds
else:
flags = MISSING

adapter = async_context.get()
params = interaction_message_response_params(
type=InteractionResponseType.message_update.value,
Expand All @@ -927,6 +941,7 @@ async def edit_message(
attachments=attachments,
previous_allowed_mentions=parent._state.allowed_mentions,
allowed_mentions=allowed_mentions,
flags=flags,
)

http = parent._state.http
Expand Down

0 comments on commit f6182e5

Please sign in to comment.