Interface RoleAction
-
- All Superinterfaces:
AuditableRestAction<Role>
,RestAction<Role>
public interface RoleAction extends AuditableRestAction<Role>
Extension ofRestAction
specifically designed to create aRole
. This extension allows setting properties before executing the action.- Since:
- 3.0
- See Also:
Guild
,Guild.createRole()
,Role.createCopy()
,Role.createCopy(Guild)
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description Guild
getGuild()
The guild to create the role inRoleAction
setCheck(BooleanSupplier checks)
Sets the last-second checks before finally executing the http request in the queue.default RoleAction
setColor(Color color)
Sets the color which the new role should be displayed with.RoleAction
setColor(Integer rgb)
Sets the Color for the new role.RoleAction
setHoisted(Boolean hoisted)
Sets whether or not the new role should be hoistedRoleAction
setMentionable(Boolean mentionable)
Sets whether the new role should be mentionable by members of the parentGuild
.RoleAction
setName(String name)
Sets the name for new role (optional)RoleAction
setPermissions(Long permissions)
Sets the Permissions the new Role should have.default RoleAction
setPermissions(Collection<Permission> permissions)
Sets the Permissions the new Role should have.default RoleAction
setPermissions(Permission... permissions)
Sets the Permissions the new Role should have.-
Methods inherited from interface net.dv8tion.jda.api.requests.restaction.AuditableRestAction
reason
-
Methods inherited from interface net.dv8tion.jda.api.requests.RestAction
complete, complete, completeAfter, getJDA, queue, queue, queue, queueAfter, queueAfter, queueAfter, queueAfter, queueAfter, queueAfter, submit, submit, submitAfter, submitAfter
-
-
-
-
Method Detail
-
setCheck
@Nonnull RoleAction setCheck(@Nullable BooleanSupplier checks)
Description copied from interface:AuditableRestAction
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>
- Parameters:
checks
- The checks to run before executing the request, ornull
to run no checks- Returns:
- The current RestAction for chaining convenience
-
setName
@Nonnull @CheckReturnValue RoleAction setName(@Nullable 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
- Throws:
IllegalArgumentException
- If the provided name is longer than 100 characters
-
setHoisted
@Nonnull @CheckReturnValue RoleAction setHoisted(@Nullable 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
@Nonnull @CheckReturnValue RoleAction setMentionable(@Nullable 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
@Nonnull @CheckReturnValue default RoleAction setColor(@Nullable 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
@Nonnull @CheckReturnValue RoleAction setColor(@Nullable 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
@Nonnull @CheckReturnValue default RoleAction setPermissions(@Nullable 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 permissionsIllegalArgumentException
- If any of the provided permissions isnull
- See Also:
Permission.getRaw(Permission...)
-
setPermissions
@Nonnull @CheckReturnValue default RoleAction setPermissions(@Nullable 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 permissionsIllegalArgumentException
- If any of the provided permissions isnull
- See Also:
Permission.getRaw(Collection)
,EnumSet
-
setPermissions
@Nonnull @CheckReturnValue RoleAction setPermissions(@Nullable 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:
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.api.Permission...)
-
-