public class RoleManagerUpdatable
extends java.lang.Object
updatable manager that allows
to modify role settings like the name or the color.
This manager allows to modify multiple fields at once
by getting the RoleField for specific
properties and setting or resetting their values; followed by a call of update()!
Default values depend on the inherited properties of the Public Role in the parent Guild.
The RoleManager implementation
simplifies this process by giving simple setters that return the update RestAction
Note: To update this manager
the currently logged in account requires the Permission MANAGE_ROLES and
must be more powerful according to Discord hierarchy rules (positional strength). [ee Role.canInteract(Role)]
| Constructor and Description |
|---|
RoleManagerUpdatable(Role role)
Creates a new RoleManagerUpdatable instance
|
| Modifier and Type | Method and Description |
|---|---|
RoleField<java.awt.Color> |
getColorField()
|
Guild |
getGuild()
|
RoleField<java.lang.Boolean> |
getHoistedField()
|
JDA |
getJDA()
The
JDA instance of this Manager |
RoleField<java.lang.Boolean> |
getMentionableField()
|
RoleField<java.lang.String> |
getNameField()
|
PermissionField |
getPermissionField()
|
Role |
getRole()
The target
Role for this
manager |
void |
reset()
Resets all
Fields
for this manager instance by calling Field.reset() sequentially
This is automatically called by update() |
AuditableRestAction<java.lang.Void> |
update()
Creates a new
RestAction instance
that will apply all changes that have been made to this manager instance. |
public RoleField<java.lang.String> getNameField()
RoleField
for the name of the selected Role.
To set the value use setValue(String)
on the returned RoleField instance.
A role name must be between 1-32 characters long!
Otherwise Field.setValue(...) will
throw an IllegalArgumentException.
RoleField - Type: Stringpublic RoleField<java.awt.Color> getColorField()
RoleField
for the color of the selected Role.
To set the value use setValue(Color)
on the returned RoleField instance.
Provide null or black to use the default color.
RoleField - Type: Colorpublic RoleField<java.lang.Boolean> getHoistedField()
RoleField
for the hoist state of the selected Role.
To set the value use setValue(Boolean)
on the returned RoleField instance.
A role hoist state must not be null!
Otherwise Field.setValue(...) will
throw an IllegalArgumentException.
RoleField - Type: Booleanpublic RoleField<java.lang.Boolean> getMentionableField()
RoleField
for the mentionable state of the selected Role.
To set the value use setValue(Boolean)
on the returned RoleField instance.
A role mentionable state must not be null!
Otherwise Field.setValue(...) will
throw an IllegalArgumentException.
RoleField - Type: Booleanpublic PermissionField getPermissionField()
PermissionField
for the Permissions of the selected Role.
To set the value use setPermissions(Permission...)
on the returned PermissionField instance.
A role permissions must not be null!
Otherwise the PermissionField will
throw an IllegalArgumentException.
PermissionFieldpublic void reset()
Fields
for this manager instance by calling Field.reset() sequentially
update()@CheckReturnValue public AuditableRestAction<java.lang.Void> update()
RestAction instance
that will apply all changes that have been made to this manager instance.
EmptyRestAction.
Before applying new changes it is recommended to call reset() to reset previous changes.
This is automatically called if this method returns successfully.
Possible ErrorResponses for this
update include the following:
UNKNOWN_ROLE
MISSING_ACCESS
MISSING_PERMISSIONS
MANAGE_ROLES Permission or lost
positional power before finishing the taskAuditableRestAction
InsufficientPermissionException - If the currently logged in account does not have the Permission MANAGE_ROLESHierarchyException - If the currently logged in account does not meet the required hierarchy position
to interact with this Role