mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-07-09 11:31:58 +00:00
Fix View.from_message not respecting ActionRow row order
This commit is contained in:
parent
9d9d96fce1
commit
efdda635fb
@ -280,8 +280,19 @@ class View:
|
|||||||
one of its subclasses.
|
one of its subclasses.
|
||||||
"""
|
"""
|
||||||
view = View(timeout=timeout)
|
view = View(timeout=timeout)
|
||||||
for component in _walk_all_components(message.components): # type: ignore
|
row = 0
|
||||||
view.add_item(_component_to_item(component))
|
for component in message.components:
|
||||||
|
if isinstance(component, ActionRowComponent):
|
||||||
|
for child in component.children:
|
||||||
|
item = _component_to_item(child)
|
||||||
|
item.row = row
|
||||||
|
view.add_item(item)
|
||||||
|
row += 1
|
||||||
|
else:
|
||||||
|
item = _component_to_item(component)
|
||||||
|
item.row = row
|
||||||
|
view.add_item(item)
|
||||||
|
|
||||||
return view
|
return view
|
||||||
|
|
||||||
def add_item(self, item: Item[Any]) -> Self:
|
def add_item(self, item: Item[Any]) -> Self:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user