From efdda635fb36a8f8c9c69980cac97acf22c41a3a Mon Sep 17 00:00:00 2001 From: Rapptz Date: Sat, 23 Jul 2022 15:24:26 -0400 Subject: [PATCH] Fix View.from_message not respecting ActionRow row order --- discord/ui/view.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/discord/ui/view.py b/discord/ui/view.py index 7711cba7a..c3621c238 100644 --- a/discord/ui/view.py +++ b/discord/ui/view.py @@ -280,8 +280,19 @@ class View: one of its subclasses. """ view = View(timeout=timeout) - for component in _walk_all_components(message.components): # type: ignore - view.add_item(_component_to_item(component)) + row = 0 + 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 def add_item(self, item: Item[Any]) -> Self: