Package xyz.dynxsty.dih4jda
Class InteractionHandler
java.lang.Object
net.dv8tion.jda.api.hooks.ListenerAdapter
xyz.dynxsty.dih4jda.InteractionHandler
- All Implemented Interfaces:
net.dv8tion.jda.api.hooks.EventListener
public class InteractionHandler
extends net.dv8tion.jda.api.hooks.ListenerAdapter
Handler class, that finds, registers and handles all Application Commands and their components.
-
Method Summary
Modifier and TypeMethodDescriptionReturns an unmodifiable Map of all retrieved (and/or queued) commands, where the key is the commands' name and the value theCommandinstance itself.voidonButtonInteraction(net.dv8tion.jda.api.events.interaction.component.ButtonInteractionEvent event) Fired if Discord reports aButtonInteractionEvent.voidonCommandAutoCompleteInteraction(net.dv8tion.jda.api.events.interaction.command.CommandAutoCompleteInteractionEvent event) Fired if Discord reports aCommandAutoCompleteInteractionEvent.voidonEntitySelectInteraction(net.dv8tion.jda.api.events.interaction.component.EntitySelectInteractionEvent event) voidonMessageContextInteraction(net.dv8tion.jda.api.events.interaction.command.MessageContextInteractionEvent event) Fired if Discord reports aMessageContextInteractionEvent.voidonModalInteraction(net.dv8tion.jda.api.events.interaction.ModalInteractionEvent event) Fired if Discord reports aModalInteractionEvent.voidonSlashCommandInteraction(net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent event) Fired if Discord reports aSlashCommandInteractionEvent.voidonStringSelectInteraction(net.dv8tion.jda.api.events.interaction.component.StringSelectInteractionEvent event) Fired if Discord reports aStringSelectInteractionEvent.voidonUserContextInteraction(net.dv8tion.jda.api.events.interaction.command.UserContextInteractionEvent event) Fired if Discord reports aUserContextInteractionEvent.voidRegisters all interactions.Methods inherited from class net.dv8tion.jda.api.hooks.ListenerAdapter
onApplicationCommandUpdatePrivileges, onApplicationUpdatePrivileges, onChannelCreate, onChannelDelete, onChannelUpdateAppliedTags, onChannelUpdateArchived, onChannelUpdateArchiveTimestamp, onChannelUpdateAutoArchiveDuration, onChannelUpdateBitrate, onChannelUpdateDefaultReaction, onChannelUpdateDefaultThreadSlowmode, onChannelUpdateFlags, onChannelUpdateInvitable, onChannelUpdateLocked, onChannelUpdateName, onChannelUpdateNSFW, onChannelUpdateParent, onChannelUpdatePosition, onChannelUpdateRegion, onChannelUpdateSlowmode, onChannelUpdateTopic, onChannelUpdateType, onChannelUpdateUserLimit, onEmojiAdded, onEmojiRemoved, onEmojiUpdateName, onEmojiUpdateRoles, onEvent, onException, onForumTagAdd, onForumTagRemove, onForumTagUpdateEmoji, onForumTagUpdateModerated, onForumTagUpdateName, onGatewayPing, onGenericAutoCompleteInteraction, onGenericChannel, onGenericChannelUpdate, onGenericCommandInteraction, onGenericComponentInteractionCreate, onGenericContextInteraction, onGenericEmoji, onGenericEmojiUpdate, onGenericEvent, onGenericForumTag, onGenericForumTagUpdate, onGenericGuild, onGenericGuildInvite, onGenericGuildMember, onGenericGuildMemberUpdate, onGenericGuildSticker, onGenericGuildStickerUpdate, onGenericGuildUpdate, onGenericGuildVoice, onGenericInteractionCreate, onGenericMessage, onGenericMessageReaction, onGenericPermissionOverride, onGenericPrivilegeUpdate, onGenericRole, onGenericRoleUpdate, onGenericScheduledEventUpdate, onGenericSelectMenuInteraction, onGenericSelfUpdate, onGenericSessionEvent, onGenericStageInstance, onGenericStageInstanceUpdate, onGenericThread, onGenericThreadMember, onGenericUpdate, onGenericUser, onGenericUserPresence, onGuildAvailable, onGuildBan, onGuildInviteCreate, onGuildInviteDelete, onGuildJoin, onGuildLeave, onGuildMemberJoin, onGuildMemberRemove, onGuildMemberRoleAdd, onGuildMemberRoleRemove, onGuildMemberUpdate, onGuildMemberUpdateAvatar, onGuildMemberUpdateBoostTime, onGuildMemberUpdateNickname, onGuildMemberUpdatePending, onGuildMemberUpdateTimeOut, onGuildReady, onGuildStickerAdded, onGuildStickerRemoved, onGuildStickerUpdateAvailable, onGuildStickerUpdateDescription, onGuildStickerUpdateName, onGuildStickerUpdateTags, onGuildTimeout, onGuildUnavailable, onGuildUnban, onGuildUpdateAfkChannel, onGuildUpdateAfkTimeout, onGuildUpdateBanner, onGuildUpdateBoostCount, onGuildUpdateBoostTier, onGuildUpdateCommunityUpdatesChannel, onGuildUpdateDescription, onGuildUpdateExplicitContentLevel, onGuildUpdateFeatures, onGuildUpdateIcon, onGuildUpdateLocale, onGuildUpdateMaxMembers, onGuildUpdateMaxPresences, onGuildUpdateMFALevel, onGuildUpdateName, onGuildUpdateNotificationLevel, onGuildUpdateNSFWLevel, onGuildUpdateOwner, onGuildUpdateRulesChannel, onGuildUpdateSplash, onGuildUpdateSystemChannel, onGuildUpdateVanityCode, onGuildUpdateVerificationLevel, onGuildVoiceDeafen, onGuildVoiceGuildDeafen, onGuildVoiceGuildMute, onGuildVoiceMute, onGuildVoiceRequestToSpeak, onGuildVoiceSelfDeafen, onGuildVoiceSelfMute, onGuildVoiceStream, onGuildVoiceSuppress, onGuildVoiceUpdate, onGuildVoiceVideo, onHttpRequest, onMessageBulkDelete, onMessageDelete, onMessageEmbed, onMessageReactionAdd, onMessageReactionRemove, onMessageReactionRemoveAll, onMessageReactionRemoveEmoji, onMessageReceived, onMessageUpdate, onPermissionOverrideCreate, onPermissionOverrideDelete, onPermissionOverrideUpdate, onRawGateway, onReady, onRoleCreate, onRoleDelete, onRoleUpdateColor, onRoleUpdateHoisted, onRoleUpdateIcon, onRoleUpdateMentionable, onRoleUpdateName, onRoleUpdatePermissions, onRoleUpdatePosition, onScheduledEventCreate, onScheduledEventDelete, onScheduledEventUpdateDescription, onScheduledEventUpdateEndTime, onScheduledEventUpdateLocation, onScheduledEventUpdateName, onScheduledEventUpdateStartTime, onScheduledEventUpdateStatus, onScheduledEventUserAdd, onScheduledEventUserRemove, onSelfUpdateAvatar, onSelfUpdateMFA, onSelfUpdateName, onSelfUpdateVerified, onSessionDisconnect, onSessionInvalidate, onSessionRecreate, onSessionResume, onShutdown, onStageInstanceCreate, onStageInstanceDelete, onStageInstanceUpdatePrivacyLevel, onStageInstanceUpdateTopic, onStatusChange, onThreadHidden, onThreadMemberJoin, onThreadMemberLeave, onThreadRevealed, onUnavailableGuildJoined, onUnavailableGuildLeave, onUserActivityEnd, onUserActivityStart, onUserTyping, onUserUpdateActivities, onUserUpdateActivityOrder, onUserUpdateAvatar, onUserUpdateDiscriminator, onUserUpdateFlags, onUserUpdateName, onUserUpdateOnlineStatus
-
Method Details
-
getRetrievedCommands
@Nonnull public static Map<String,net.dv8tion.jda.api.interactions.commands.Command> getRetrievedCommands()Returns an unmodifiable Map of all retrieved (and/or queued) commands, where the key is the commands' name and the value theCommandinstance itself. This map is empty ifDIH4JDA.registerInteractions()wasn't called before.- Returns:
- An immutable
Mapcontaining all global and guild commands.
-
registerInteractions
public void registerInteractions()Registers all interactions. This method can be accessed from theDIH4JDAinstance.
This is automatically executed each time theListenerAdapter.onReady(net.dv8tion.jda.api.events.session.ReadyEvent)event is executed. (can be disabled usingDIH4JDABuilder.disableAutomaticCommandRegistration()) -
onSlashCommandInteraction
public void onSlashCommandInteraction(@Nonnull net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent event) Fired if Discord reports aSlashCommandInteractionEvent.- Overrides:
onSlashCommandInteractionin classnet.dv8tion.jda.api.hooks.ListenerAdapter- Parameters:
event- TheSlashCommandInteractionEventthat was fired.
-
onUserContextInteraction
public void onUserContextInteraction(@Nonnull net.dv8tion.jda.api.events.interaction.command.UserContextInteractionEvent event) Fired if Discord reports aUserContextInteractionEvent.- Overrides:
onUserContextInteractionin classnet.dv8tion.jda.api.hooks.ListenerAdapter- Parameters:
event- TheUserContextInteractionEventthat was fired.
-
onMessageContextInteraction
public void onMessageContextInteraction(@Nonnull net.dv8tion.jda.api.events.interaction.command.MessageContextInteractionEvent event) Fired if Discord reports aMessageContextInteractionEvent.- Overrides:
onMessageContextInteractionin classnet.dv8tion.jda.api.hooks.ListenerAdapter- Parameters:
event- TheMessageContextInteractionEventthat was fired.
-
onCommandAutoCompleteInteraction
public void onCommandAutoCompleteInteraction(@Nonnull net.dv8tion.jda.api.events.interaction.command.CommandAutoCompleteInteractionEvent event) Fired if Discord reports aCommandAutoCompleteInteractionEvent.- Overrides:
onCommandAutoCompleteInteractionin classnet.dv8tion.jda.api.hooks.ListenerAdapter- Parameters:
event- TheCommandAutoCompleteInteractionEventthat was fired.
-
onButtonInteraction
public void onButtonInteraction(@Nonnull net.dv8tion.jda.api.events.interaction.component.ButtonInteractionEvent event) Fired if Discord reports aButtonInteractionEvent.- Overrides:
onButtonInteractionin classnet.dv8tion.jda.api.hooks.ListenerAdapter- Parameters:
event- TheButtonInteractionEventthat was fired.
-
onStringSelectInteraction
public void onStringSelectInteraction(@Nonnull net.dv8tion.jda.api.events.interaction.component.StringSelectInteractionEvent event) Fired if Discord reports aStringSelectInteractionEvent.- Overrides:
onStringSelectInteractionin classnet.dv8tion.jda.api.hooks.ListenerAdapter- Parameters:
event- TheStringSelectInteractionEventthat was fired.
-
onEntitySelectInteraction
public void onEntitySelectInteraction(@Nonnull net.dv8tion.jda.api.events.interaction.component.EntitySelectInteractionEvent event) - Overrides:
onEntitySelectInteractionin classnet.dv8tion.jda.api.hooks.ListenerAdapter
-
onModalInteraction
public void onModalInteraction(@Nonnull net.dv8tion.jda.api.events.interaction.ModalInteractionEvent event) Fired if Discord reports aModalInteractionEvent.- Overrides:
onModalInteractionin classnet.dv8tion.jda.api.hooks.ListenerAdapter- Parameters:
event- TheModalInteractionEventthat was fired.
-