From 5fda19eb917f4ff346b5ffad8eb209e6f8e7b46b Mon Sep 17 00:00:00 2001 From: DA-344 <108473820+DA-344@users.noreply.github.com> Date: Sun, 2 Mar 2025 15:05:41 +0100 Subject: [PATCH] chore: add ui.Section.is_dispatchable --- discord/ui/section.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/discord/ui/section.py b/discord/ui/section.py index f2b6554ca..f8b8ea4e2 100644 --- a/discord/ui/section.py +++ b/discord/ui/section.py @@ -89,6 +89,15 @@ class Section(Item[V]): def _is_v2(self) -> bool: return True + # Accessory can be a button, and thus it can have a callback so, maybe + # allow for section to be dispatchable and make the callback func + # be accessory component callback, only called if accessory is + # dispatchable? + def is_dispatchable(self) -> bool: + if self.accessory: + return self.accessory.is_dispatchable() + return False + def add_item(self, item: Union[str, Item[Any]]) -> Self: """Adds an item to this section.