From 27b19ed582b343eb8c51da88a1572dc45125bbc3 Mon Sep 17 00:00:00 2001 From: Rapptz Date: Sat, 3 Sep 2022 22:02:02 -0400 Subject: [PATCH] Change error message for unbound callbacks in ContextMenu --- discord/app_commands/commands.py | 3 +++ 1 file changed, 3 insertions(+) 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, '