Class ModernBaseCommand

java.lang.Object
com.dianxin.tori.api.commands.slash.ModernBaseCommand
All Implemented Interfaces:
ISlashCommand

@ReleasedSince("26.4.231") public abstract class ModernBaseCommand extends Object implements ISlashCommand
The modern, annotation-driven base class for all slash commands. Developers can use annotations like @GuildOnly or @RequirePermissions on subclasses to dynamically enforce execution rules.
  • Constructor Details

    • ModernBaseCommand

      public ModernBaseCommand(JDA jda, IBotMeta meta)
      Constructs a new ModernBaseCommand.
      Parameters:
      jda - The JDA instance running this command.
      meta - The IBotMeta containing the bot's metadata.
  • Method Details

    • getLogger

      protected org.slf4j.Logger getLogger()
      Returns:
      The logger instance for the current command.
    • getJda

      protected JDA getJda()
      Returns:
      The JDA instance associated with this command.
    • handle

      public final void handle(SlashCommandInteractionEvent event, CommandReplyConfig replyConfig)
      Handles the lifecycle and validation of the command execution. Parses the command's class annotations to enforce restrictions before delegating to execute(SlashCommandInteractionEvent).
      Specified by:
      handle in interface ISlashCommand
      Parameters:
      event - The SlashCommandInteractionEvent triggered by Discord.
      replyConfig - The configuration used for custom error/rejection messages.
    • execute

      protected abstract void execute(SlashCommandInteractionEvent event)
      The core execution logic of the command. Developers must implement this method to define what the command actually does.
      Parameters:
      event - The valid SlashCommandInteractionEvent passed through all pre-checks.