Class PrivilegeConfig
java.lang.Object
net.dv8tion.jda.api.interactions.commands.PrivilegeConfig
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 Summary
ConstructorDescriptionPrivilegeConfig
(Guild guild, Map<String, List<IntegrationPrivilege>> privileges) -
Method Summary
Modifier and TypeMethodDescription@Unmodifiable List
<IntegrationPrivilege> TheIntegrationPrivileges
that have been applied to this application in this guild.getAsMap()
Map containing all privileges, with the command-id as the Key, and a List ofIntegrationPrivilege
as Value.@Unmodifiable List
<IntegrationPrivilege> TheIntegrationPrivileges
that have been applied to the command with the given id in this guild.@Unmodifiable List
<IntegrationPrivilege> getCommandPrivileges
(Command command) TheIntegrationPrivileges
that have been applied to the suppliedCommand
.getGuild()
The guild in which this PrivilegeConfig is applied in.getJDA()
The JDA-instance.
-
Constructor Details
-
PrivilegeConfig
-
-
Method Details
-
getGuild
The guild in which this PrivilegeConfig is applied in.- Returns:
- Guild in which this PrivilegeConfig is applied in.
-
getJDA
The JDA-instance.- Returns:
- The JDA-instance.
-
getApplicationPrivileges
TheIntegrationPrivileges
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
TheIntegrationPrivileges
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) TheIntegrationPrivileges
that have been applied to the suppliedCommand
.
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
- TheCommand
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 ofIntegrationPrivilege
as Value.
IfgetApplicationPrivileges()
is not null, this will also contain the privileges applied directly on this application withSelfUser.getApplicationId()
as the Key.- Returns:
- Unmodifiable Map containing all privileges on this guild.
-