java.lang.Comparable<Role>, java.util.Formattable, IMentionable, IPermissionHolder, ISnowflakepublic interface Role extends ISnowflake, IMentionable, IPermissionHolder, java.lang.Comparable<Role>
Guild's Role. Used to control permissions for Members.| Modifier and Type | Field | Description |
|---|---|---|
static int |
DEFAULT_COLOR_RAW |
Used to keep consistency between color values used in the API
|
| Modifier and Type | Method | Description |
|---|---|---|
boolean |
canInteract(Role role) |
Whether this Role can interact with the specified Role.
|
default RoleAction |
createCopy() |
|
RoleAction |
createCopy(Guild guild) |
|
AuditableRestAction<java.lang.Void> |
delete() |
Deletes this Role.
|
java.awt.Color |
getColor() |
The color this
Role is displayed in. |
int |
getColorRaw() |
The raw color RGB value used for this role
Defaults to DEFAULT_COLOR_RAW if this role has no set color |
Guild |
getGuild() |
Returns the
Guild this Role exists in |
JDA |
getJDA() |
Returns the
JDA instance of this Role |
RoleManager |
getManager() |
The
RoleManager for this Role. |
java.lang.String |
getName() |
The Name of this
Role. |
long |
getPermissionsRaw() |
The
long representation of the literal permissions that this Role has. |
int |
getPosition() |
|
int |
getPositionRaw() |
The actual position of the
Role as stored and given by Discord. |
boolean |
isHoisted() |
Whether this
Role is hoisted
Members in a hoisted role are displayed in their own grouping on the user-list |
boolean |
isManaged() |
Whether this
Role is managed by an integration |
boolean |
isMentionable() |
Whether or not this Role is mentionable
|
boolean |
isPublicRole() |
formatTo, getAsMentiongetPermissions, hasPermission, hasPermission, hasPermission, hasPermissiongetCreationTime, getId, getIdLongstatic final int DEFAULT_COLOR_RAW
int getPosition()
Role
in the Guild hierarchy. (higher value means higher role).
Guild.getPublicRole()'s getPosition() always return -1.Role as integer.int getPositionRaw()
Role as stored and given by Discord.
getPosition()
and it is most likely the method you want. If, for some reason, you want the actual position of the
Role then this method will give you that value.Role.java.lang.String getName()
Role.Role.boolean isManaged()
Role is managed by an integrationRole is managed.boolean isHoisted()
Role is hoisted
Role is hoisted.boolean isMentionable()
long getPermissionsRaw()
long representation of the literal permissions that this Role has.
Channel.java.awt.Color getColor()
Role is displayed in.getColorRaw()int getColorRaw()
DEFAULT_COLOR_RAW if this role has no set colorboolean isPublicRole()
Guild,
which is assigned to everyone who joins the Guild.Role is the public role
for the Guild provided by getGuild().Guild.getPublicRole()boolean canInteract(Role role)
role - The not-null role to compare tojava.lang.IllegalArgumentException - if the provided Role is null or not from the same GuildPermissionUtil.canInteract(Role, Role)Guild getGuild()
Guild this Role exists ingetGuild in interface IPermissionHolder@CheckReturnValue RoleAction createCopy(Guild guild)
Role in the specified Guild
with the same settings as the given Role.
It will be placed at the bottom (just over the Public Role) to avoid permission hierarchy conflicts.
For this to be successful, the logged in account has to have the MANAGE_ROLES Permission
and all Permissions the given Role has.
Possible ErrorResponses caused by
the returned RestAction include the following:
MISSING_PERMISSIONS
MISSING_ACCESS
MAX_ROLES_PER_GUILD
guild - The Role that should be copiedRoleAction
RolePermissionException - If the logged in account does not have the Permission.MANAGE_ROLES Permission and every Permission the provided Role hasjava.lang.IllegalArgumentException - If the specified guild is null@CheckReturnValue default RoleAction createCopy()
Role in this Guild
with the same settings as the given Role.
It will be placed at the bottom (just over the Public Role) to avoid permission hierarchy conflicts.
For this to be successful, the logged in account has to have the MANAGE_ROLES Permission
and all Permissions the given Role has.
Possible ErrorResponses caused by
the returned RestAction include the following:
MISSING_PERMISSIONS
MISSING_ACCESS
MAX_ROLES_PER_GUILD
RoleAction
RolePermissionException - If the logged in account does not have the Permission.MANAGE_ROLES Permission and every Permission the provided Role hasRoleManager getManager()
RoleManager for this Role.
In the RoleManager, you can modify all its values.
RestAction.queue().InsufficientPermissionException - If the currently logged in account does not have Permission.MANAGE_ROLESHierarchyException - If the currently logged in account does not have the required position to modify this role@CheckReturnValue AuditableRestAction<java.lang.Void> delete()
Possible ErrorResponses include:
ErrorResponse.UNKNOWN_ROLE
MISSING_PERMISSIONS
Permission.MANAGE_ROLES in the channel.MISSING_ACCESS
RestActionInsufficientPermissionException - If we don't have the permission to MANAGE_ROLESHierarchyException - If the role is too high in the role hierarchy to be deleted