Because this new SlashCommandEvent extends SlashCommandInteractionEvent, all methods work fine. You don't need to change anything!
One thing though, this means event.getClient() works now. Now you no longer need to this.getClient() in your events.
Next, CooldownScope was moved. You simply need to import it for no functionality changes, if you use it.
This PR also adds full support for Context Menus. There is now UserContextMenu and MessageContextMenu classes used just like a Command or SlashCommand, this.name is what shows in the client.
To compensate for variables being used in now, 3 different, branching places, an Interaction class has been created. This class has functionality used in Command, SlashCommand, and now UserContextMenu and MessageContextMenu that does not change between classes. These being, botPermission, userPermission, ownerCommand, as well as cooldown and cooldownScope.
There is a new onAutoComplete(CommandAutoCompleteInteractionEvent event) you can override and it will be executed whenever an auto-complete option is triggered. Here you can reply as you would the execute event.
More to come!
Testing
If you want to help test, use the following repo/dependency information:
Maven stuff, I am not magic enough to convert to gradle
As usual I do not recommend Jitpack since it's a bit messy and confusing. I'll deploy here every commit. I will likely clear the snapshot stuff when this gets merged, however.
Surprisingly not bad (for me)
For y'all, bad news.
SlashCommandEvent
got renamed toSlashCommandInteractionEvent
.NO BIG DEAL! I added it back as a JDA-Chewtils method. However, you will need to reimport the class.
I was able to do a simple find and replace across my project:
Find:
import net.dv8tion.jda.api.events.interaction.SlashCommandEvent;
Replace:import com.jagrosh.jdautilities.command.SlashCommandEvent;
Because this new SlashCommandEvent extends
SlashCommandInteractionEvent
, all methods work fine. You don't need to change anything!One thing though, this means
event.getClient()
works now. Now you no longer need tothis.getClient()
in your events.Next,
CooldownScope
was moved. You simply need to import it for no functionality changes, if you use it.This PR also adds full support for Context Menus. There is now
UserContextMenu
andMessageContextMenu
classes used just like aCommand
orSlashCommand
,this.name
is what shows in the client.To compensate for variables being used in now, 3 different, branching places, an
Interaction
class has been created. This class has functionality used inCommand
,SlashCommand
, and nowUserContextMenu
andMessageContextMenu
that does not change between classes. These being,botPermission
,userPermission
,ownerCommand
, as well ascooldown
andcooldownScope
.There is a new
onAutoComplete(CommandAutoCompleteInteractionEvent event)
you can override and it will be executed whenever anauto-complete
option is triggered. Here you can reply as you would the execute event.More to come!
Testing
If you want to help test, use the following repo/dependency information:
Maven stuff, I am not magic enough to convert to gradle
As usual I do not recommend Jitpack since it's a bit messy and confusing. I'll deploy here every commit. I will likely clear the snapshot stuff when this gets merged, however.