Annotation Interface Subcommand
Defines a subcommand for slash commands.
Example:
@SlashCommand(
name = "config",
description = "Plugin configuration",
subcommands = {
@Subcommand(name = "view", description = "View settings"),
@Subcommand(name = "set", description = "Change setting", options = {
@CommandOption(name = "key", description = "Setting name", required = true),
@CommandOption(name = "value", description = "New value", required = true)
})
}
)
public void config(SlashCommandInteractionEvent event) {
String sub = event.getSubcommandName();
// ...
}
-
Required Element Summary
Required ElementsModifier and TypeRequired ElementDescriptionReturns the description of the subcommand.Returns the name of the subcommand. -
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionReturns the command options associated with this subcommand.
-
Element Details
-
name
-
description
String descriptionReturns the description of the subcommand.- Returns:
- the description of the subcommand as a String
-
options
CommandOption[] optionsReturns the command options associated with this subcommand. These options define the parameters that can be passed to the subcommand.- Returns:
- an array of
CommandOptionannotations representing the options for this subcommand, or an empty array if no options are defined
- Default:
{}
-