From f15f60177931fe57034015ec96c27344f34e699b Mon Sep 17 00:00:00 2001 From: Rapptz <rapptz@gmail.com> Date: Tue, 5 Apr 2022 06:06:35 -0400 Subject: [PATCH] [commands] Check if an application command starts with bot_ or cog_ --- discord/ext/commands/cog.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/discord/ext/commands/cog.py b/discord/ext/commands/cog.py index 6e2ec38a8..44dfffc5e 100644 --- a/discord/ext/commands/cog.py +++ b/discord/ext/commands/cog.py @@ -162,6 +162,10 @@ class CogMeta(type): raise TypeError(no_bot_cog.format(base, elem)) commands[elem] = value elif isinstance(value, (app_commands.Group, app_commands.Command)) and value.parent is None: + if is_static_method: + raise TypeError(f'Command in method {base}.{elem!r} must not be staticmethod.') + if elem.startswith(('cog_', 'bot_')): + raise TypeError(no_bot_cog.format(base, elem)) cog_app_commands[elem] = value elif inspect.iscoroutinefunction(value): try: