Interface RoleManager
- All Superinterfaces:
AuditableRestAction<Void>,Manager<RoleManager>,RestAction<Void>
Role.
Example
manager.setName("Administrator")
.setColor(null)
.queue();
manager.reset(RoleManager.PERMISSION | RoleManager.NAME)
.setName("Traitor")
.setColor(Color.RED)
.queue();
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final longUsed to reset the color fieldstatic final longUsed to reset the hoisted fieldstatic final longUsed to reset the icon fieldstatic final longUsed to reset the mentionable fieldstatic final longUsed to reset the name fieldstatic final longUsed to reset the permission fieldFields inherited from interface net.dv8tion.jda.api.requests.restaction.AuditableRestAction
MAX_REASON_LENGTH -
Method Summary
Modifier and TypeMethodDescriptiondefault GuildgetGuild()getRole()The targetRolefor this managergivePermissions(Collection<Permission> perms) Adds the specifiedPermissionsto the selectedRole.default RoleManagergivePermissions(Permission... perms) Adds the specifiedPermissionsto the selectedRole.reset(long fields) Resets the fields specified by the provided bit-flag pattern.reset(long... fields) Resets the fields specified by the provided bit-flag patterns.revokePermissions(Collection<Permission> perms) Revokes the specifiedPermissionsfrom the selectedRole.default RoleManagerrevokePermissions(Permission... perms) Revokes the specifiedPermissionsfrom the selectedRole.setColor(int rgb) Sets the rgb color of the selectedRole.default RoleManagersetHoisted(boolean hoisted) Sets the hoist state of the selectedRole.Sets the Unicode Emoji of thisRoleinstead of a custom image.default RoleManagersetIcon(UnicodeEmoji emoji) Sets the Unicode Emoji of thisRoleinstead of a custom image.setMentionable(boolean mentionable) Sets the mentionable state of the selectedRole.Sets the name of the selectedRole.setPermissions(long perms) Sets thePermissionsof the selectedRole.default RoleManagersetPermissions(Collection<Permission> permissions) Sets thePermissionsof the selectedRole.default RoleManagersetPermissions(Permission... permissions) Sets thePermissionsof the selectedRole.Methods inherited from interface net.dv8tion.jda.api.requests.restaction.AuditableRestAction
reasonMethods inherited from interface net.dv8tion.jda.api.managers.Manager
deadline, reset, setCheck, timeoutMethods inherited from interface net.dv8tion.jda.api.requests.RestAction
addCheck, and, and, complete, complete, completeAfter, delay, delay, delay, delay, flatMap, flatMap, getCheck, getJDA, map, mapToResult, onErrorFlatMap, onErrorFlatMap, onErrorMap, onErrorMap, onSuccess, queue, queue, queue, queueAfter, queueAfter, queueAfter, queueAfter, queueAfter, queueAfter, submit, submit, submitAfter, submitAfter, zip
-
Field Details
-
NAME
static final long NAMEUsed to reset the name field- See Also:
-
COLOR
static final long COLORUsed to reset the color field- See Also:
-
PERMISSION
static final long PERMISSIONUsed to reset the permission field- See Also:
-
HOIST
static final long HOISTUsed to reset the hoisted field- See Also:
-
MENTIONABLE
static final long MENTIONABLEUsed to reset the mentionable field- See Also:
-
ICON
static final long ICONUsed to reset the icon field- See Also:
-
-
Method Details
-
reset
Resets the fields specified by the provided bit-flag pattern. You can specify a combination by using a bitwise OR concat of the flag constants.
Example:manager.reset(RoleManager.COLOR | RoleManager.NAME);Flag Constants:
- Specified by:
resetin interfaceManager<RoleManager>- Parameters:
fields- Integer value containing the flags to reset.- Returns:
- RoleManager for chaining convenience
-
reset
Resets the fields specified by the provided bit-flag patterns.
Example:manager.reset(RoleManager.COLOR, RoleManager.NAME);Flag Constants:
- Specified by:
resetin interfaceManager<RoleManager>- Parameters:
fields- Integer values containing the flags to reset.- Returns:
- RoleManager for chaining convenience
-
getRole
The targetRolefor this manager- Returns:
- The target Role
-
getGuild
- Returns:
- The parent
Guild
-
setName
Sets the name of the selectedRole.A role name must not be
nullnor less than 1 character or more than 100 characters long!- Parameters:
name- The new name for the selectedRole- Returns:
- RoleManager for chaining convenience
- Throws:
IllegalArgumentException- If the provided name isnullor not between 1-100 characters long
-
setPermissions
Sets thePermissionsof the selectedRole.Permissions may only include already present Permissions for the currently logged in account.
You are unable to give permissions you don't have!- Parameters:
perms- The new raw permission value for the selectedRole- Returns:
- RoleManager for chaining convenience
- Throws:
InsufficientPermissionException- If the currently logged in account does not have permission to apply one of the specified permissions- See Also:
-
setPermissions
Sets thePermissionsof the selectedRole.Permissions may only include already present Permissions for the currently logged in account.
You are unable to give permissions you don't have!- Parameters:
permissions- The new permission for the selectedRole- Returns:
- RoleManager for chaining convenience
- Throws:
InsufficientPermissionException- If the currently logged in account does not have permission to apply one of the specified permissionsIllegalArgumentException- If any of the provided values isnull- See Also:
-
setPermissions
@Nonnull @CheckReturnValue default RoleManager setPermissions(@Nonnull Collection<Permission> permissions) Sets thePermissionsof the selectedRole.Permissions may only include already present Permissions for the currently logged in account.
You are unable to give permissions you don't have!- Parameters:
permissions- The new permission for the selectedRole- Returns:
- RoleManager for chaining convenience
- Throws:
InsufficientPermissionException- If the currently logged in account does not have permission to apply one of the specified permissionsIllegalArgumentException- If any of the provided values isnull- See Also:
-
setColor
- Parameters:
color- The new color for the selectedRole- Returns:
- RoleManager for chaining convenience
-
setColor
Sets the rgb color of the selectedRole.- Parameters:
rgb- The new color for the selectedRole- Returns:
- RoleManager for chaining convenience
- See Also:
-
setHoisted
Sets the hoist state of the selectedRole.- Parameters:
hoisted- Whether the selectedRoleshould be hoisted- Returns:
- RoleManager for chaining convenience
-
setMentionable
Sets the mentionable state of the selectedRole.- Parameters:
mentionable- Whether the selectedRoleshould be mentionable- Returns:
- RoleManager for chaining convenience
-
setIcon
- Parameters:
icon- The new icon for thisRoleornullto reset- Returns:
- RoleManager for chaining convenience
-
setIcon
Sets the Unicode Emoji of thisRoleinstead of a custom image.- Parameters:
emoji- The new Unicode Emoji for thisRoleornullto reset- Returns:
- RoleManager for chaining convenience
-
setIcon
Sets the Unicode Emoji of thisRoleinstead of a custom image.- Parameters:
emoji- The new Unicode Emoji for thisRoleornullto reset- Returns:
- RoleManager for chaining convenience
- See Also:
-
givePermissions
Adds the specifiedPermissionsto the selectedRole.Permissions may only include already present Permissions for the currently logged in account.
You are unable to give permissions you don't have!- Parameters:
perms- The permission to give to the selectedRole- Returns:
- RoleManager for chaining convenience
- Throws:
InsufficientPermissionException- If the currently logged in account does not have permission to apply one of the specified permissions- See Also:
-
givePermissions
Adds the specifiedPermissionsto the selectedRole.Permissions may only include already present Permissions for the currently logged in account.
You are unable to give permissions you don't have!- Parameters:
perms- The permission to give to the selectedRole- Returns:
- RoleManager for chaining convenience
- Throws:
InsufficientPermissionException- If the currently logged in account does not have permission to apply one of the specified permissions- See Also:
-
revokePermissions
Revokes the specifiedPermissionsfrom the selectedRole.Permissions may only include already present Permissions for the currently logged in account.
You are unable to revoke permissions you don't have!- Parameters:
perms- The permission to give to the selectedRole- Returns:
- RoleManager for chaining convenience
- Throws:
InsufficientPermissionException- If the currently logged in account does not have permission to revoke one of the specified permissions- See Also:
-
revokePermissions
Revokes the specifiedPermissionsfrom the selectedRole.Permissions may only include already present Permissions for the currently logged in account.
You are unable to revoke permissions you don't have!- Parameters:
perms- The permission to give to the selectedRole- Returns:
- RoleManager for chaining convenience
- Throws:
InsufficientPermissionException- If the currently logged in account does not have permission to revoke one of the specified permissions- See Also:
-