From 67d67d3495ebb8be8845cf71fbe250aca71a3795 Mon Sep 17 00:00:00 2001 From: DA-344 <108473820+DA-344@users.noreply.github.com> Date: Mon, 30 Jun 2025 12:41:32 +0200 Subject: [PATCH] chore: Clarify note on message edit related methods --- discord/interactions.py | 23 +++++++++++++++++++---- discord/message.py | 5 ++++- discord/webhook/async_.py | 6 ++++++ 3 files changed, 29 insertions(+), 5 deletions(-) diff --git a/discord/interactions.py b/discord/interactions.py index 4015c6f19..6cf8d15f3 100644 --- a/discord/interactions.py +++ b/discord/interactions.py @@ -540,9 +540,18 @@ class Interaction(Generic[ClientT]): allowed_mentions: :class:`AllowedMentions` Controls the mentions being processed in this message. See :meth:`.abc.Messageable.send` for more information. - view: Optional[:class:`~discord.ui.View`] + view: Optional[Union[:class:`~discord.ui.View`, :class:`~discord.ui.LayoutView`]] The updated view to update this message with. If ``None`` is passed then the view is removed. + + .. note:: + + To update the message to add a :class:`~discord.ui.LayoutView`, you + must explicitly set the ``content``, ``embed``, ``embeds``, and + ``attachments`` parameters to either ``None`` or an empty array, as appropriate. + + .. versionchanged:: 2.6 + This now accepts :class:`~discord.ui.LayoutView` instances. poll: :class:`Poll` The poll to create when editing the message. @@ -1178,6 +1187,12 @@ class InteractionResponse(Generic[ClientT]): The updated view to update this message with. If ``None`` is passed then the view is removed. + .. note:: + + To update the message to add a :class:`~discord.ui.LayoutView`, you + must explicitly set the ``content``, ``embed``, ``embeds``, and + ``attachments`` parameters to either ``None`` or an empty array, as appropriate. + .. versionchanged:: 2.6 This now accepts :class:`~discord.ui.LayoutView` instances. allowed_mentions: Optional[:class:`~discord.AllowedMentions`] @@ -1496,9 +1511,9 @@ class InteractionMessage(Message): .. note:: - If you want to update the message to have a :class:`~discord.ui.LayoutView`, you must - explicitly set to ``None`` or empty array, as required, the ``content``, ``embed``, - ``embeds``, and ``attachments`` parameters. + To update the message to add a :class:`~discord.ui.LayoutView`, you + must explicitly set the ``content``, ``embed``, ``embeds``, and + ``attachments`` parameters to either ``None`` or an empty array, as appropriate. .. versionchanged:: 2.6 This now accepts :class:`~discord.ui.LayoutView` instances. diff --git a/discord/message.py b/discord/message.py index c268f682f..d9fee394f 100644 --- a/discord/message.py +++ b/discord/message.py @@ -2993,7 +2993,7 @@ class Message(PartialMessage, Hashable): are used instead. .. versionadded:: 1.4 - view: Optional[:class:`~discord.ui.View`] + view: Optional[Union[:class:`~discord.ui.View`, :class:`~discord.ui.LayoutView`]] The updated view to update this message with. If ``None`` is passed then the view is removed. @@ -3003,6 +3003,9 @@ class Message(PartialMessage, Hashable): explicitly set to ``None`` or empty array, as required, the ``content``, ``embed``, ``embeds``, and ``attachments`` parameters. + .. versionchanged:: 2.6 + This now accepts :class:`~discord.ui.LayoutView` instances. + Raises ------- HTTPException diff --git a/discord/webhook/async_.py b/discord/webhook/async_.py index 322e60465..a539918b9 100644 --- a/discord/webhook/async_.py +++ b/discord/webhook/async_.py @@ -2059,6 +2059,12 @@ class Webhook(BaseWebhook): the view is removed. The webhook must have state attached, similar to :meth:`send`. + .. note:: + + To update the message to add a :class:`~discord.ui.LayoutView`, you + must explicitly set the ``content``, ``embed``, ``embeds``, and + ``attachments`` parameters to either ``None`` or an empty array, as appropriate. + .. versionadded:: 2.0 .. versionchanged:: 2.6 This now accepts :class:`~discord.ui.LayoutView` instances.