Closed PermissionError closed 5 years ago
And how would a cancellable event work? You can just ignore it like a regular JDA event
@natanbc In the CommandClientImpl
, it calls CommandClient#onCommand
before actually executing thhe command. So, if we could do something like CommandEvent#setCancelled
in the onCommand
method, the CommandClient
could then getCancelled
, and if true
, do not execute the command..
You should not be relying on the order events happen; do your checks via a category, and/or utilize exception handling to prevent commands from running
Issue
Issue Checklist
Please follow the following steps before opening this issue.
Issues that do not complete the checklist may be closed without any help.
Issue Information
Check all that apply:
Description
Recently I've been wondering why the CommandEvent is not cancellable. This could have a number of use-cases, primarily in the
CommandListener#onCommand
method, where a developer could do pre-command checks, and cancel the command execution if needed.I mainly opened this issue to ask for some advice first, because in my mind this should be a reasonably simple modification to JDA-Utilities that I should be able to contribute, but if there are any problems or difficulties that I have overlooked, please tell me so.