Class DefaultMemberPermissions
java.lang.Object
net.dv8tion.jda.api.interactions.commands.DefaultMemberPermissions
Represents the default permissions for a Discord Application-Command. These permissions define the type of users that can use this command if no explicit command-specific
privileges are set by moderators to control who can and can't use the command within a Guild.
For example, given a command defined with CommandData#setDefaultPermissions
as command.setDefaultPermissions(DefaultMemberPermissions.enabledFor(Permission.BAN_MEMBERS))
any user with the Permission.BAN_MEMBERS
permission would be able to use the command by default.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final DefaultMemberPermissions
"Empty" permissions of a command.static final DefaultMemberPermissions
Default permissions of a command with no restrictions applied. -
Method Summary
Modifier and TypeMethodDescriptionstatic DefaultMemberPermissions
enabledFor
(long permissions) Returns a DefaultMemberPermissions instance with the predefined permissions a member must have to see and access a command.static DefaultMemberPermissions
enabledFor
(Collection<Permission> permissions) Returns a DefaultMemberPermissions instance with the predefined permissions a member must have to see and access a command.static DefaultMemberPermissions
enabledFor
(Permission... permissions) Returns a DefaultMemberPermissions instance with the predefined permissions a member must have to see and access a command.Raw permission integer representing the default permissions of a command.
-
Field Details
-
ENABLED
Default permissions of a command with no restrictions applied. (Everyone can see and access this command by default) -
DISABLED
"Empty" permissions of a command.
Only members with theADMINISTRATOR
permission can see and access this command by default.
-
-
Method Details
-
getPermissionsRaw
Raw permission integer representing the default permissions of a command.
This returns null if it is of typeENABLED
If the default member permissions areDISABLED
, this returns 0- Returns:
- Raw permission integer representing the default member permissions of a command
-
enabledFor
@Nonnull public static DefaultMemberPermissions enabledFor(@Nonnull Collection<Permission> permissions) Returns a DefaultMemberPermissions instance with the predefined permissions a member must have to see and access a command.
If the passed Collection is empty, this returnsENABLED
- Parameters:
permissions
- Collection ofPermissions
- Returns:
- DefaultMemberPermissions instance with the predefined permissions
- Throws:
IllegalArgumentException
- If any of the passed Permission is null
-
enabledFor
Returns a DefaultMemberPermissions instance with the predefined permissions a member must have to see and access a command.
If the passed Array is empty, this returnsENABLED
- Parameters:
permissions
- Vararg ofPermissions
- Returns:
- DefaultMemberPermissions instance with the predefined permissions
- Throws:
IllegalArgumentException
- If any of the passed Permission is null
-
enabledFor
Returns a DefaultMemberPermissions instance with the predefined permissions a member must have to see and access a command.
If the passed permission offset is 0, this returnsENABLED
- Parameters:
permissions
- Raw permission bitset- Returns:
- DefaultMemberPermissions instance with the predefined permissions
-