Have processCommand
return more information about command execution
#70
Labels
changes: api
modifies behavior of the public API
enhancement
something doesn't happen that should
version: major
semver-major, involves breaking change
Discord conversation
Currently, custom
messageCreate
listeners can't get too much information about run commands when callingclient.processCommand
. It only returns atrue
orfalse
value that indicates whether a command was run; it doesn't indicate what command was run, and it also treats a command's failing permission checks identically to a message not containing a command at all. The only way around this at the moment is to copy-paste the implementation ofprocessCommand
into the custom handler, which isn't well documented and isn't easy to work with.Ideally,
processCommand
would return some object describing the execution that's occurred, including the command that was specified (if any), the arguments passed to it (*), and whether or not it was executed (and if not, maybe the permission check that caused the command not to run?). This would be a breaking change.(* This might cause confusion paired with #25/#68, since the method I'm going with for argument parsing is to do the parsing within the command process rather than before the command is executed. This might result in confusing behavior, and given command arguments can basically be obtained by
msg.content.split(' ').slice(1)
(as long as your prefix doesn't have spaces), I'm not super convinced it would be worth it to provide the used arguments outside the actual command process.)The text was updated successfully, but these errors were encountered: