java.lang.Comparable<Role>
, java.util.Formattable
, IMentionable
, IPermissionHolder
, ISnowflake
public interface Role extends ISnowflake, IMentionable, IPermissionHolder, java.lang.Comparable<Role>
Guild
's Role. Used to control permissions for Members.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. |
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. |
RoleManagerUpdatable |
getManagerUpdatable() |
The
RoleManagerUpdatable 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, getAsMention
getPermissions, hasPermission, hasPermission, hasPermission, hasPermission
getCreationTime, getId, getIdLong
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.boolean 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 Guild
PermissionUtil.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
Role
PermissionException
- If the logged in account does not have the Permission.MANAGE_ROLES
Permission and every Permission the provided Role hasGuildUnavailableException
- If the guild is temporarily not available
java.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
Role
PermissionException
- If the logged in account does not have the Permission.MANAGE_ROLES
Permission and every Permission the provided Role hasGuildUnavailableException
- If the guild is temporarily not available
RoleManager getManager()
RoleManager
for this Role.
In the RoleManager, you can modify all its values.RoleManagerUpdatable getManagerUpdatable()
RoleManagerUpdatable
for this Role.
In the Manager, you can modify all its values.
This can be used to bulk update role properties.
It requires to call an update()
method.
RoleManagerUpdatable
for this Role@CheckReturnValue AuditableRestAction<java.lang.Void> delete()
Possible ErrorResponses include:
ErrorResponse.UNKNOWN_ROLE
MISSING_PERMISSIONS
Permission.MANAGE_ROLES
in the channel.MISSING_ACCESS
RestAction
InsufficientPermissionException
- If we don't have the permission to MANAGE_ROLES
HierarchyException
- If the role is too high in the role hierarchy to be deleted