Skip to content

Commit 43f6f42

Browse files
FayeDeli0bs
authored andcommitted
fix: Add str arg support for modals in extensions, fix headers. (#533)
1 parent 84f7ecd commit 43f6f42

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

interactions/client.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1027,7 +1027,8 @@ def __new__(cls, client: Client, *args, **kwargs) -> "Extension":
10271027
func = client.modal(*args, **kwargs)(func)
10281028

10291029
modal = kwargs.get("modal") or args[0]
1030-
modal_name = f"modal_{modal.custom_id}"
1030+
_modal_id: str = modal.custom_id if isinstance(modal, Modal) else modal
1031+
modal_name = f"modal_{_modal_id}"
10311032

10321033
listeners = self._listeners.get(modal_name, [])
10331034
listeners.append(func)

interactions/client.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,11 @@ def extension_command(
107107
default_permission: Optional[bool] = None,
108108
): ...
109109
def extension_listener(name=None) -> Callable[..., Any]: ...
110-
def extension_component(component: Union[Button, SelectMenu]) -> Callable[..., Any]: ...
110+
def extension_component(component: Union[Button, SelectMenu, str]) -> Callable[..., Any]: ...
111111
def extension_autocomplete(
112112
name: str, command: Union[ApplicationCommand, int]
113113
) -> Callable[..., Any]: ...
114-
def extension_modal(modal: Modal) -> Callable[..., Any]: ...
114+
def extension_modal(modal: Union[Modal, str]) -> Callable[..., Any]: ...
115115
def extension_message_command(
116116
*,
117117
name: Optional[str] = None,

0 commit comments

Comments
 (0)