diff --git a/discord/app_commands/commands.py b/discord/app_commands/commands.py index 5530aa154..940bb3fac 100644 --- a/discord/app_commands/commands.py +++ b/discord/app_commands/commands.py @@ -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, '