diff --git a/interactions/client/client.py b/interactions/client/client.py index 564efb8a9..0b421da31 100644 --- a/interactions/client/client.py +++ b/interactions/client/client.py @@ -1353,6 +1353,17 @@ def add_modal_callback(self, command: ModalCommand) -> None: command: The command to add """ + # test for parameters that arent the ctx (or self) + if command.has_binding: + callback = functools.partial(command.callback, None, None) + else: + callback = functools.partial(command.callback, None) + + if not inspect.signature(callback).parameters: + # if there are none, notify the command to just pass the ctx and not kwargs + # TODO: just make modal callbacks not pass kwargs at all (breaking) + command._just_ctx = True + for listener in command.listeners: if isinstance(listener, re.Pattern): if listener in self._regex_component_callbacks.keys(): diff --git a/interactions/models/internal/application_commands.py b/interactions/models/internal/application_commands.py index d41381fd3..c404d055f 100644 --- a/interactions/models/internal/application_commands.py +++ b/interactions/models/internal/application_commands.py @@ -845,7 +845,13 @@ class ComponentCommand(InteractionCommand): @attrs.define(eq=False, order=False, hash=False, kw_only=True) -class ModalCommand(ComponentCommand): ... +class ModalCommand(ComponentCommand): + _just_ctx: bool = attrs.field(repr=False, default=False) + + async def call_callback(self, callback: Callable, context: "BaseContext") -> None: + if self._just_ctx: + return await self.call_with_binding(callback, context) + return await super().call_callback(callback, context) def _unpack_helper(iterable: typing.Iterable[str]) -> list[str]: