Skip to content

fix: properly fix component/modal callback #1523

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions interactions/models/internal/application_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -1170,7 +1170,6 @@ 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:
resolved_custom_id = custom_id or [func.__name__]
Expand All @@ -1182,8 +1181,8 @@ def wrapper(func: AsyncCallable) -> ComponentCommand:
name=f"ComponentCallback::{resolved_custom_id}", callback=func, listeners=resolved_custom_id
)

custom_id = _unpack_helper(resolved_custom_id)
custom_ids_validator(*resolved_custom_id)
custom_id = _unpack_helper(custom_id)
custom_ids_validator(*custom_id)
return wrapper


Expand All @@ -1203,7 +1202,6 @@ 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:
resolved_custom_id = custom_id or [func.__name__]
Expand All @@ -1213,8 +1211,8 @@ def wrapper(func: AsyncCallable) -> ModalCommand:

return ModalCommand(name=f"ModalCallback::{resolved_custom_id}", callback=func, listeners=resolved_custom_id)

custom_id = _unpack_helper(resolved_custom_id)
custom_ids_validator(*resolved_custom_id)
custom_id = _unpack_helper(custom_id)
custom_ids_validator(*custom_id)
return wrapper


Expand Down