Class PrivilegeConfig

java.lang.Object
net.dv8tion.jda.api.interactions.commands.PrivilegeConfig

public class PrivilegeConfig extends Object
A PrivilegeConfig is the collection of moderator defined privileges set on a specific application and its commands that define what channels the application can be used in and what users/roles are allowed to use it. These privileges are set by moderators in the guild who have access to the guild's integrations page and permissions to edit them.
See Also:
  • Constructor Details

  • Method Details

    • getGuild

      @Nonnull public Guild getGuild()
      The guild in which this PrivilegeConfig is applied in.
      Returns:
      Guild in which this PrivilegeConfig is applied in.
    • getJDA

      @Nonnull public JDA getJDA()
      The JDA-instance.
      Returns:
      The JDA-instance.
    • getApplicationPrivileges

      @Nullable public @Unmodifiable List<IntegrationPrivilege> getApplicationPrivileges()
      The IntegrationPrivileges that have been applied to this application in this guild.
      If the privileges are "Synced" (No custom config applied), this will return null.

      This does not include privileges applied to a command itself. Use getCommandPrivileges(String) for that.

      Returns:
      Immutable List containing all IntegrationPrivileges that have been applied to this application in this guild.
    • getCommandPrivileges

      @Nullable public @Unmodifiable List<IntegrationPrivilege> getCommandPrivileges(@Nonnull String id)
      The IntegrationPrivileges that have been applied to the command with the given id in this guild.
      If the privileges are "Synced" (No custom config applied), or a command with this id doesn't exist, this will return null.

      This does not include privileges applied to the application directly. Use getApplicationPrivileges() for that.

      Parameters:
      id - The id of the command
      Returns:
      Immutable List containing all IntegrationPrivileges that have been applied to the command with the given id in this guild.
      Throws:
      IllegalArgumentException - If the provided id is null
    • getCommandPrivileges

      @Nullable public @Unmodifiable List<IntegrationPrivilege> getCommandPrivileges(@Nonnull Command command)
      The IntegrationPrivileges that have been applied to the supplied Command.
      If the privileges are "Synced" (No custom config applied), or this command no longer exists, this will return null.

      This does not include privileges applied to the application directly. Use getApplicationPrivileges() for that.

      Parameters:
      command - The Command to get the privileges from
      Returns:
      Immutable List containing all IntegrationPrivileges that have been applied to the command in this guild.
      Throws:
      IllegalArgumentException - If the provided command is null
    • getAsMap

      Map containing all privileges, with the command-id as the Key, and a List of IntegrationPrivilege as Value.
      If getApplicationPrivileges() is not null, this will also contain the privileges applied directly on this application with SelfUser.getApplicationId() as the Key.
      Returns:
      Unmodifiable Map containing all privileges on this guild.