Class CommandSettings


  • public final class CommandSettings
    extends java.lang.Object
    Represents a bunch of settings for the manager and for the command.
    • Constructor Summary

      Constructors 
      Constructor Description
      CommandSettings()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static CommandSettings defaultSettings()
      Returns the default settings object
      @Nullable net.dv8tion.jda.api.entities.TextChannel getCommandExecuteChannel()
      Returns the channel, where commands should be executed.
      int getCommandsPerHelpPage()
      Returns the commands, listed per page on help command.
      @NotNull java.util.function.Supplier<net.dv8tion.jda.api.EmbedBuilder> getErrorEmbed()
      Returns the error embed.
      @NotNull java.util.concurrent.ScheduledExecutorService getExecutorService()
      Returns a ScheduledExecutorService.
      @Nullable FailReasonHandler getFailReasonHandler()
      Returns the fail reason handler.
      @Nullable java.util.function.Supplier<net.dv8tion.jda.api.EmbedBuilder> getHelpCommandEmbed()
      Returns the embed for the help command.
      @NotNull java.util.function.Supplier<net.dv8tion.jda.api.EmbedBuilder> getNoPermissionEmbed()
      Returns the no permission embed.
      @Nullable java.util.function.Supplier<net.dv8tion.jda.api.EmbedBuilder> getPrefixCommandEmbed()
      Returns the prefix command embed.
      @NotNull PrefixHandler getPrefixHandler()
      Returns the prefix handler.
      @NotNull java.util.function.Supplier<net.dv8tion.jda.api.EmbedBuilder> getSuccessEmbed()
      Returns the success embed
      @NotNull Translations getTranslations()
      Returns the translations for messages.
      boolean isAllowDMSCommands()
      Returns whenever the framework should allow commands to be executed not only in guilds, but also DMs
      boolean isEnableHelpCommand()
      Returns whenever the help command is being enabled.
      boolean isEnableMentionInsteadPrefix()
      Returns whenever the bot mention can be used instead of a prefix to run a command.
      boolean isEnablePrefixCommand()
      Returns whenever the in bundled prefix command is being enabled.
      boolean isLogExecutedCommands()
      Should the framework log executed commands
      void setAllowDMSCommands​(boolean allowDMSCommands)
      Sets whenever the framework should allow commands to be executed not only in guilds, but also DMs
      void setCommandExecuteChannel​(@Nullable net.dv8tion.jda.api.entities.TextChannel channel)
      Sets the channel where commands should be executed.
      void setCommandsPerHelpPage​(int commandsPerHelpPage)
      Sets how much commands should be listed per page on help command.
      void setEnableHelpCommand​(boolean enableHelpCommand)
      Sets the help command enabled state.
      void setEnableMentionInsteadPrefix​(boolean enableMentionInsteadPrefix)
      Sets whenever the bot mention can be used instead of a prefix to run a command.
      void setEnablePrefixCommand​(boolean enablePrefixCommand)
      Sets if the prefix command is enabled.
      void setErrorEmbed​(@NotNull java.util.function.Supplier<net.dv8tion.jda.api.EmbedBuilder> errorEmbed)
      Sets the error embed
      void setExecutorService​(@NotNull java.util.concurrent.ScheduledExecutorService executorService)
      Sets a new executor service.
      void setFailReasonHandler​(@Nullable FailReasonHandler failReasonHandler)
      Sets a new fail reason handler.
      void setHelpCommandEmbed​(@Nullable java.util.function.Supplier<net.dv8tion.jda.api.EmbedBuilder> helpCommandEmbed)
      Sets the help command embed.
      void setLogExecutedCommands​(boolean logExecutedCommands)
      Sets whenever the framework should log executed commands
      void setNoPermissionEmbed​(@NotNull java.util.function.Supplier<net.dv8tion.jda.api.EmbedBuilder> noPermissionEmbed)
      Sets the no permission embed.
      void setPrefixCommandEmbed​(@Nullable java.util.function.Supplier<net.dv8tion.jda.api.EmbedBuilder> prefixCommandEmbed)
      Sets the prefix command embed
      void setPrefixHandler​(@NotNull PrefixHandler prefixHandler)
      Sets a new prefix handler
      void setSuccessEmbed​(@NotNull java.util.function.Supplier<net.dv8tion.jda.api.EmbedBuilder> successEmbed)
      Sets the success embed.
      void setTranslations​(@NotNull Translations translations)
      Sets new translations for messages
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CommandSettings

        public CommandSettings()
    • Method Detail

      • defaultSettings

        public static CommandSettings defaultSettings()
        Returns the default settings object
        Returns:
        default settings
      • getPrefixHandler

        @NotNull
        public @NotNull PrefixHandler getPrefixHandler()
        Returns the prefix handler.
        Returns:
        prefix handler
      • setPrefixHandler

        public void setPrefixHandler​(@NotNull
                                     @NotNull PrefixHandler prefixHandler)
        Sets a new prefix handler
        Parameters:
        prefixHandler - new prefix handler
      • isEnableHelpCommand

        public boolean isEnableHelpCommand()
        Returns whenever the help command is being enabled.
        Returns:
        true or false
      • setEnableHelpCommand

        public void setEnableHelpCommand​(boolean enableHelpCommand)
        Sets the help command enabled state. You should have on all of your commands the CommandDescription and CommandUsage annotations, or else the commands that don't have them won't be listed in the help.
        Parameters:
        enableHelpCommand - value
      • isEnableMentionInsteadPrefix

        public boolean isEnableMentionInsteadPrefix()
        Returns whenever the bot mention can be used instead of a prefix to run a command.
        Returns:
        true or false
      • setEnableMentionInsteadPrefix

        public void setEnableMentionInsteadPrefix​(boolean enableMentionInsteadPrefix)
        Sets whenever the bot mention can be used instead of a prefix to run a command.
        Parameters:
        enableMentionInsteadPrefix - value
      • isEnablePrefixCommand

        public boolean isEnablePrefixCommand()
        Returns whenever the in bundled prefix command is being enabled.
        Returns:
        value
      • setEnablePrefixCommand

        public void setEnablePrefixCommand​(boolean enablePrefixCommand)
        Sets if the prefix command is enabled. You may also set the prefix command embed.
        Parameters:
        enablePrefixCommand - value
      • getExecutorService

        @NotNull
        public @NotNull java.util.concurrent.ScheduledExecutorService getExecutorService()
        Returns a ScheduledExecutorService. You are not forced to set it if you're gonna use a custom prefix handler as on current version (1.0.0) the only use is prefix saving to file.
        Returns:
        executor
      • setExecutorService

        public void setExecutorService​(@NotNull
                                       @NotNull java.util.concurrent.ScheduledExecutorService executorService)
        Sets a new executor service.
        Parameters:
        executorService - executor
      • getHelpCommandEmbed

        @Nullable
        public @Nullable java.util.function.Supplier<net.dv8tion.jda.api.EmbedBuilder> getHelpCommandEmbed()
        Returns the embed for the help command. You can set the title, color and footer, if other stuff are being modified the command will automatically override them. You are not forced to set it if you're not gonna use the bundled help command.
        Returns:
        embed for help command
      • setHelpCommandEmbed

        public void setHelpCommandEmbed​(@Nullable
                                        @Nullable java.util.function.Supplier<net.dv8tion.jda.api.EmbedBuilder> helpCommandEmbed)
        Sets the help command embed.
        Parameters:
        helpCommandEmbed - help command embed
      • getCommandsPerHelpPage

        public int getCommandsPerHelpPage()
        Returns the commands, listed per page on help command.
        Returns:
        number
      • setCommandsPerHelpPage

        public void setCommandsPerHelpPage​(int commandsPerHelpPage)
        Sets how much commands should be listed per page on help command. You are not forced to set it if you're not using the inbuilt help command.
        Parameters:
        commandsPerHelpPage - number
      • getNoPermissionEmbed

        @NotNull
        public @NotNull java.util.function.Supplier<net.dv8tion.jda.api.EmbedBuilder> getNoPermissionEmbed()
        Returns the no permission embed.
        Returns:
        no permission embed
      • setNoPermissionEmbed

        public void setNoPermissionEmbed​(@NotNull
                                         @NotNull java.util.function.Supplier<net.dv8tion.jda.api.EmbedBuilder> noPermissionEmbed)
        Sets the no permission embed.
        Parameters:
        noPermissionEmbed - no permission embed
      • getPrefixCommandEmbed

        @Nullable
        public @Nullable java.util.function.Supplier<net.dv8tion.jda.api.EmbedBuilder> getPrefixCommandEmbed()
        Returns the prefix command embed. You are not forced to set it if you're not going to use the bundled prefix command.
        Returns:
        prefix embed
      • setPrefixCommandEmbed

        public void setPrefixCommandEmbed​(@Nullable
                                          @Nullable java.util.function.Supplier<net.dv8tion.jda.api.EmbedBuilder> prefixCommandEmbed)
        Sets the prefix command embed
        Parameters:
        prefixCommandEmbed - embed
      • getErrorEmbed

        @NotNull
        public @NotNull java.util.function.Supplier<net.dv8tion.jda.api.EmbedBuilder> getErrorEmbed()
        Returns the error embed.
        Returns:
        error embed
      • setErrorEmbed

        public void setErrorEmbed​(@NotNull
                                  @NotNull java.util.function.Supplier<net.dv8tion.jda.api.EmbedBuilder> errorEmbed)
        Sets the error embed
        Parameters:
        errorEmbed - embed
      • getSuccessEmbed

        @NotNull
        public @NotNull java.util.function.Supplier<net.dv8tion.jda.api.EmbedBuilder> getSuccessEmbed()
        Returns the success embed
        Returns:
        success embed
      • setSuccessEmbed

        public void setSuccessEmbed​(@NotNull
                                    @NotNull java.util.function.Supplier<net.dv8tion.jda.api.EmbedBuilder> successEmbed)
        Sets the success embed. Usage is being in the "prefix set" command.
        Parameters:
        successEmbed - embed
      • getCommandExecuteChannel

        @Nullable
        public @Nullable net.dv8tion.jda.api.entities.TextChannel getCommandExecuteChannel()
        Returns the channel, where commands should be executed. If null, commands can be executed anywhere.
        Returns:
        channel
      • setCommandExecuteChannel

        public void setCommandExecuteChannel​(@Nullable
                                             @Nullable net.dv8tion.jda.api.entities.TextChannel channel)
        Sets the channel where commands should be executed.
        Parameters:
        channel - the channel where you want only commands to be executed
      • getTranslations

        @NotNull
        public @NotNull Translations getTranslations()
        Returns the translations for messages.
        Returns:
        translations
      • setTranslations

        public void setTranslations​(@NotNull
                                    @NotNull Translations translations)
        Sets new translations for messages
        Parameters:
        translations - new translations
      • isLogExecutedCommands

        public boolean isLogExecutedCommands()
        Should the framework log executed commands
        Returns:
        true if we should, false otherwise
      • setLogExecutedCommands

        public void setLogExecutedCommands​(boolean logExecutedCommands)
        Sets whenever the framework should log executed commands
        Parameters:
        logExecutedCommands - value
      • isAllowDMSCommands

        public boolean isAllowDMSCommands()
        Returns whenever the framework should allow commands to be executed not only in guilds, but also DMs
        Returns:
        true if should allow, false otherwise
      • setAllowDMSCommands

        public void setAllowDMSCommands​(boolean allowDMSCommands)
        Sets whenever the framework should allow commands to be executed not only in guilds, but also DMs
        Parameters:
        allowDMSCommands - value
      • getFailReasonHandler

        @Nullable
        public @Nullable FailReasonHandler getFailReasonHandler()
        Returns the fail reason handler.
        Returns:
        fail reason handler.
        See Also:
        FailReasonHandler
      • setFailReasonHandler

        public void setFailReasonHandler​(@Nullable
                                         @Nullable FailReasonHandler failReasonHandler)
        Sets a new fail reason handler.
        Parameters:
        failReasonHandler - fail reason handler
        See Also:
        FailReasonHandler