Annotation Interface AutoComplete
Methods annotated with AutoComplete will be registered as a handler for AutoCompleteEvent
s for the given
SlashCommand
s.
The SlashCommand
s can either be referenced by:
-
Command Name
If referenced by the command name the handler will handle any command that's name starts with the given name:
@SlashCommand("favourite fruit") public void fruitCommand(CommandEvent event, String fruit) { event.reply("You've chosen: %s", fruit); } @SlashCommand("favourite vegetable") public void vegetableCommand(CommandEvent event, String vegetable) { event.reply("You've chosen: %s", vegetable); } @AutoComplete("favourite") public void onFavouriteAutoComplete(AutoCompleteEvent event) { event.replyChoices(...); }
-
Method Name
If referenced by the method name the handler will only handle the command of the given method:
@SlashCommand("favourite fruit") public void fruitCommand(CommandEvent event, String fruit) { event.reply("You've chosen: %s", fruit); } @AutoComplete("fruitCommand") public void onFruitAutoComplete(AutoCompleteEvent event) { event.replyChoices(...); }
- See Also:
-
Required Element Summary
Required Elements
-
Element Details
-
value
String[] valueReturns the name of the slash commands this autocomplete should handle.- Returns:
- the slash commands
-