Skip to content

Commit 7e94257

Browse files
authored
handle actionrow in container
1 parent f6938d7 commit 7e94257

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

discord/ui/container.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,21 @@ def __init__(
5858
super().__init__()
5959

6060
self.items = [i for i in items]
61-
components = [i._underlying for i in items]
6261
self._color = colour
6362

6463
self._underlying = ContainerComponent._raw_construct(
6564
type=ComponentType.container,
6665
id=None,
67-
components=components,
66+
components=[],
6867
accent_color=colour,
6968
spoiler=spoiler,
7069
)
70+
for i in items:
71+
if isinstance(i, ActionRow):
72+
for c in i.children:
73+
self.add_item(c)
74+
else:
75+
self.add_item(i)
7176

7277
def add_item(self, item: Item) -> None:
7378
"""Adds an item to the container.

discord/ui/view.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@ def _component_to_item(component: Component) -> Item:
104104
from .container import Container
105105

106106
return Container.from_component(component)
107+
if isinstance(component, ActionRow):
108+
# Handle ActionRow.children manually, or design ui.ActionRow?
109+
110+
return component
107111
return Item.from_component(component)
108112

109113

0 commit comments

Comments
 (0)