Skip to content

Commit 6e9c9fd

Browse files
authored
Merge pull request #1522 from interactions-py/unstable
5.9.1
2 parents 43a565c + 8a29c4f commit 6e9c9fd

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

interactions/models/internal/application_commands.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1170,17 +1170,20 @@ def component_callback(*custom_id: str | re.Pattern) -> Callable[[AsyncCallable]
11701170
*custom_id: The custom ID of the component to wait for
11711171
11721172
"""
1173+
resolved_custom_id: tuple[str | re.Pattern, ...] | list[str] = []
11731174

11741175
def wrapper(func: AsyncCallable) -> ComponentCommand:
1175-
custom_id = custom_id or [func.__name__] # noqa: F823
1176+
resolved_custom_id = custom_id or [func.__name__]
11761177

11771178
if not asyncio.iscoroutinefunction(func):
11781179
raise ValueError("Commands must be coroutines")
11791180

1180-
return ComponentCommand(name=f"ComponentCallback::{custom_id}", callback=func, listeners=custom_id)
1181+
return ComponentCommand(
1182+
name=f"ComponentCallback::{resolved_custom_id}", callback=func, listeners=resolved_custom_id
1183+
)
11811184

1182-
custom_id = _unpack_helper(custom_id)
1183-
custom_ids_validator(*custom_id)
1185+
custom_id = _unpack_helper(resolved_custom_id)
1186+
custom_ids_validator(*resolved_custom_id)
11841187
return wrapper
11851188

11861189

@@ -1200,17 +1203,18 @@ def modal_callback(*custom_id: str | re.Pattern) -> Callable[[AsyncCallable], Mo
12001203
Args:
12011204
*custom_id: The custom ID of the modal to wait for
12021205
"""
1206+
resolved_custom_id: tuple[str | re.Pattern, ...] | list[str] = []
12031207

12041208
def wrapper(func: AsyncCallable) -> ModalCommand:
1205-
custom_id = custom_id or [func.__name__] # noqa: F823
1209+
resolved_custom_id = custom_id or [func.__name__]
12061210

12071211
if not asyncio.iscoroutinefunction(func):
12081212
raise ValueError("Commands must be coroutines")
12091213

1210-
return ModalCommand(name=f"ModalCallback::{custom_id}", callback=func, listeners=custom_id)
1214+
return ModalCommand(name=f"ModalCallback::{resolved_custom_id}", callback=func, listeners=resolved_custom_id)
12111215

1212-
custom_id = _unpack_helper(custom_id)
1213-
custom_ids_validator(*custom_id)
1216+
custom_id = _unpack_helper(resolved_custom_id)
1217+
custom_ids_validator(*resolved_custom_id)
12141218
return wrapper
12151219

12161220

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "interactions.py"
3-
version = "5.9.0"
3+
version = "5.9.1"
44
description = "Easy, simple, scalable and modular: a Python API wrapper for interactions."
55
authors = [
66
"LordOfPolls <dev@lordofpolls.com>",

0 commit comments

Comments
 (0)