mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-06-06 03:47:29 +00:00
Change error message for unbound callbacks in ContextMenu
This commit is contained in:
parent
e04af033c0
commit
27b19ed582
@ -433,6 +433,9 @@ def _extract_parameters_from_callback(func: Callable[..., Any], globalns: Dict[s
|
||||
|
||||
def _get_context_menu_parameter(func: ContextMenuCallback) -> Tuple[str, Any, AppCommandType]:
|
||||
params = inspect.signature(func).parameters
|
||||
if is_inside_class(func) and not hasattr(func, '__self__'):
|
||||
raise TypeError('context menus cannot be defined inside a class')
|
||||
|
||||
if len(params) != 2:
|
||||
msg = (
|
||||
f'context menu callback {func.__qualname__!r} requires 2 parameters, '
|
||||
|
Loading…
x
Reference in New Issue
Block a user