From 03964172d33552ca7be6952e1197e7ac36ad0120 Mon Sep 17 00:00:00 2001 From: DA-344 <108473820+DA-344@users.noreply.github.com> Date: Thu, 1 May 2025 16:14:57 +0200 Subject: [PATCH] rows --- discord/ui/action_row.py | 9 +++++++++ discord/ui/container.py | 2 +- discord/ui/file.py | 2 +- discord/ui/item.py | 2 +- discord/ui/media_gallery.py | 2 +- discord/ui/section.py | 2 +- discord/ui/separator.py | 2 +- discord/ui/text_display.py | 2 +- discord/ui/thumbnail.py | 2 +- 9 files changed, 17 insertions(+), 8 deletions(-) diff --git a/discord/ui/action_row.py b/discord/ui/action_row.py index 1eeb75da4..e54522ec6 100644 --- a/discord/ui/action_row.py +++ b/discord/ui/action_row.py @@ -128,6 +128,13 @@ class ActionRow(Item[V]): ---------- *children: :class:`Item` The initial children of this action row. + row: Optional[:class:`int`] + The relative row this action row belongs to. By default + items are arranged automatically into those rows. If you'd + like to control the relative positioning of the row then + passing an index is advised. For example, row=1 will show + up before row=2. Defaults to ``None``, which is automatic + ordering. The row number must be between 0 and 39 (i.e. zero indexed) id: Optional[:class:`int`] The ID of this component. This must be unique across the view. """ @@ -139,6 +146,7 @@ class ActionRow(Item[V]): def __init__( self, *children: Item[V], + row: Optional[int] = None, id: Optional[int] = None, ) -> None: super().__init__() @@ -151,6 +159,7 @@ class ActionRow(Item[V]): raise ValueError('maximum number of children exceeded') self.id = id + self.row = row def __init_subclass__(cls) -> None: super().__init_subclass__() diff --git a/discord/ui/container.py b/discord/ui/container.py index adfbb549a..c5890722c 100644 --- a/discord/ui/container.py +++ b/discord/ui/container.py @@ -126,7 +126,7 @@ class Container(Item[V]): like to control the relative positioning of the row then passing an index is advised. For example, row=1 will show up before row=2. Defaults to ``None``, which is automatic - ordering. The row number must be between 0 and 9 (i.e. zero indexed) + ordering. The row number must be between 0 and 39 (i.e. zero indexed) id: Optional[:class:`int`] The ID of this component. This must be unique across the view. """ diff --git a/discord/ui/file.py b/discord/ui/file.py index ccc7a0fdc..5d9014e72 100644 --- a/discord/ui/file.py +++ b/discord/ui/file.py @@ -72,7 +72,7 @@ class File(Item[V]): like to control the relative positioning of the row then passing an index is advised. For example, row=1 will show up before row=2. Defaults to ``None``, which is automatic - ordering. The row number must be between 0 and 9 (i.e. zero indexed) + ordering. The row number must be between 0 and 39 (i.e. zero indexed) id: Optional[:class:`int`] The ID of this component. This must be unique across the view. """ diff --git a/discord/ui/item.py b/discord/ui/item.py index 87cfc3681..c73d8e762 100644 --- a/discord/ui/item.py +++ b/discord/ui/item.py @@ -80,7 +80,7 @@ class Item(Generic[V]): # only called upon edit and we're mainly interested during initial creation time. self._provided_custom_id: bool = False self._id: Optional[int] = None - self._max_row: int = 5 if not self._is_v2() else 10 + self._max_row: int = 5 if not self._is_v2() else 40 self._parent: Optional[Item] = None if self._is_v2(): diff --git a/discord/ui/media_gallery.py b/discord/ui/media_gallery.py index b7c92f047..bbecc9649 100644 --- a/discord/ui/media_gallery.py +++ b/discord/ui/media_gallery.py @@ -61,7 +61,7 @@ class MediaGallery(Item[V]): like to control the relative positioning of the row then passing an index is advised. For example, row=1 will show up before row=2. Defaults to ``None``, which is automatic - ordering. The row number must be between 0 and 9 (i.e. zero indexed) + ordering. The row number must be between 0 and 39 (i.e. zero indexed) id: Optional[:class:`int`] The ID of this component. This must be unique across the view. """ diff --git a/discord/ui/section.py b/discord/ui/section.py index 7a5fd2afa..2d4acdc3a 100644 --- a/discord/ui/section.py +++ b/discord/ui/section.py @@ -60,7 +60,7 @@ class Section(Item[V]): like to control the relative positioning of the row then passing an index is advised. For example, row=1 will show up before row=2. Defaults to ``None``, which is automatic - ordering. The row number must be between 0 and 9 (i.e. zero indexed) + ordering. The row number must be between 0 and 39 (i.e. zero indexed) id: Optional[:class:`int`] The ID of this component. This must be unique across the view. """ diff --git a/discord/ui/separator.py b/discord/ui/separator.py index 48908df9d..e7d75a998 100644 --- a/discord/ui/separator.py +++ b/discord/ui/separator.py @@ -59,7 +59,7 @@ class Separator(Item[V]): like to control the relative positioning of the row then passing an index is advised. For example, row=1 will show up before row=2. Defaults to ``None``, which is automatic - ordering. The row number must be between 0 and 9 (i.e. zero indexed) + ordering. The row number must be between 0 and 39 (i.e. zero indexed) id: Optional[:class:`int`] The ID of this component. This must be unique across the view. """ diff --git a/discord/ui/text_display.py b/discord/ui/text_display.py index beff74c6e..9ba7f294e 100644 --- a/discord/ui/text_display.py +++ b/discord/ui/text_display.py @@ -56,7 +56,7 @@ class TextDisplay(Item[V]): like to control the relative positioning of the row then passing an index is advised. For example, row=1 will show up before row=2. Defaults to ``None``, which is automatic - ordering. The row number must be between 0 and 9 (i.e. zero indexed) + ordering. The row number must be between 0 and 39 (i.e. zero indexed) id: Optional[:class:`int`] The ID of this component. This must be unique across the view. """ diff --git a/discord/ui/thumbnail.py b/discord/ui/thumbnail.py index f63926991..67f8e4c76 100644 --- a/discord/ui/thumbnail.py +++ b/discord/ui/thumbnail.py @@ -61,7 +61,7 @@ class Thumbnail(Item[V]): like to control the relative positioning of the row then passing an index is advised. For example, row=1 will show up before row=2. Defaults to ``None``, which is automatic - ordering. The row number must be between 0 and 9 (i.e. zero indexed) + ordering. The row number must be between 0 and 39 (i.e. zero indexed) id: Optional[:class:`int`] The ID of this component. This must be unique across the view. """