From eb2996d91ee526d35313f2c6719d94c74f08e041 Mon Sep 17 00:00:00 2001 From: DA344 <108473820+DA-344@users.noreply.github.com> Date: Fri, 16 May 2025 11:32:10 +0200 Subject: [PATCH] Make Container._init_children more similar to BaseView._init_children --- discord/ui/container.py | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/discord/ui/container.py b/discord/ui/container.py index 633af8360..28ae23039 100644 --- a/discord/ui/container.py +++ b/discord/ui/container.py @@ -175,23 +175,15 @@ class Container(Item[V]): for name, raw in self.__container_children_items__.items(): if isinstance(raw, Item): - if getattr(raw, '__discord_ui_action_row__', False): - item = copy.deepcopy(raw) - # we need to deepcopy this object and set it later to prevent - # errors reported on the bikeshedding post - item._parent = self - + item = copy.deepcopy(raw) + item._parent = self + if getattr(item, '__discord_ui_action_row__', False): if item.is_dispatchable(): self.__dispatchable.extend(item._children) # type: ignore - if getattr(raw, '__discord_ui_section__', False): - item = copy.copy(raw) + if getattr(item, '__discord_ui_section__', False): if item.accessory.is_dispatchable(): # type: ignore - item.accessory = copy.deepcopy(item.accessory) # type: ignore if item.accessory._provided_custom_id is False: # type: ignore item.accessory.custom_id = os.urandom(16).hex() # type: ignore - else: - item = copy.copy(raw) - if getattr(item, '__discord_ui_section__', False) and item.accessory.is_dispatchable(): # type: ignore self.__dispatchable.append(item.accessory) # type: ignore