Class CommandHandler

java.lang.Object
org.prithvidiamond1.CommandHandler
All Implemented Interfaces:
org.javacord.api.listener.channel.group.GroupChannelAttachableListener, org.javacord.api.listener.channel.server.text.ServerTextChannelAttachableListener, org.javacord.api.listener.channel.TextChannelAttachableListener, org.javacord.api.listener.channel.user.PrivateChannelAttachableListener, org.javacord.api.listener.GloballyAttachableListener, org.javacord.api.listener.interaction.SlashCommandCreateListener, org.javacord.api.listener.message.MessageCreateListener, org.javacord.api.listener.ObjectAttachableListener, org.javacord.api.listener.server.ServerAttachableListener, org.javacord.api.listener.user.UserAttachableListener, org.javacord.api.listener.webhook.WebhookAttachableListener

@Component public class CommandHandler extends Object implements org.javacord.api.listener.message.MessageCreateListener, org.javacord.api.listener.interaction.SlashCommandCreateListener
Class that contains methods and fields for handling command calls
  • Constructor Details

    • CommandHandler

      public CommandHandler()
  • Method Details

    • registerCommand

      public org.javacord.api.interaction.SlashCommandBuilder registerCommand(String name, String description, Command command)
      Method to register a command
      Parameters:
      name - the name of the command
      description - the description of the command
      command - the command's instance
      Returns:
      a SlashCommandBuilder which can customized using the org.prithvidiamond1.SlashCommandCustomizers
    • onSlashCommandCreate

      public void onSlashCommandCreate(org.javacord.api.event.interaction.SlashCommandCreateEvent event)
      Method that runs a command as a slash command upon receiving its call
      Specified by:
      onSlashCommandCreate in interface org.javacord.api.listener.interaction.SlashCommandCreateListener
      Parameters:
      event - the slash command trigger event
    • onMessageCreate

      public void onMessageCreate(org.javacord.api.event.message.MessageCreateEvent event)
      Method that runs a command as a guild command upon receiving its call
      Specified by:
      onMessageCreate in interface org.javacord.api.listener.message.MessageCreateListener
      Parameters:
      event - the guild command trigger event
    • generateHelpDescription

      public static String generateHelpDescription(String commandPrefix)
      Method that generates a help command description based on the descriptions given to each command
      Parameters:
      commandPrefix - the guild prefix for the commands
      Returns:
      a string that can be used as a help command embed description