From ec186ab18f0c605a6be25e8e705b04a31b1cb6c0 Mon Sep 17 00:00:00 2001 From: DA-344 <108473820+DA-344@users.noreply.github.com> Date: Sat, 19 Apr 2025 00:13:27 +0200 Subject: [PATCH] chore: update docstrings --- discord/abc.py | 4 +++- discord/channel.py | 5 ++++- discord/client.py | 7 +++++-- discord/webhook/async_.py | 4 +++- discord/webhook/sync.py | 4 +++- 5 files changed, 18 insertions(+), 6 deletions(-) diff --git a/discord/abc.py b/discord/abc.py index b7fd0252e..748a021d7 100644 --- a/discord/abc.py +++ b/discord/abc.py @@ -1546,10 +1546,12 @@ class Messageable: If set, overrides the :attr:`~discord.AllowedMentions.replied_user` attribute of ``allowed_mentions``. .. versionadded:: 1.6 - view: :class:`discord.ui.View` + view: Union[:class:`discord.ui.View`, :class:`discord.ui.LayoutView`] A Discord UI View to add to the message. .. versionadded:: 2.0 + .. versionchanged:: 2.6 + This parameter now accepts :class:`discord.ui.LayoutView` instances. stickers: Sequence[Union[:class:`~discord.GuildSticker`, :class:`~discord.StickerItem`]] A list of stickers to upload. Must be a maximum of 3. diff --git a/discord/channel.py b/discord/channel.py index 3dc43d388..8833f566e 100644 --- a/discord/channel.py +++ b/discord/channel.py @@ -2907,8 +2907,11 @@ class ForumChannel(discord.abc.GuildChannel, Hashable): If set, overrides the :attr:`~discord.AllowedMentions.replied_user` attribute of ``allowed_mentions``. applied_tags: List[:class:`discord.ForumTag`] A list of tags to apply to the thread. - view: :class:`discord.ui.View` + view: Union[:class:`discord.ui.View`, :class:`discord.ui.LayoutView`] A Discord UI View to add to the message. + + .. versionchanged:: 2.6 + This parameter now accepts :class:`discord.ui.LayoutView` instances. stickers: Sequence[Union[:class:`~discord.GuildSticker`, :class:`~discord.StickerItem`]] A list of stickers to upload. Must be a maximum of 3. suppress_embeds: :class:`bool` diff --git a/discord/client.py b/discord/client.py index 2eaae2455..c620dc23a 100644 --- a/discord/client.py +++ b/discord/client.py @@ -3159,8 +3159,11 @@ class Client: Parameters ------------ - view: :class:`discord.ui.View` + view: Union[:class:`discord.ui.View`, :class:`discord.ui.LayoutView`] The view to register for dispatching. + + .. versionchanged:: 2.6 + This now accepts :class:`discord.ui.LayoutView` instances. message_id: Optional[:class:`int`] The message ID that the view is attached to. This is currently used to refresh the view's state during message update events. If not given @@ -3188,7 +3191,7 @@ class Client: @property def persistent_views(self) -> Sequence[BaseView]: - """Sequence[:class:`.View`]: A sequence of persistent views added to the client. + """Sequence[Union[:class:`.View`, :class:`.LayoutView`]]: A sequence of persistent views added to the client. .. versionadded:: 2.0 """ diff --git a/discord/webhook/async_.py b/discord/webhook/async_.py index d62807779..c2c40ada5 100644 --- a/discord/webhook/async_.py +++ b/discord/webhook/async_.py @@ -1734,12 +1734,14 @@ class Webhook(BaseWebhook): Controls the mentions being processed in this message. .. versionadded:: 1.4 - view: :class:`discord.ui.View` + view: Union[:class:`discord.ui.View`, :class:`discord.ui.LayoutView`] The view to send with the message. If the webhook is partial or is not managed by the library, then you can only send URL buttons. Otherwise, you can send views with any type of components. .. versionadded:: 2.0 + .. versionchanged:: 2.6 + This now accepts :class:`discord.ui.LayoutView` instances. thread: :class:`~discord.abc.Snowflake` The thread to send this webhook to. diff --git a/discord/webhook/sync.py b/discord/webhook/sync.py index db59b4659..904597761 100644 --- a/discord/webhook/sync.py +++ b/discord/webhook/sync.py @@ -996,13 +996,15 @@ class SyncWebhook(BaseWebhook): When sending a Poll via webhook, you cannot manually end it. .. versionadded:: 2.4 - view: :class:`~discord.ui.View` + view: Union[:class:`~discord.ui.View`, :class:`~discord.ui.LayoutView`] The view to send with the message. This can only have URL buttons, which donnot require a state to be attached to it. If you want to send a view with any component attached to it, check :meth:`Webhook.send`. .. versionadded:: 2.5 + .. versionchanged:: 2.6 + This now accepts :class:`discord.ui.LayoutView` instances. Raises --------