diff --git a/interactions/models/internal/application_commands.py b/interactions/models/internal/application_commands.py index 50b863bd5..b1461df2b 100644 --- a/interactions/models/internal/application_commands.py +++ b/interactions/models/internal/application_commands.py @@ -1170,17 +1170,20 @@ def component_callback(*custom_id: str | re.Pattern) -> Callable[[AsyncCallable] *custom_id: The custom ID of the component to wait for """ + resolved_custom_id: tuple[str | re.Pattern, ...] | list[str] = [] def wrapper(func: AsyncCallable) -> ComponentCommand: - custom_id = custom_id or [func.__name__] # noqa: F823 + resolved_custom_id = custom_id or [func.__name__] if not asyncio.iscoroutinefunction(func): raise ValueError("Commands must be coroutines") - return ComponentCommand(name=f"ComponentCallback::{custom_id}", callback=func, listeners=custom_id) + return ComponentCommand( + name=f"ComponentCallback::{resolved_custom_id}", callback=func, listeners=resolved_custom_id + ) - custom_id = _unpack_helper(custom_id) - custom_ids_validator(*custom_id) + custom_id = _unpack_helper(resolved_custom_id) + custom_ids_validator(*resolved_custom_id) return wrapper @@ -1200,17 +1203,18 @@ def modal_callback(*custom_id: str | re.Pattern) -> Callable[[AsyncCallable], Mo Args: *custom_id: The custom ID of the modal to wait for """ + resolved_custom_id: tuple[str | re.Pattern, ...] | list[str] = [] def wrapper(func: AsyncCallable) -> ModalCommand: - custom_id = custom_id or [func.__name__] # noqa: F823 + resolved_custom_id = custom_id or [func.__name__] if not asyncio.iscoroutinefunction(func): raise ValueError("Commands must be coroutines") - return ModalCommand(name=f"ModalCallback::{custom_id}", callback=func, listeners=custom_id) + return ModalCommand(name=f"ModalCallback::{resolved_custom_id}", callback=func, listeners=resolved_custom_id) - custom_id = _unpack_helper(custom_id) - custom_ids_validator(*custom_id) + custom_id = _unpack_helper(resolved_custom_id) + custom_ids_validator(*resolved_custom_id) return wrapper diff --git a/pyproject.toml b/pyproject.toml index 89a0b7ed3..412c6a2b6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "interactions.py" -version = "5.9.0" +version = "5.9.1" description = "Easy, simple, scalable and modular: a Python API wrapper for interactions." authors = [ "LordOfPolls ",