mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-04-18 23:15:48 +00:00
[commands] Check if an application command starts with bot_ or cog_
This commit is contained in:
parent
b823a4bab1
commit
f15f601779
@ -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:
|
||||
|
Loading…
x
Reference in New Issue
Block a user