I am a beginner and probably, this is a stupid question. I am writing a command handler for a discord.js bot. Every time, a user sends a message starting with the correct command prefix, I check whether the invoke is in an Enmap of possible commands. Currently, it looks like this:
const command = client.commands.get(invoke);
if(!command) return;
...
I would like to keep this shorthand way of writing those sanity checks, but I would like to inform the user that there is no command with this name.
Is there an elegant way of doing this or does anyone know where I can find more information about good ways to solve this?
Thanks in advance :D
Aucun commentaire:
Enregistrer un commentaire