Annotation Interface AutoComplete


@Target(METHOD) @Retention(RUNTIME) public @interface AutoComplete

Methods annotated with AutoComplete will be registered as a handler for AutoCompleteEvents for the given SlashCommands.

The SlashCommands can either be referenced by:

  1. 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(...);
    }
    
  2. 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
    Modifier and Type
    Required Element
    Description
    Returns the name of the slash commands this autocomplete should handle.
  • Element Details

    • value

      String[] value
      Returns the name of the slash commands this autocomplete should handle.
      Returns:
      the slash commands