I've searched everywhere to find a small piece of code that tells the user that the command they entered does not exist.
I found this, but I don't understand it, can someone explain (or simplify)?
My code is here.
Place the acceptable commands into an array.
e.g:
let userInputCommand = getUserInputCommand();
let validCommands = ["command1", "command2", "command3"];
let isValid = validCommands.includes(userInputCommand);
if(!isValid) {
return message.channel.send("Please enter a valid command!");
}
Use .includes()
to see if the command exists. (getUserInputCommand()
is just an example, not referring to your actual code.)