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.
- See Also:
-
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 theCommand
instance itself.void
onButtonInteraction
(net.dv8tion.jda.api.events.interaction.component.ButtonInteractionEvent event) Fired if Discord reports aButtonInteractionEvent
.void
onCommandAutoCompleteInteraction
(net.dv8tion.jda.api.events.interaction.command.CommandAutoCompleteInteractionEvent event) Fired if Discord reports aCommandAutoCompleteInteractionEvent
.void
onEntitySelectInteraction
(net.dv8tion.jda.api.events.interaction.component.EntitySelectInteractionEvent event) void
onMessageContextInteraction
(net.dv8tion.jda.api.events.interaction.command.MessageContextInteractionEvent event) Fired if Discord reports aMessageContextInteractionEvent
.void
onModalInteraction
(net.dv8tion.jda.api.events.interaction.ModalInteractionEvent event) Fired if Discord reports aModalInteractionEvent
.void
onSlashCommandInteraction
(net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent event) Fired if Discord reports aSlashCommandInteractionEvent
.void
onStringSelectInteraction
(net.dv8tion.jda.api.events.interaction.component.StringSelectInteractionEvent event) Fired if Discord reports aStringSelectInteractionEvent
.void
onUserContextInteraction
(net.dv8tion.jda.api.events.interaction.command.UserContextInteractionEvent event) Fired if Discord reports aUserContextInteractionEvent
.void
Registers all interactions.Methods inherited from class net.dv8tion.jda.api.hooks.ListenerAdapter
onApplicationCommandUpdatePrivileges, onApplicationUpdatePrivileges, onAutoModExecution, onAutoModRuleCreate, onAutoModRuleDelete, onAutoModRuleUpdate, onChannelCreate, onChannelDelete, onChannelUpdateAppliedTags, onChannelUpdateArchived, onChannelUpdateArchiveTimestamp, onChannelUpdateAutoArchiveDuration, onChannelUpdateBitrate, onChannelUpdateDefaultLayout, onChannelUpdateDefaultReaction, onChannelUpdateDefaultSortOrder, onChannelUpdateDefaultThreadSlowmode, onChannelUpdateFlags, onChannelUpdateInvitable, onChannelUpdateLocked, onChannelUpdateName, onChannelUpdateNSFW, onChannelUpdateParent, onChannelUpdatePosition, onChannelUpdateRegion, onChannelUpdateSlowmode, onChannelUpdateTopic, onChannelUpdateType, onChannelUpdateUserLimit, onChannelUpdateVoiceStatus, onEmojiAdded, onEmojiRemoved, onEmojiUpdateName, onEmojiUpdateRoles, onEntitlementCreate, onEntitlementDelete, onEntitlementUpdate, onEvent, onException, onForumTagAdd, onForumTagRemove, onForumTagUpdateEmoji, onForumTagUpdateModerated, onForumTagUpdateName, onGatewayPing, onGenericAutoCompleteInteraction, onGenericAutoModRule, onGenericChannel, onGenericChannelUpdate, onGenericCommandInteraction, onGenericComponentInteractionCreate, onGenericContextInteraction, onGenericEmoji, onGenericEmojiUpdate, onGenericEntitlement, onGenericEvent, onGenericForumTag, onGenericForumTagUpdate, onGenericGuild, onGenericGuildInvite, onGenericGuildMember, onGenericGuildMemberUpdate, onGenericGuildSticker, onGenericGuildStickerUpdate, onGenericGuildUpdate, onGenericGuildVoice, onGenericInteractionCreate, onGenericMessage, onGenericMessagePollVote, onGenericMessageReaction, onGenericPermissionOverride, onGenericPrivilegeUpdate, onGenericRole, onGenericRoleUpdate, onGenericScheduledEventGateway, onGenericScheduledEventUpdate, onGenericScheduledEventUser, onGenericSelectMenuInteraction, onGenericSelfUpdate, onGenericSession, onGenericStageInstance, onGenericStageInstanceUpdate, onGenericThread, onGenericThreadMember, onGenericUpdate, onGenericUser, onGenericUserPresence, onGenericUserUpdate, onGuildAuditLogEntryCreate, onGuildAvailable, onGuildBan, onGuildInviteCreate, onGuildInviteDelete, onGuildJoin, onGuildLeave, onGuildMemberJoin, onGuildMemberRemove, onGuildMemberRoleAdd, onGuildMemberRoleRemove, onGuildMemberUpdate, onGuildMemberUpdateAvatar, onGuildMemberUpdateBoostTime, onGuildMemberUpdateFlags, 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, onMessagePollVoteAdd, onMessagePollVoteRemove, onMessageReactionAdd, onMessageReactionRemove, onMessageReactionRemoveAll, onMessageReactionRemoveEmoji, onMessageReceived, onMessageUpdate, onPermissionOverrideCreate, onPermissionOverrideDelete, onPermissionOverrideUpdate, onRawGateway, onReady, onRoleCreate, onRoleDelete, onRoleUpdateColor, onRoleUpdateHoisted, onRoleUpdateIcon, onRoleUpdateMentionable, onRoleUpdateName, onRoleUpdatePermissions, onRoleUpdatePosition, onScheduledEventCreate, onScheduledEventDelete, onScheduledEventUpdateDescription, onScheduledEventUpdateEndTime, onScheduledEventUpdateImage, onScheduledEventUpdateLocation, onScheduledEventUpdateName, onScheduledEventUpdateStartTime, onScheduledEventUpdateStatus, onScheduledEventUserAdd, onScheduledEventUserRemove, onSelfUpdateAvatar, onSelfUpdateDiscriminator, onSelfUpdateGlobalName, 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, onUserUpdateGlobalName, 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 theCommand
instance itself. This map is empty ifDIH4JDA.registerInteractions()
wasn't called before.- Returns:
- An immutable
Map
containing all global and guild commands.
-
registerInteractions
public void registerInteractions()Registers all interactions. This method can be accessed from theDIH4JDA
instance.
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:
onSlashCommandInteraction
in classnet.dv8tion.jda.api.hooks.ListenerAdapter
- Parameters:
event
- TheSlashCommandInteractionEvent
that was fired.
-
onUserContextInteraction
public void onUserContextInteraction(@Nonnull net.dv8tion.jda.api.events.interaction.command.UserContextInteractionEvent event) Fired if Discord reports aUserContextInteractionEvent
.- Overrides:
onUserContextInteraction
in classnet.dv8tion.jda.api.hooks.ListenerAdapter
- Parameters:
event
- TheUserContextInteractionEvent
that was fired.
-
onMessageContextInteraction
public void onMessageContextInteraction(@Nonnull net.dv8tion.jda.api.events.interaction.command.MessageContextInteractionEvent event) Fired if Discord reports aMessageContextInteractionEvent
.- Overrides:
onMessageContextInteraction
in classnet.dv8tion.jda.api.hooks.ListenerAdapter
- Parameters:
event
- TheMessageContextInteractionEvent
that was fired.
-
onCommandAutoCompleteInteraction
public void onCommandAutoCompleteInteraction(@Nonnull net.dv8tion.jda.api.events.interaction.command.CommandAutoCompleteInteractionEvent event) Fired if Discord reports aCommandAutoCompleteInteractionEvent
.- Overrides:
onCommandAutoCompleteInteraction
in classnet.dv8tion.jda.api.hooks.ListenerAdapter
- Parameters:
event
- TheCommandAutoCompleteInteractionEvent
that was fired.
-
onButtonInteraction
public void onButtonInteraction(@Nonnull net.dv8tion.jda.api.events.interaction.component.ButtonInteractionEvent event) Fired if Discord reports aButtonInteractionEvent
.- Overrides:
onButtonInteraction
in classnet.dv8tion.jda.api.hooks.ListenerAdapter
- Parameters:
event
- TheButtonInteractionEvent
that was fired.
-
onStringSelectInteraction
public void onStringSelectInteraction(@Nonnull net.dv8tion.jda.api.events.interaction.component.StringSelectInteractionEvent event) Fired if Discord reports aStringSelectInteractionEvent
.- Overrides:
onStringSelectInteraction
in classnet.dv8tion.jda.api.hooks.ListenerAdapter
- Parameters:
event
- TheStringSelectInteractionEvent
that was fired.
-
onEntitySelectInteraction
public void onEntitySelectInteraction(@Nonnull net.dv8tion.jda.api.events.interaction.component.EntitySelectInteractionEvent event) - Overrides:
onEntitySelectInteraction
in 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:
onModalInteraction
in classnet.dv8tion.jda.api.hooks.ListenerAdapter
- Parameters:
event
- TheModalInteractionEvent
that was fired.
-