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
Modifier and TypeFieldDescriptionstatic final long
Used to reset the color fieldstatic final long
Used to reset the hoisted fieldstatic final long
Used to reset the icon fieldstatic final long
Used to reset the mentionable fieldstatic final long
Used to reset the name fieldstatic final long
Used to reset the permission field -
Method Summary
Modifier and TypeMethodDescriptiondefault Guild
getGuild()
getRole()
The targetRole
for this managergivePermissions
(Collection<Permission> perms) Adds the specifiedPermissions
to the selectedRole
.default RoleManager
givePermissions
(Permission... perms) Adds the specifiedPermissions
to 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 specifiedPermissions
from the selectedRole
.default RoleManager
revokePermissions
(Permission... perms) Revokes the specifiedPermissions
from the selectedRole
.setColor
(int rgb) Sets the rgb color of the selectedRole
.default RoleManager
setHoisted
(boolean hoisted) Sets the hoist state of the selectedRole
.Sets the Unicode Emoji of thisRole
instead of a custom image.setMentionable
(boolean mentionable) Sets the mentionable state of the selectedRole
.Sets the name of the selectedRole
.setPermissions
(long perms) Sets thePermissions
of the selectedRole
.default RoleManager
setPermissions
(Collection<Permission> permissions) Sets thePermissions
of the selectedRole
.default RoleManager
setPermissions
(Permission... permissions) Sets thePermissions
of the selectedRole
.Methods inherited from interface net.dv8tion.jda.api.requests.restaction.AuditableRestAction
reason
Methods inherited from interface net.dv8tion.jda.api.managers.Manager
deadline, reset, setCheck, timeout
Methods 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, 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:
reset
in 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. 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:
reset
in interfaceManager<RoleManager>
- Parameters:
fields
- Integer values containing the flags to reset.- Returns:
- RoleManager for chaining convenience
-
getRole
The targetRole
for this manager- Returns:
- The target Role
-
getGuild
- Returns:
- The parent
Guild
-
setName
Sets the name of the selectedRole
.A role name must not be
null
nor less than 1 characters or more than 32 characters long!- Parameters:
name
- The new name for the selectedRole
- Returns:
- RoleManager for chaining convenience
- Throws:
IllegalArgumentException
- If the provided name isnull
or not between 1-100 characters long
-
setPermissions
Sets thePermissions
of 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 thePermissions
of 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 thePermissions
of 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 selectedRole
should be hoisted- Returns:
- RoleManager for chaining convenience
-
setMentionable
Sets the mentionable state of the selectedRole
.- Parameters:
mentionable
- Whether the selectedRole
should be mentionable- Returns:
- RoleManager for chaining convenience
-
setIcon
- Parameters:
icon
- The new icon for thisRole
ornull
to reset- Returns:
- RoleManager for chaining convenience
-
setIcon
Sets the Unicode Emoji of thisRole
instead of a custom image.- Parameters:
emoji
- The new Unicode Emoji for thisRole
ornull
to reset- Returns:
- RoleManager for chaining convenience
-
givePermissions
Adds the specifiedPermissions
to 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 specifiedPermissions
to 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 specifiedPermissions
from 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 specifiedPermissions
from 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:
-