mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-20 18:06:08 -05:00
Reserves command names (#2977)
* Reserves command names - Currently, only reserving ``cancel`` - This should only impact matching command qualified names - This also checks aliases - This makes cc and alias use the new module constant with info about this - Module constant is available for use by 3rd party cogs which may dynamically create responses. * Change misleading var name * style * Thanks Flame! * Handles issues with CC
This commit is contained in:
@@ -222,6 +222,9 @@ class CustomCommands(commands.Cog):
|
||||
|
||||
Note: This command is interactive.
|
||||
"""
|
||||
if command in (*self.bot.all_commands, *commands.RESERVED_COMMAND_NAMES):
|
||||
await ctx.send(_("There already exists a bot command with the same name."))
|
||||
return
|
||||
responses = await self.commandobj.get_responses(ctx=ctx)
|
||||
try:
|
||||
await self.commandobj.create(ctx=ctx, command=command, response=responses)
|
||||
@@ -241,7 +244,7 @@ class CustomCommands(commands.Cog):
|
||||
Example:
|
||||
- `[p]customcom create simple yourcommand Text you want`
|
||||
"""
|
||||
if command in self.bot.all_commands:
|
||||
if command in (*self.bot.all_commands, *commands.RESERVED_COMMAND_NAMES):
|
||||
await ctx.send(_("There already exists a bot command with the same name."))
|
||||
return
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user