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 Summary
ConstructorsConstructorDescriptionModernBaseCommand(JDA jda, IBotMeta meta) Constructs a new ModernBaseCommand. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract voidThe core execution logic of the command.protected JDAgetJda()protected org.slf4j.Loggerfinal voidhandle(SlashCommandInteractionEvent event, CommandReplyConfig replyConfig) Handles the lifecycle and validation of the command execution.
-
Constructor Details
-
Method Details
-
getLogger
protected org.slf4j.Logger getLogger()- Returns:
- The logger instance for the current command.
-
getJda
- Returns:
- The JDA instance associated with this command.
-
handle
Handles the lifecycle and validation of the command execution. Parses the command's class annotations to enforce restrictions before delegating toexecute(SlashCommandInteractionEvent).- Specified by:
handlein interfaceISlashCommand- Parameters:
event- TheSlashCommandInteractionEventtriggered by Discord.replyConfig- The configuration used for custom error/rejection messages.
-
execute
The core execution logic of the command. Developers must implement this method to define what the command actually does.- Parameters:
event- The validSlashCommandInteractionEventpassed through all pre-checks.
-