Annotation Interface SlashCommand
use this Annotation to define a method as slashCommand, it will automatically get processed and executed whenever called
Example:
SlashCommand(command = "test")
public void testName(SlashCommandInteractionEvent event){
[your code here]
}
MultiArgsExample:
SlashCommand(command = "multiargtest", description = "multiArgTestDescription", options = {
SlashCommandArg(arg = "arg1", description = "arg1Description"),
SlashCommandArg(arg = "arg2", description = "arg2Description")
})
public void testMultiArgs(SlashCommandInteractionEvent event, List String listOfArgs){ }
Important Notes to keep in mind:
1. the first argument of any slash command method needs to be of type SlashCommandInteractionEvent (even if you dont use it)
2. command names need to be lower case
3. remember to implement the BotTask interface in the class you want to use @SlashCommand
4. remember to also define the task for the correct bot in the .properties file
-
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescription
-
Element Details
-
command
String command- Default:
"<using method name>"
-
description
String description- Default:
"<no description provided>"
-
options
SlashCommandArg[] options- Default:
{}
-