@@ -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
0 commit comments