Stop allowing spaces in custom commands names (#3816)

This commit is contained in:
Neuro Assassin 2020-05-01 12:32:22 -04:00 committed by GitHub
parent aaee2d9294
commit 4a0f23b0ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -292,6 +292,10 @@ class CustomCommands(commands.Cog):
Note: This command is interactive. Note: This command is interactive.
""" """
if any(char.isspace() for char in command):
# Haha, nice try
await ctx.send(_("Custom command names cannot have spaces in them."))
return
if command in (*self.bot.all_commands, *commands.RESERVED_COMMAND_NAMES): if command in (*self.bot.all_commands, *commands.RESERVED_COMMAND_NAMES):
await ctx.send(_("There already exists a bot command with the same name.")) await ctx.send(_("There already exists a bot command with the same name."))
return return
@ -317,6 +321,10 @@ class CustomCommands(commands.Cog):
Example: Example:
- `[p]customcom create simple yourcommand Text you want` - `[p]customcom create simple yourcommand Text you want`
""" """
if any(char.isspace() for char in command):
# Haha, nice try
await ctx.send(_("Custom command names cannot have spaces in them."))
return
if command in (*self.bot.all_commands, *commands.RESERVED_COMMAND_NAMES): if command in (*self.bot.all_commands, *commands.RESERVED_COMMAND_NAMES):
await ctx.send(_("There already exists a bot command with the same name.")) await ctx.send(_("There already exists a bot command with the same name."))
return return