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

    Constructors
    Constructor
    Description
    CommandManager(net.dv8tion.jda.api.JDA jda, net.dv8tion.jda.api.hooks.IEventManager eventManager)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Get all the registered commands.
    net.dv8tion.jda.api.JDA
    Gets the JDA instance associated to this CommandManager.
    Get all the registered PrefixCommand.
    Get all the registered SlashCommand.
    void
    onMessageReceived(net.dv8tion.jda.api.events.message.MessageReceivedEvent event)
     
    void
    onSlashCommandInteraction(net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent event)
     
    void
    Try to register an ICommand.
    void
    Try to register a list of ICommand.
    void
    Unregister all registered commands.
    void
    Unregister the given ICommand.

    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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 the JDA instance associated to this CommandManager.
      Returns:
      The JDA instance
    • getCommands

      public Set<ICommand> getCommands()
      Get all the registered commands.
      Returns:
      a set of all the ICommand registered
    • getPrefixCommands

      public Set<PrefixCommand> getPrefixCommands()
      Get all the registered PrefixCommand.
      Returns:
      a set of all the PrefixCommand registered
    • getSlashCommands

      public Set<SlashCommand> getSlashCommands()
      Get all the registered SlashCommand.
      Returns:
      a set of all the SlashCommand registered
    • registerCommand

      public void registerCommand(ICommand command) throws IllegalArgumentException
      Try to register an ICommand.
      Parameters:
      command - the ICommand to register
      Throws:
      IllegalArgumentException - if the command is already registered
    • registerCommands

      public void registerCommands(ICommand... commands) throws IllegalArgumentException
      Try to register a list of ICommand.
      Parameters:
      commands - the ICommand list to register
      Throws:
      IllegalArgumentException - if a command is already registered
    • unregisterCommand

      public void unregisterCommand(ICommand command)
      Unregister the given ICommand.
      Parameters:
      command - the ICommand 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 class net.dv8tion.jda.api.hooks.ListenerAdapter
    • onSlashCommandInteraction

      public void onSlashCommandInteraction(@NotNull net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent event)
      Overrides:
      onSlashCommandInteraction in class net.dv8tion.jda.api.hooks.ListenerAdapter