Annotation Interface SlashCommand


@Target(METHOD) @Retention(RUNTIME) @Documented public @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 Elements
    Modifier and Type
    Optional Element
    Description
    a short description of the option and what its for
    a short description of the option and what its for
    a short description of the option and what its for
  • Element Details

    • command

      String command
      a 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 description
      a 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[] options
      a short description of the option and what its for
      Returns:
      a short description of the option and what its for
      Default:
      {}