Class RoleActionImpl
java.lang.Object
net.dv8tion.jda.internal.requests.RestActionImpl<Role>
net.dv8tion.jda.internal.requests.restaction.AuditableRestActionImpl<Role>
net.dv8tion.jda.internal.requests.restaction.RoleActionImpl
- All Implemented Interfaces:
RestAction<Role>
,AuditableRestAction<Role>
,RoleAction
-
Field Summary
Fields inherited from class net.dv8tion.jda.internal.requests.RestActionImpl
LOG
Fields inherited from interface net.dv8tion.jda.api.requests.restaction.AuditableRestAction
MAX_REASON_LENGTH
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondeadline
(long timestamp) Similar toRestAction.timeout(long, TimeUnit)
but schedules a deadline at which the request has to be completed.getGuild()
The guild to create the role insetCheck
(BooleanSupplier checks) Sets the last-second checks before finally executing the http request in the queue.Sets the Color for the new role.setHoisted
(Boolean hoisted) Sets whether or not the new role should be hoistedSets the Unicode Emoji of thisRole
instead of a custom image.setMentionable
(Boolean mentionable) Sets whether the new role should be mentionable by members of the parentGuild
.Sets the name for new role (optional)setPermissions
(Long permissions) Sets the Permissions the new Role should have.Timeout for this RestAction instance.Methods inherited from class net.dv8tion.jda.internal.requests.restaction.AuditableRestActionImpl
reason
Methods inherited from class net.dv8tion.jda.internal.requests.RestActionImpl
complete, getCheck, getDefaultFailure, getDefaultSuccess, getDefaultTimeout, getJDA, handleResponse, isPassContext, priority, queue, setDefaultFailure, setDefaultSuccess, setDefaultTimeout, setErrorMapper, setPassContext, submit
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.dv8tion.jda.api.requests.restaction.AuditableRestAction
reason
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, onSuccess, queue, queue, queue, queueAfter, queueAfter, queueAfter, queueAfter, queueAfter, queueAfter, submit, submit, submitAfter, submitAfter, zip
Methods inherited from interface net.dv8tion.jda.api.requests.restaction.RoleAction
setColor, setIcon, setPermissions, setPermissions
-
Constructor Details
-
RoleActionImpl
Creates a new RoleAction instance- Parameters:
guild
- TheGuild
for which the Role should be created.
-
-
Method Details
-
setCheck
Description copied from interface: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.- Specified by:
setCheck
in interfaceAuditableRestAction<Role>
- Specified by:
setCheck
in interfaceRestAction<Role>
- Specified by:
setCheck
in interfaceRoleAction
- Overrides:
setCheck
in classAuditableRestActionImpl<Role>
- Parameters:
checks
- The checks to run before executing the request, ornull
to run no checks- Returns:
- The current RestAction for chaining convenience
- See Also:
-
timeout
Description copied from interface:AuditableRestAction
Timeout for this RestAction instance.
If the request doesn't get executed within the timeout it will fail.When a RestAction times out, it will fail with a
TimeoutException
. This is the same asdeadline(System.currentTimeMillis() + unit.toMillis(timeout))
.Example
action.timeout(10, TimeUnit.SECONDS) // 10 seconds from now .queueAfter(20, SECONDS); // request will not be executed within deadline and timeout immediately after 20 seconds
- Specified by:
timeout
in interfaceAuditableRestAction<Role>
- Specified by:
timeout
in interfaceRestAction<Role>
- Specified by:
timeout
in interfaceRoleAction
- Overrides:
timeout
in classAuditableRestActionImpl<Role>
- Parameters:
timeout
- The timeout to useunit
-Unit
for the timeout value- Returns:
- The same RestAction instance with the applied timeout
- See Also:
-
deadline
Description copied from interface:RestAction
Similar toRestAction.timeout(long, TimeUnit)
but schedules a deadline at which the request has to be completed.
If the deadline is reached, the request will fail with aTimeoutException
.This does not mean that the request will immediately timeout when the deadline is reached. JDA will check the deadline right before executing the request or within intervals in a worker thread. This only means the request will timeout if the deadline has passed.
Example
action.deadline(System.currentTimeMillis() + 10000) // 10 seconds from now .queueAfter(20, SECONDS); // request will not be executed within deadline and timeout immediately after 20 seconds
- Specified by:
deadline
in interfaceAuditableRestAction<Role>
- Specified by:
deadline
in interfaceRestAction<Role>
- Specified by:
deadline
in interfaceRoleAction
- Overrides:
deadline
in classAuditableRestActionImpl<Role>
- Parameters:
timestamp
- Millisecond timestamp at which the request will timeout- Returns:
- The same RestAction with the applied deadline
- See Also:
-
getGuild
Description copied from interface:RoleAction
The guild to create the role in- Specified by:
getGuild
in interfaceRoleAction
- Returns:
- The guild
-
setName
Description copied from interface:RoleAction
Sets the name for new role (optional)- Specified by:
setName
in interfaceRoleAction
- Parameters:
name
- The name for the new role, null to use default name- Returns:
- The current RoleAction, for chaining convenience
-
setHoisted
Description copied from interface:RoleAction
Sets whether or not the new role should be hoisted- Specified by:
setHoisted
in interfaceRoleAction
- Parameters:
hoisted
- Whether the new role should be hoisted (grouped). Default isfalse
- Returns:
- The current RoleAction, for chaining convenience
-
setMentionable
Description copied from interface:RoleAction
Sets whether the new role should be mentionable by members of the parentGuild
.- Specified by:
setMentionable
in interfaceRoleAction
- Parameters:
mentionable
- Whether the new role should be mentionable. Default isfalse
- Returns:
- The current RoleAction, for chaining convenience
-
setColor
Description copied from interface:RoleAction
Sets the Color for the new role. This accepts colors from the range0x000
to0xFFFFFF
. The provided value will be ranged usingrbg & 0xFFFFFF
- Specified by:
setColor
in interfaceRoleAction
- 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
Description copied from interface:RoleAction
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
.- Specified by:
setPermissions
in interfaceRoleAction
- Parameters:
permissions
- The rawPermissions
value for the new role. To retrieve this usePermission.getRawValue()
- Returns:
- The current RoleAction, for chaining convenience
- See Also:
-
setIcon
Description copied from interface:RoleAction
Sets theIcon
of thisRole
. This icon will be displayed next to the role's name in the members tab and in chat.- Specified by:
setIcon
in interfaceRoleAction
- Parameters:
icon
- The new icon for thisRole
ornull
to reset- Returns:
- The current RoleAction, for chaining convenience
-
setIcon
Description copied from interface:RoleAction
Sets the Unicode Emoji of thisRole
instead of a custom image. This emoji will be displayed next to the role's name in the members tab and in chat.- Specified by:
setIcon
in interfaceRoleAction
- Parameters:
emoji
- The new Unicode emoji for thisRole
ornull
to reset- Returns:
- The current RoleAction, for chaining convenience
-