Browse Source

qol things and changes

pull/10166/head
DA-344 2 months ago
parent
commit
d4e738abb2
  1. 4
      discord/ui/action_row.py
  2. 6
      discord/ui/container.py
  3. 8
      discord/ui/dynamic.py
  4. 4
      discord/ui/media_gallery.py
  5. 2
      discord/ui/view.py

4
discord/ui/action_row.py

@ -87,10 +87,10 @@ class _ActionRowCallback:
class ActionRow(Item[V]):
"""Represents a UI action row.
r"""Represents a UI action row.
This is a top-level layout component that can only be used on :class:`LayoutView`
and can contain :class:`Button` 's and :class:`Select` 's in it.
and can contain :class:`Button`\s and :class:`Select`\s in it.
This can be inherited.

6
discord/ui/container.py

@ -73,11 +73,11 @@ class _ContainerCallback:
class Container(Item[V]):
"""Represents a UI container.
r"""Represents a UI container.
This is a top-level layout component that can only be used on :class:`LayoutView`
and can contain :class:`ActionRow` 's, :class:`TextDisplay` 's, :class:`Section` 's,
:class:`MediaGallery` 's, and :class:`File` 's in it.
and can contain :class:`ActionRow`\s, :class:`TextDisplay`\s, :class:`Section`\s,
:class:`MediaGallery`\s, and :class:`File`\s in it.
This can be inherited.

8
discord/ui/dynamic.py

@ -38,14 +38,10 @@ if TYPE_CHECKING:
from ..interactions import Interaction
from ..components import Component
from ..enums import ComponentType
from .view import BaseView
from .view import View, LayoutView
V = TypeVar('V', bound='BaseView', covariant=True, default=BaseView)
else:
V = TypeVar('V', bound='BaseView', covariant=True)
class DynamicItem(Generic[BaseT, V], Item[V]):
class DynamicItem(Generic[BaseT], Item[Union[View, LayoutView]]):
"""Represents an item with a dynamic ``custom_id`` that can be used to store state within
that ``custom_id``.

4
discord/ui/media_gallery.py

@ -44,9 +44,9 @@ __all__ = ('MediaGallery',)
class MediaGallery(Item[V]):
"""Represents a UI media gallery.
r"""Represents a UI media gallery.
Can contain up to 10 :class:`.MediaGalleryItem` 's.
Can contain up to 10 :class:`.MediaGalleryItem`\s.
This is a top-level layout component that can only be used on :class:`LayoutView`.

2
discord/ui/view.py

@ -575,7 +575,7 @@ class BaseView:
self._total_children = 0
return self
def get_item_by_id(self, id: int, /) -> Optional[Item[Self]]:
def get_item(self, id: int, /) -> Optional[Item[Self]]:
"""Gets an item with :attr:`Item.id` set as ``id``, or ``None`` if
not found.

Loading…
Cancel
Save