From 9b5106d0586a9d38d6fb1ac3760de2025a6b34cf Mon Sep 17 00:00:00 2001 From: i0bs <41456914+i0bs@users.noreply.github.com> Date: Tue, 8 Aug 2023 11:47:45 -0400 Subject: [PATCH 1/2] fix: resolve callback custom ID --- .../models/internal/application_commands.py | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) 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 From 8a29c4fc200daa7fb8c10a2c0aa6f227a1e94745 Mon Sep 17 00:00:00 2001 From: Katelyn Gigante Date: Wed, 9 Aug 2023 02:09:49 +1000 Subject: [PATCH 2/2] chore: Bump version to 5.9.1 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 ",