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 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 RoleManagersetColors(RoleColors colors) Sets the three color components of this role.setGradientColors(int primaryRgb, int secondaryRgb) Sets the primary and secondary color for the new role color gradient.default RoleManagersetGradientColors(Color primary, Color secondary) Sets the primary and secondary color for the new role color gradient.setHoisted(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.Sets the colors of this role toRoleColors.DEFAULT_HOLOGRAPHIC.Methods inherited from interface AuditableRestAction
reasonMethods inherited from interface 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
-
getGuild
-
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
-
setColors
Sets the three color components of this role.It is recommended to use
setColor(int),setGradientColors(int, int), oruseHolographicStyle()for setting colors instead, this method is primarily intended for copying colors from an existing role object withRole.getColors().- Parameters:
colors- The role colors ornullto use the default white/black- Returns:
- RoleManager for chaining convenience
- See Also:
-
setGradientColors
@Nonnull @CheckReturnValue default RoleManager setGradientColors(@Nonnull Color primary, @Nonnull Color secondary) Sets the primary and secondary color for the new role color gradient.Use
setColor(Color)oruseHolographicStyle()to use a single color or holographic style instead.- Parameters:
primary- The primary color for gradientsecondary- The secondary color for gradient- Returns:
- RoleManager for chaining convenience
- Throws:
IllegalArgumentException- Ifnullis provided
-
setGradientColors
Sets the primary and secondary color for the new role color gradient.This accepts colors from the range
0x000to0xFFFFFF. The provided value will be ranged usingrgb & 0xFFFFFF.Use
setColor(int)oruseHolographicStyle()to use a single color or holographic style instead.- Parameters:
primaryRgb- The primary color for gradientsecondaryRgb- The secondary color for gradient- Returns:
- RoleManager for chaining convenience
-
useHolographicStyle
Sets the colors of this role toRoleColors.DEFAULT_HOLOGRAPHIC.- Returns:
- RoleManager for chaining convenience
-
setHoisted
-
setMentionable
-
setIcon
- Parameters:
icon- The new icon for thisRoleornullto reset- Returns:
- RoleManager for chaining convenience
-
setIcon
-
setIcon
-
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:
-