Interface PrefixHandler

    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      static @NotNull PrefixHandler defaultHandler​(@NotNull com.fasterxml.jackson.databind.ObjectMapper jsonMapper)
      Default implementation of a prefix handler, using json file as a long term storage.
      @NotNull java.lang.String getDefaultPrefix()
      Returns the default command prefix of the bot.
      @Nullable java.lang.String getGuildPrefix​(long guildId)
      Returns the prefix, which belongs to the specified guild id.
      default @NotNull java.lang.String getPrefix​(long guildId)
      Returns a usable command prefix.
      default @NotNull java.lang.String getPrefix​(net.dv8tion.jda.api.entities.User user)
      Gets the prefix of which the bot is going to listen for commands in DMs of this user.
      void savePrefixes()
      Saves the prefixes
      void setDefaultPrefix​(@NotNull java.lang.String defaultPrefix)
      Sets a new default prefix of the bot.
      void setGuildPrefix​(@NotNull java.lang.String prefix, long guildId)
      Sets a new guild prefix.
    • Method Detail

      • defaultHandler

        @NotNull
        static @NotNull PrefixHandler defaultHandler​(@NotNull
                                                     @NotNull com.fasterxml.jackson.databind.ObjectMapper jsonMapper)
        Default implementation of a prefix handler, using json file as a long term storage.
        Parameters:
        jsonMapper - jackson object mapper
        Returns:
        non null default prefix handler
      • getDefaultPrefix

        @NotNull
        @NotNull java.lang.String getDefaultPrefix()
        Returns the default command prefix of the bot.
        Returns:
        default prefix
      • setDefaultPrefix

        void setDefaultPrefix​(@NotNull
                              @NotNull java.lang.String defaultPrefix)
        Sets a new default prefix of the bot.
        Parameters:
        defaultPrefix - prefix
      • getGuildPrefix

        @Nullable
        @Nullable java.lang.String getGuildPrefix​(long guildId)
        Returns the prefix, which belongs to the specified guild id.
        Parameters:
        guildId - the guild id
        Returns:
        guild prefix
      • setGuildPrefix

        void setGuildPrefix​(@NotNull
                            @NotNull java.lang.String prefix,
                            long guildId)
        Sets a new guild prefix.
        Parameters:
        prefix - the prefix you want to set
        guildId - the guild id for which you want to set the prefix
      • savePrefixes

        void savePrefixes()
        Saves the prefixes
      • getPrefix

        @NotNull
        default @NotNull java.lang.String getPrefix​(long guildId)
        Returns a usable command prefix.
        Parameters:
        guildId - the guild of which we want to get the prefix
        Returns:
        guild prefix if found, else the default one
      • getPrefix

        @NotNull
        default @NotNull java.lang.String getPrefix​(net.dv8tion.jda.api.entities.User user)
        Gets the prefix of which the bot is going to listen for commands in DMs of this user.
        Parameters:
        user - the user who wants to execute commands in DMs
        Returns:
        prefix of guild