Annotation Interface CommandConfig


@Target({TYPE,METHOD}) @Retention(RUNTIME) public @interface CommandConfig

Used to configure the registration of commands.

Interaction methods annotated with CommandConfig will use the configured values of this annotation when registering. Interaction classes annotated with CommandConfig will apply the configured values of this annotation to every method, if and only if no annotation is present at method level. If the CommandConfig annotation is neither present at the class level nor the method level, the global CommandConfig will be used instead.

In other words the hierarchy is as following: 2. ReplyConfig method annotation 3. ReplyConfig class annotation 4. global CommandConfig provided in JDACBuilder

  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    net.dv8tion.jda.api.interactions.InteractionContextType[]
    The InteractionContextTypes to use.
    net.dv8tion.jda.api.Permission[]
    Returns an array of Permission this command should be enabled for by default.
    net.dv8tion.jda.api.interactions.IntegrationType[]
    The IntegrationTypes to use.
    boolean
    Whether the configured command(s) can only be executed in NSFW channels.
    The CommandScope to use.
  • Element Details

    • context

      net.dv8tion.jda.api.interactions.InteractionContextType[] context
      The InteractionContextTypes to use. The default value is InteractionContextType.GUILD.
      Returns:
      the InteractionContextTypes to use
      Default:
      {GUILD}
    • integration

      net.dv8tion.jda.api.interactions.IntegrationType[] integration
      The IntegrationTypes to use. The default value is IntegrationType.GUILD_INSTALL.
      Returns:
      the IntegrationTypes to use
      Default:
      {GUILD_INSTALL}
    • scope

      The CommandScope to use. The default value is CommandScope.GLOBAL.
      Returns:
      the CommandScope to use
      Default:
      GLOBAL
    • isNSFW

      boolean isNSFW
      Whether the configured command(s) can only be executed in NSFW channels.
      Returns:
      true if the configured command(s) can only be executed in NSFW channels
      Default:
      false
    • enabledFor

      net.dv8tion.jda.api.Permission[] enabledFor
      Returns an array of Permission this command should be enabled for by default. Note that guild admins can modify this at any time.
      Returns:
      an array of permissions this command will be enabled for by default
      See Also:
      • Permission
      • DefaultMemberPermissions.ENABLED
      • DefaultMemberPermissions.DISABLED
      Default:
      {UNKNOWN}