[commands] Check if an application command starts with bot_ or cog_

This commit is contained in:
Rapptz 2022-04-05 06:06:35 -04:00
parent b823a4bab1
commit f15f601779

View File

@ -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: