Class CmdHandlerBuilder


  • public class CmdHandlerBuilder
    extends Object
    The main handler class, this is the manager for starting all the backend garbage.
    Author:
    Jeffrey Morris
    • Constructor Detail

      • CmdHandlerBuilder

        public CmdHandlerBuilder​(org.javacord.api.DiscordApi api,
                                 String prefix)
        Creates a new CmdHandlerBuilder object
        Parameters:
        api - the discord api of your bot
        prefix - the prefix to use for text commands.
    • Method Detail

      • addTextCommand

        public CmdHandlerBuilder addTextCommand​(String keyword,
                                                String[] keywordAliases,
                                                String description,
                                                String usage,
                                                CmdExecutor executor)
        Adds a text command to the handler. This command is not activated until you call build()
        Parameters:
        keyword - the keyword that triggers the command
        keywordAliases - aliases for the keyword
        description - the description of the command
        usage - the usage of the command
        executor - the command itself
        Returns:
        this builder
      • addSlashCommand

        public CmdHandlerBuilder addSlashCommand​(String name,
                                                 String description,
                                                 List<org.javacord.api.interaction.SlashCommandOption> options,
                                                 List<org.javacord.api.interaction.SlashCommandPermissions> permissions,
                                                 org.javacord.api.entity.server.Server server,
                                                 CmdExecutor executor)
        Adds a slash command to the handler. This command is not activated until you call build()
        Parameters:
        name - the name of the command
        description - the description of the command
        options - the options of the command
        permissions - the permissions of the command
        server - the server the command is for
        executor - the command itself
        Returns:
        this builder
      • build

        public void build()
        Builds the handler and activates all the commands.
      • getPrefix

        public String getPrefix()
        Returns:
        the prefix that the command handler is looking for when activating text commands.