From 14d8f315362087a90d7af0ce0dceefa04dfa71fd Mon Sep 17 00:00:00 2001 From: DA-344 <108473820+DA-344@users.noreply.github.com> Date: Sun, 2 Mar 2025 14:37:49 +0100 Subject: [PATCH] chore: Add missing enums to docs and fix docstrings --- discord/components.py | 7 ++----- discord/ui/container.py | 7 +++---- discord/ui/media_gallery.py | 10 +++++----- docs/api.rst | 21 +++++++++++++++++++++ 4 files changed, 31 insertions(+), 14 deletions(-) diff --git a/discord/components.py b/discord/components.py index b12de4f5e..d528f02ce 100644 --- a/discord/components.py +++ b/discord/components.py @@ -769,7 +769,7 @@ class ThumbnailComponent(Component): Attributes ---------- - media: :class:`UnfurledAttachment` + media: :class:`UnfurledMediaItem` The media for this thumbnail. description: Optional[:class:`str`] The description shown within this thumbnail. @@ -832,9 +832,6 @@ class UnfurledMediaItem(AssetMixin): """Represents an unfurled media item that can be used on :class:`MediaGalleryItem`s. - Unlike :class:`UnfurledAttachment` this represents a media item - not yet stored on Discord and thus it does not have any data. - Parameters ---------- url: :class:`str` @@ -1004,7 +1001,7 @@ class FileComponent(Component): Attributes ---------- - media: :class:`UnfurledAttachment` + media: :class:`UnfurledMediaItem` The unfurled attachment contents of the file. spoiler: :class:`bool` Whether this file is flagged as a spoiler. diff --git a/discord/ui/container.py b/discord/ui/container.py index 978781dd8..170d6eeca 100644 --- a/discord/ui/container.py +++ b/discord/ui/container.py @@ -42,7 +42,7 @@ __all__ = ('Container',) class Container(View, Item[V]): - """Represents a Components V2 Container. + """Represents a UI container. .. versionadded:: 2.6 @@ -53,7 +53,7 @@ class Container(View, Item[V]): items. accent_colour: Optional[:class:`.Colour`] The colour of the container. Defaults to ``None``. - accent_color: Optional[:class:`.Color`] + accent_color: Optional[:class:`.Colour`] The color of the container. Defaults to ``None``. spoiler: :class:`bool` Whether to flag this container as a spoiler. Defaults @@ -103,7 +103,7 @@ class Container(View, Item[V]): @property def accent_colour(self) -> Optional[Colour]: - """Optional[:class:`~discord.Colour`]: The colour of the container, or ``None``.""" + """Optional[:class:`discord.Colour`]: The colour of the container, or ``None``.""" return self._colour @accent_colour.setter @@ -111,7 +111,6 @@ class Container(View, Item[V]): self._colour = value accent_color = accent_colour - """Optional[:class:`~discord.Color`]: The color of the container, or ``None``.""" @property def type(self) -> Literal[ComponentType.container]: diff --git a/discord/ui/media_gallery.py b/discord/ui/media_gallery.py index b2da65df0..88991d40b 100644 --- a/discord/ui/media_gallery.py +++ b/discord/ui/media_gallery.py @@ -73,7 +73,7 @@ class MediaGallery(Item[V]): @property def items(self) -> List[MediaGalleryItem]: - """List[:class:`MediaGalleryItem`]: Returns a read-only list of this gallery's items.""" + """List[:class:`.MediaGalleryItem`]: Returns a read-only list of this gallery's items.""" return self._underlying.items.copy() @items.setter @@ -97,13 +97,13 @@ class MediaGallery(Item[V]): Parameters ---------- - item: :class:`MediaGalleryItem` + item: :class:`.MediaGalleryItem` The item to add to the gallery. Raises ------ TypeError - A :class:`MediaGalleryItem` was not passed. + A :class:`.MediaGalleryItem` was not passed. ValueError Maximum number of items has been exceeded (10). """ @@ -125,7 +125,7 @@ class MediaGallery(Item[V]): Parameters ---------- - item: :class:`MediaGalleryItem` + item: :class:`.MediaGalleryItem` The item to remove from the gallery. """ @@ -145,7 +145,7 @@ class MediaGallery(Item[V]): ---------- index: :class:`int` The index of where to insert the item. - item: :class:`MediaGalleryItem` + item: :class:`.MediaGalleryItem` The item to insert. """ diff --git a/docs/api.rst b/docs/api.rst index 07e04ca77..d331715c3 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -3863,6 +3863,27 @@ of :class:`enum.Enum`. An alias for :attr:`.reply`. + +.. class:: MediaItemLoadingState + + Represents a :class:`UnfurledMediaItem` load state. + + .. attribute:: unknown + + Unknown load state. + + .. attribute:: loading + + The media item is still loading. + + .. attribute:: loaded + + The media item is loaded. + + .. attribute:: not_found + + The media item was not found. + .. _discord-api-audit-logs: Audit Log Data