-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commands reject invalid sub-commands #99
Conversation
| if (commands.length > 0) { | ||
| // only consider the first command that a user asks for help on to avoid spam | ||
| const cmd = this.client.commands.get(commands[0]) || this.client.commands.get(this.client.aliases.get(commands[0])); | ||
| if (!cmd) return message.channel.send(`No command named: \`${commands[0]}\` exists`); | ||
| embed.setAuthor(`Command Help: ${commands[0]}`, message.guild === null ? null : message.guild.iconURL({ dynamic: true })); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was Trivia Bot doing something other than Invalid command named: <command name> in response to a nonexistent command? I think your edit here does the same thing as before, but please correct me if I'm wrong! I like the edit on the bot message though, it makes it a little clearer to the user!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, I did not edit the help command much, just changed the parameters to read all of the commands as arguments and edited the message to be a little clearer
Here's the code on main rn for this section:
if (command) {
const cmd = this.client.commands.get(command) || this.client.commands.get(this.client.aliases.get(command));
if (!cmd) return message.channel.send(`Invalid Command named: \`${command}\``);
embed.setAuthor(`Command Help: ${command}`, message.guild === null ? null : message.guild.iconURL({ dynamic: true }));There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thanks for the awesome PR!
Description
Added a
validateCommands()method that is called for each command except for the help command, since its behavior is a little diffrent than the other commands. Also changed the help command a little bit to have a clearer error message when the user enters a command that has not yet been added.closes #98
Type of change
Checklist: