Class CommandManager

java.lang.Object
de.presti.ree6.commands.CommandManager

public class CommandManager extends Object
Manager class used to manage all Commands and command related operation.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructor for the Command-Manager used to register every Command.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Add a single Command to the Command list.
    void
    addSlashCommand(net.dv8tion.jda.api.JDA jda)
    Method used to add all Commands as SlashCommand on Discord.
    void
    deleteMessage(net.dv8tion.jda.api.entities.Message message, net.dv8tion.jda.api.interactions.InteractionHook interactionHook)
    Delete a specific message.
    Get a Command by its name.
    Get a Command by its slash command name.
    boolean
    isTimeout(net.dv8tion.jda.api.entities.User user)
    Check if a User is time-outed.
    boolean
    perform(net.dv8tion.jda.api.entities.Member member, net.dv8tion.jda.api.entities.Guild guild, String messageContent, net.dv8tion.jda.api.entities.Message message, net.dv8tion.jda.api.entities.channel.unions.MessageChannelUnion textChannel, net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent slashCommandInteractionEvent)
    Try to perform a Command.
    void
    Remove a Command from the List.
    void
    sendMessage(String message, int deleteSecond, net.dv8tion.jda.api.entities.channel.middleman.MessageChannel messageChannel)
    Send a message to a special Message-Channel, with a deletion delay.
    void
    sendMessage(String messageContent, int deleteSecond, net.dv8tion.jda.api.entities.channel.middleman.MessageChannel messageChannel, net.dv8tion.jda.api.interactions.InteractionHook interactionHook)
    Send a message to a special Message-Channel, with a deletion delay.
    void
    sendMessage(String message, net.dv8tion.jda.api.entities.channel.middleman.MessageChannel messageChannel)
    Send a message to a special Message-Channel.
    void
    sendMessage(String message, net.dv8tion.jda.api.entities.channel.middleman.MessageChannel messageChannel, net.dv8tion.jda.api.interactions.InteractionHook interactionHook)
    Send a message to a special Message-Channel.
    void
    sendMessage(net.dv8tion.jda.api.EmbedBuilder embedBuilder, int deleteSecond, net.dv8tion.jda.api.entities.channel.middleman.MessageChannel messageChannel)
    Send an Embed to a special Message-Channel, with a deletion delay.
    void
    sendMessage(net.dv8tion.jda.api.EmbedBuilder embedBuilder, int deleteSecond, net.dv8tion.jda.api.entities.channel.middleman.MessageChannel messageChannel, net.dv8tion.jda.api.interactions.InteractionHook interactionHook)
    Send an Embed to a special Message-Channel, with a deletion delay.
    void
    sendMessage(net.dv8tion.jda.api.EmbedBuilder embedBuilder, net.dv8tion.jda.api.entities.channel.middleman.MessageChannel messageChannel)
    Send an Embed to a special Message-Channel.
    void
    sendMessage(net.dv8tion.jda.api.EmbedBuilder embedBuilder, net.dv8tion.jda.api.entities.channel.middleman.MessageChannel messageChannel, net.dv8tion.jda.api.interactions.InteractionHook interactionHook)
    Send an Embed to a special Message-Channel.
    void
    sendMessage(net.dv8tion.jda.api.utils.messages.MessageCreateData messageCreateData, int deleteSecond, CommandEvent commandEvent)
    Send a message to a special Message-Channel.
    void
    sendMessage(net.dv8tion.jda.api.utils.messages.MessageCreateData messageCreateData, int deleteSecond, net.dv8tion.jda.api.entities.channel.middleman.MessageChannel messageChannel)
    Send a message to a special Message-Channel, with a deletion delay.
    void
    sendMessage(net.dv8tion.jda.api.utils.messages.MessageCreateData messageCreateData, int deleteSecond, net.dv8tion.jda.api.entities.channel.middleman.MessageChannel messageChannel, net.dv8tion.jda.api.interactions.InteractionHook interactionHook)
    Send a message to a special Message-Channel, with a deletion delay.
    void
    sendMessage(net.dv8tion.jda.api.utils.messages.MessageCreateData messageCreateData, CommandEvent commandEvent)
    Send a message to a special Message-Channel.
    void
    sendMessage(net.dv8tion.jda.api.utils.messages.MessageCreateData messageCreateData, net.dv8tion.jda.api.entities.channel.middleman.MessageChannel messageChannel)
    Send a message to a special Message-Channel.
    void
    sendMessage(net.dv8tion.jda.api.utils.messages.MessageCreateData messageCreateData, net.dv8tion.jda.api.entities.channel.middleman.MessageChannel messageChannel, net.dv8tion.jda.api.interactions.InteractionHook interactionHook)
    Send a message to a special Message-Channel.

    Methods inherited from class java.lang.Object

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

  • Method Details

    • addSlashCommand

      public void addSlashCommand(net.dv8tion.jda.api.JDA jda)
      Method used to add all Commands as SlashCommand on Discord.
      Parameters:
      jda - Instance of the Bot.
    • addCommand

      public void addCommand(ICommand command) throws CommandInitializerException
      Add a single Command to the Command list.
      Parameters:
      command - the ICommand.
      Throws:
      CommandInitializerException - if an error occurs while initializing the Command.
    • getCommandByName

      public ICommand getCommandByName(String name)
      Get a Command by its name.
      Parameters:
      name - the Name of the Command.
      Returns:
      the ICommand with the same Name.
    • getCommandBySlashName

      public ICommand getCommandBySlashName(String name)
      Get a Command by its slash command name.
      Parameters:
      name - the Name of the Command.
      Returns:
      the ICommand with the same Name.
    • removeCommand

      public void removeCommand(ICommand command)
      Remove a Command from the List.
      Parameters:
      command - the Command you want to remove.
    • perform

      public boolean perform(net.dv8tion.jda.api.entities.Member member, net.dv8tion.jda.api.entities.Guild guild, String messageContent, net.dv8tion.jda.api.entities.Message message, net.dv8tion.jda.api.entities.channel.unions.MessageChannelUnion textChannel, net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent slashCommandInteractionEvent)
      Try to perform a Command.
      Parameters:
      member - the Member that performed the try.
      guild - the Guild the Member is from.
      messageContent - the Message content (including the prefix + command name).
      message - the Message Entity.
      textChannel - the TextChannel where the command has been performed.
      slashCommandInteractionEvent - the Slash Command Event if it was a Slash Command.
      Returns:
      true, if a command has been performed.
    • isTimeout

      public boolean isTimeout(net.dv8tion.jda.api.entities.User user)
      Check if a User is time-outed.
      Parameters:
      user - the User.
      Returns:
      true, if yes | false, if not.
    • sendMessage

      public void sendMessage(net.dv8tion.jda.api.utils.messages.MessageCreateData messageCreateData, CommandEvent commandEvent)
      Send a message to a special Message-Channel.
      Parameters:
      messageCreateData - the Message content.
      commandEvent - the Command-Event.
    • sendMessage

      public void sendMessage(net.dv8tion.jda.api.utils.messages.MessageCreateData messageCreateData, int deleteSecond, CommandEvent commandEvent)
      Send a message to a special Message-Channel.
      Parameters:
      messageCreateData - the Message content.
      deleteSecond - the delete delay
      commandEvent - the Command-Event.
    • sendMessage

      public void sendMessage(net.dv8tion.jda.api.utils.messages.MessageCreateData messageCreateData, net.dv8tion.jda.api.entities.channel.middleman.MessageChannel messageChannel)
      Send a message to a special Message-Channel.
      Parameters:
      messageCreateData - the Message content.
      messageChannel - the Message-Channel.
    • sendMessage

      public void sendMessage(net.dv8tion.jda.api.utils.messages.MessageCreateData messageCreateData, int deleteSecond, net.dv8tion.jda.api.entities.channel.middleman.MessageChannel messageChannel)
      Send a message to a special Message-Channel, with a deletion delay.
      Parameters:
      messageCreateData - the Message content.
      deleteSecond - the delete delay
      messageChannel - the Message-Channel.
    • sendMessage

      public void sendMessage(net.dv8tion.jda.api.utils.messages.MessageCreateData messageCreateData, net.dv8tion.jda.api.entities.channel.middleman.MessageChannel messageChannel, net.dv8tion.jda.api.interactions.InteractionHook interactionHook)
      Send a message to a special Message-Channel.
      Parameters:
      messageCreateData - the Message content.
      messageChannel - the Message-Channel.
      interactionHook - the Interaction-hook if it is a slash command.
    • sendMessage

      public void sendMessage(net.dv8tion.jda.api.utils.messages.MessageCreateData messageCreateData, int deleteSecond, net.dv8tion.jda.api.entities.channel.middleman.MessageChannel messageChannel, net.dv8tion.jda.api.interactions.InteractionHook interactionHook)
      Send a message to a special Message-Channel, with a deletion delay.
      Parameters:
      messageCreateData - the Message content.
      messageChannel - the Message-Channel.
      interactionHook - the Interaction-hook if it is a slash command.
      deleteSecond - the delete delay
    • sendMessage

      public void sendMessage(String message, net.dv8tion.jda.api.entities.channel.middleman.MessageChannel messageChannel)
      Send a message to a special Message-Channel.
      Parameters:
      message - the Message content.
      messageChannel - the Message-Channel.
    • sendMessage

      public void sendMessage(String message, int deleteSecond, net.dv8tion.jda.api.entities.channel.middleman.MessageChannel messageChannel)
      Send a message to a special Message-Channel, with a deletion delay.
      Parameters:
      message - the Message content.
      deleteSecond - the delete delay
      messageChannel - the Message-Channel.
    • sendMessage

      public void sendMessage(String message, net.dv8tion.jda.api.entities.channel.middleman.MessageChannel messageChannel, net.dv8tion.jda.api.interactions.InteractionHook interactionHook)
      Send a message to a special Message-Channel.
      Parameters:
      message - the Message content.
      messageChannel - the Message-Channel.
      interactionHook - the Interaction-hook if it is a slash command.
    • sendMessage

      public void sendMessage(String messageContent, int deleteSecond, net.dv8tion.jda.api.entities.channel.middleman.MessageChannel messageChannel, net.dv8tion.jda.api.interactions.InteractionHook interactionHook)
      Send a message to a special Message-Channel, with a deletion delay.
      Parameters:
      messageContent - the Message content.
      messageChannel - the Message-Channel.
      interactionHook - the Interaction-hook if it is a slash command.
      deleteSecond - the delete delay
    • sendMessage

      public void sendMessage(net.dv8tion.jda.api.EmbedBuilder embedBuilder, net.dv8tion.jda.api.entities.channel.middleman.MessageChannel messageChannel)
      Send an Embed to a special Message-Channel.
      Parameters:
      embedBuilder - the Embed content.
      messageChannel - the Message-Channel.
    • sendMessage

      public void sendMessage(net.dv8tion.jda.api.EmbedBuilder embedBuilder, int deleteSecond, net.dv8tion.jda.api.entities.channel.middleman.MessageChannel messageChannel)
      Send an Embed to a special Message-Channel, with a deletion delay.
      Parameters:
      embedBuilder - the Embed content.
      deleteSecond - the delete delay
      messageChannel - the Message-Channel.
    • sendMessage

      public void sendMessage(net.dv8tion.jda.api.EmbedBuilder embedBuilder, net.dv8tion.jda.api.entities.channel.middleman.MessageChannel messageChannel, net.dv8tion.jda.api.interactions.InteractionHook interactionHook)
      Send an Embed to a special Message-Channel.
      Parameters:
      embedBuilder - the Embed content.
      messageChannel - the Message-Channel.
      interactionHook - the Interaction-hook if it is a slash command.
    • sendMessage

      public void sendMessage(net.dv8tion.jda.api.EmbedBuilder embedBuilder, int deleteSecond, net.dv8tion.jda.api.entities.channel.middleman.MessageChannel messageChannel, net.dv8tion.jda.api.interactions.InteractionHook interactionHook)
      Send an Embed to a special Message-Channel, with a deletion delay.
      Parameters:
      embedBuilder - the Embed content.
      deleteSecond - the delete delay
      messageChannel - the Message-Channel.
      interactionHook - the Interaction-hook if it is a slash command.
    • deleteMessage

      public void deleteMessage(net.dv8tion.jda.api.entities.Message message, net.dv8tion.jda.api.interactions.InteractionHook interactionHook)
      Delete a specific message.
      Parameters:
      message - the Message entity.
      interactionHook - the Interaction-hook, if it is a slash event.