Class RoleAction
- java.lang.Object
-
- net.dv8tion.jda.core.requests.RestAction<T>
-
- net.dv8tion.jda.core.requests.restaction.AuditableRestAction<Role>
-
- net.dv8tion.jda.core.requests.restaction.RoleAction
-
public class RoleAction extends AuditableRestAction<Role>
Extension ofRestAction
specifically designed to create aRole
. This extension allows setting properties before executing the action.- Since:
- 3.0
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class net.dv8tion.jda.core.requests.restaction.AuditableRestAction
AuditableRestAction.EmptyRestAction<T>
-
-
Field Summary
-
Fields inherited from class net.dv8tion.jda.core.requests.RestAction
DEFAULT_FAILURE, DEFAULT_SUCCESS, LOG
-
-
Constructor Summary
Constructors Constructor Description RoleAction(net.dv8tion.jda.core.requests.Route.CompiledRoute route, Guild guild)
Creates a new RoleAction instance
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RoleAction
setCheck(java.util.function.BooleanSupplier checks)
Sets the last-second checks before finally executing the http request in the queue.RoleAction
setColor(java.awt.Color color)
Sets the color which the new role should be displayed with.RoleAction
setColor(java.lang.Integer rgb)
Sets the Color for the new role.RoleAction
setHoisted(java.lang.Boolean hoisted)
Sets whether or not the new role should be hoistedRoleAction
setMentionable(java.lang.Boolean mentionable)
Sets whether the new role should be mentionable by members of the parentGuild
.RoleAction
setName(java.lang.String name)
Sets the name for new role (optional)RoleAction
setPermissions(java.lang.Long permissions)
Sets the Permissions the new Role should have.RoleAction
setPermissions(java.util.Collection<Permission> permissions)
Sets the Permissions the new Role should have.RoleAction
setPermissions(Permission... permissions)
Sets the Permissions the new Role should have.-
Methods inherited from class net.dv8tion.jda.core.requests.restaction.AuditableRestAction
reason
-
Methods inherited from class net.dv8tion.jda.core.requests.RestAction
complete, complete, completeAfter, getJDA, isPassContext, queue, queue, queue, queueAfter, queueAfter, queueAfter, queueAfter, queueAfter, queueAfter, setPassContext, submit, submit, submitAfter, submitAfter
-
-
-
-
Method Detail
-
setCheck
public RoleAction setCheck(java.util.function.BooleanSupplier checks)
Description copied from class:RestAction
Sets the last-second checks before finally executing the http request in the queue.
If the provided supplier evaluates tofalse
or throws an exception this will not be finished. When an exception is thrown from the supplier it will be provided to the failure callback.- Overrides:
setCheck
in classAuditableRestAction<Role>
- Parameters:
checks
- The checks to run before executing the request, ornull
to run no checks- Returns:
- The current RestAction for chaining convenience
-
setName
@CheckReturnValue public RoleAction setName(java.lang.String name)
Sets the name for new role (optional)- Parameters:
name
- The name for the new role, null to use default name- Returns:
- The current RoleAction, for chaining convenience
-
setHoisted
@CheckReturnValue public RoleAction setHoisted(java.lang.Boolean hoisted)
Sets whether or not the new role should be hoisted- Parameters:
hoisted
- Whether the new role should be hoisted (grouped). Default isfalse
- Returns:
- The current RoleAction, for chaining convenience
-
setMentionable
@CheckReturnValue public RoleAction setMentionable(java.lang.Boolean mentionable)
Sets whether the new role should be mentionable by members of the parentGuild
.- Parameters:
mentionable
- Whether the new role should be mentionable. Default isfalse
- Returns:
- The current RoleAction, for chaining convenience
-
setColor
@CheckReturnValue public RoleAction setColor(java.awt.Color color)
Sets the color which the new role should be displayed with.- Parameters:
color
- AnColor
for the new role, null to use default white/black- Returns:
- The current RoleAction, for chaining convenience
-
setColor
@CheckReturnValue public RoleAction setColor(java.lang.Integer rgb)
Sets the Color for the new role. This accepts colors from the range0x000
to0xFFFFFF
. The provided value will be ranged usingrbg & 0xFFFFFF
- Parameters:
rgb
- The color for the new role in integer form,null
to use default white/black- Returns:
- The current RoleAction, for chaining convenience
-
setPermissions
@CheckReturnValue public RoleAction setPermissions(Permission... permissions)
Sets the Permissions the new Role should have. This will only allow permissions that the current account already holds unless the account is owner oradmin
of the parentGuild
.- Parameters:
permissions
- The varargsPermissions
for the new role- Returns:
- The current RoleAction, for chaining convenience
- Throws:
InsufficientPermissionException
- If the currently logged in account does not hold one of the specified permissionsjava.lang.IllegalArgumentException
- If any of the provided permissions isnull
- See Also:
Permission.getRaw(Permission...)
-
setPermissions
@CheckReturnValue public RoleAction setPermissions(java.util.Collection<Permission> permissions)
Sets the Permissions the new Role should have. This will only allow permissions that the current account already holds unless the account is owner oradmin
of the parentGuild
.- Parameters:
permissions
- ACollection
ofPermissions
for the new role- Returns:
- The current RoleAction, for chaining convenience
- Throws:
InsufficientPermissionException
- If the currently logged in account does not hold one of the specified permissionsjava.lang.IllegalArgumentException
- If any of the provided permissions isnull
- See Also:
Permission.getRaw(Collection)
,EnumSet
-
setPermissions
@CheckReturnValue public RoleAction setPermissions(java.lang.Long permissions)
Sets the Permissions the new Role should have. This will only allow permissions that the current account already holds unless the account is owner oradmin
of the parentGuild
.- Parameters:
permissions
- The rawPermissions
value for the new role. To retrieve this usePermission.getRawValue()
- Returns:
- The current RoleAction, for chaining convenience
- Throws:
java.lang.IllegalArgumentException
- If the provided permission value is invalidInsufficientPermissionException
- If the currently logged in account does not hold one of the specified permissions- See Also:
Permission.getRawValue()
,Permission.getRaw(java.util.Collection)
,Permission.getRaw(net.dv8tion.jda.core.Permission...)
-
-