-
-
Notifications
You must be signed in to change notification settings - Fork 28
Description
Issue Checklist
- I have checked for similar issues on the Issue tracker
- I have updated to the latest version of JDA-Chewtils.
- I have checked the branches or the maintainer's PRs for upcoming features and updates.
Affected Modules
Command
Description
It would be useful, if there was a sort of SlashCommandPreProcess method or alike that would allow me (and probably many others) to do the most common checks on a slash command such as if it was from a guild.
What could be somewhat problematic is to decide how stuff is returned... Should it stay a SlashCommandEvent, or should it already be handled (deferReply()?) and then the InteractionHook returned?
I personally would find it cool, if we could "override" the default execute method to have our own instead.
To explain what I mean with that, I want to quickly show an example of what I'm currently using in my bot with message-based commands.
I'm using a different library for those commands called JDA-Command, which provides and uses an interface called AbstractCommand<T>. Since my commands are always with JDA Message objects and only work in Guilds did I "override" it by extending a Command interface I made with it to then override the method with my own:
https://github.com/purrbot-site/PurrBot/blob/2f44f14757bbbd6d82ca29bffa41bb53d42da232/src/main/java/site/purrbot/bot/commands/Command.java
This basically allowed me to reduce commonly made checks and actions and have a bit more safety about things (i.e. that Guild and Member are always present)
Having a similar way in Chewtils would help a lot, because then I could check if the command is from a Guild, obtain user/member and the textchannel instance and if they are null return an error before processing it further...
I hope you get what I mean... I'm not the best at explaining stuff...