Annotation Interface Execute


@ReleasedSince("26.8.301") @Target(METHOD) @Retention(RUNTIME) public @interface Execute
Identifies the handler method to invoke when an interaction is triggered.

The annotated method can either take zero parameters or accept a single SlashCommandInteractionEvent argument.

  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    boolean
    Indicates whether the framework should automatically defer the interaction before executing the method.
    boolean
    Defines whether the deferred response should be visible only to the command invoker (ephemeral).
    The required permissions the invoking member must possess in the guild to run this command.
    The required permissions the bot itself must possess in the guild to execute this command.
  • Element Details

    • defer

      boolean defer
      Indicates whether the framework should automatically defer the interaction before executing the method. Prevents interaction timeout errors for long-running operations.
      Returns:
      true to automatically call deferReply(), defaults to true
      Default:
      true
    • ephemeral

      boolean ephemeral
      Defines whether the deferred response should be visible only to the command invoker (ephemeral). Ignored if defer() is set to false.
      Returns:
      true for ephemeral deferral, defaults to false
      Default:
      false
    • permissions

      Permission[] permissions
      The required permissions the invoking member must possess in the guild to run this command.
      Returns:
      an array of required user permissions, defaults to empty
      Default:
      {}
    • selfPermissions

      Permission[] selfPermissions
      The required permissions the bot itself must possess in the guild to execute this command.
      Returns:
      an array of required bot permissions, defaults to empty
      Default:
      {}