Package com.yosoyvillaa.vjcommands
Class CommandManager
java.lang.Object
net.dv8tion.jda.api.hooks.ListenerAdapter
com.yosoyvillaa.vjcommands.CommandManager
- All Implemented Interfaces:
net.dv8tion.jda.api.hooks.EventListener
public class CommandManager
extends net.dv8tion.jda.api.hooks.ListenerAdapter
The
CommandManager
is the place where you can manage all you commands.-
Constructor Summary
ConstructorsConstructorDescriptionCommandManager
(net.dv8tion.jda.api.JDA jda, net.dv8tion.jda.api.hooks.IEventManager eventManager) -
Method Summary
Modifier and TypeMethodDescriptionGet all the registered commands.net.dv8tion.jda.api.JDA
getJda()
Gets theJDA
instance associated to thisCommandManager
.Get all the registeredPrefixCommand
.Get all the registeredSlashCommand
.void
onMessageReceived
(net.dv8tion.jda.api.events.message.MessageReceivedEvent event) void
onSlashCommandInteraction
(net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent event) void
registerCommand
(ICommand command) Try to register anICommand
.void
registerCommands
(ICommand... commands) Try to register a list ofICommand
.void
Unregister all registered commands.void
unregisterCommand
(ICommand command) Unregister the givenICommand
.Methods inherited from class net.dv8tion.jda.api.hooks.ListenerAdapter
onApplicationCommandUpdatePrivileges, onApplicationUpdatePrivileges, onButtonInteraction, onChannelCreate, onChannelDelete, onChannelUpdateAppliedTags, onChannelUpdateArchived, onChannelUpdateArchiveTimestamp, onChannelUpdateAutoArchiveDuration, onChannelUpdateBitrate, onChannelUpdateDefaultLayout, onChannelUpdateDefaultReaction, onChannelUpdateDefaultThreadSlowmode, onChannelUpdateFlags, onChannelUpdateInvitable, onChannelUpdateLocked, onChannelUpdateName, onChannelUpdateNSFW, onChannelUpdateParent, onChannelUpdatePosition, onChannelUpdateRegion, onChannelUpdateSlowmode, onChannelUpdateTopic, onChannelUpdateType, onChannelUpdateUserLimit, onCommandAutoCompleteInteraction, onEmojiAdded, onEmojiRemoved, onEmojiUpdateName, onEmojiUpdateRoles, onEntitySelectInteraction, 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, 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, onMessageContextInteraction, onMessageDelete, onMessageEmbed, onMessageReactionAdd, onMessageReactionRemove, onMessageReactionRemoveAll, onMessageReactionRemoveEmoji, onMessageUpdate, onModalInteraction, 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, onStringSelectInteraction, onThreadHidden, onThreadMemberJoin, onThreadMemberLeave, onThreadRevealed, onUnavailableGuildJoined, onUnavailableGuildLeave, onUserActivityEnd, onUserActivityStart, onUserContextInteraction, onUserTyping, onUserUpdateActivities, onUserUpdateActivityOrder, onUserUpdateAvatar, onUserUpdateDiscriminator, onUserUpdateFlags, onUserUpdateName, onUserUpdateOnlineStatus
-
Constructor Details
-
CommandManager
public CommandManager(net.dv8tion.jda.api.JDA jda, net.dv8tion.jda.api.hooks.IEventManager eventManager)
-
-
Method Details
-
getJda
public net.dv8tion.jda.api.JDA getJda()Gets theJDA
instance associated to thisCommandManager
.- Returns:
- The
JDA
instance
-
getCommands
Get all the registered commands.- Returns:
- a set of all the
ICommand
registered
-
getPrefixCommands
Get all the registeredPrefixCommand
.- Returns:
- a set of all the
PrefixCommand
registered
-
getSlashCommands
Get all the registeredSlashCommand
.- Returns:
- a set of all the
SlashCommand
registered
-
registerCommand
Try to register anICommand
.- Parameters:
command
- theICommand
to register- Throws:
IllegalArgumentException
- if the command is already registered
-
registerCommands
Try to register a list ofICommand
.- Parameters:
commands
- theICommand
list to register- Throws:
IllegalArgumentException
- if a command is already registered
-
unregisterCommand
Unregister the givenICommand
.- Parameters:
command
- theICommand
to unregister
-
unregisterAllCommands
public void unregisterAllCommands()Unregister all registered commands. -
onMessageReceived
public void onMessageReceived(@NotNull net.dv8tion.jda.api.events.message.MessageReceivedEvent event) - Overrides:
onMessageReceived
in classnet.dv8tion.jda.api.hooks.ListenerAdapter
-
onSlashCommandInteraction
public void onSlashCommandInteraction(@NotNull net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent event) - Overrides:
onSlashCommandInteraction
in classnet.dv8tion.jda.api.hooks.ListenerAdapter
-