Browse Source

chore: Add missing enums to docs and fix docstrings

pull/10166/head
DA-344 3 months ago
parent
commit
14d8f31536
  1. 7
      discord/components.py
  2. 7
      discord/ui/container.py
  3. 10
      discord/ui/media_gallery.py
  4. 21
      docs/api.rst

7
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.

7
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]:

10
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.
"""

21
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

Loading…
Cancel
Save