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 ElementDescriptiona short description of the option and what its fora short description of the option and what its fora short description of the option and what its for
-
Element Details
-
command
String commanda short description of the option and what its for- Returns:
- a short description of the option and what its for
- Default:
"<using method name>"
-
description
String descriptiona short description of the option and what its for- Returns:
- a short description of the option and what its for
- Default:
"<no description provided>"
-
options
SlashCommandArg[] optionsa short description of the option and what its for- Returns:
- a short description of the option and what its for
- Default:
{}
-