Open cocoliliace opened 3 years ago
I noticed that disabled commands are checked in dispatcher.js
while the rest of commandBlock
events (nsfw, guildOnly, permission... etc.) are checked in message.run()
. Should I move disabled commands to message.run()
to make it consistent?
Instead of emitting disabledCommandRun
maybe we should emit commandBlock
with an argument of disabled
The idea behind a command being disabled is to prevent any additional processing for it, so nothing in the command's code is run at all. Off the top of my head, moving the handling for this to CommandMessage#run would mean that it occurs after parsing arguments and such.
It looks like the conditions are checked at the beginning of CommandMessage#run, right before parsing the arguments, so I think CommandMessage#run would still be able to return early upon detecting the disabled command.
Currently, the check for whether a command is disabled happens on an if statement in CommandDispatcher#handleMessage, and CommandMessage#run is called in the corresponding else if
branch. If we remove the if statement there, CommandMessage#run would be called and the disabled commands would be immediately handled at the top of CommandMessage#run, which is also where gulidOnly, nsfw, and permissions are checked.
Resolved #336