Overview
Roles are used to organize members and assign permissions in a guild. Each role has a position, color, and set of permissions.Key Properties
Basic Information
The Snowflake id of this Role.
The Snowflake id of this Role as a primitive long.
The name of this Role.
Returns the Guild this Role exists in.
Position and Hierarchy
The hierarchical position of this Role in the Guild hierarchy (higher value means higher role).The @everyone role always returns -1.
The actual position of the Role as stored by Discord.
Whether this Role can interact with the specified Role (move/manage/etc.).
Permissions
Gets the Permissions that this Role has.
The long representation of the literal permissions that this Role has.
Checks whether this role has the specified permissions.
Appearance
The colors this Role is displayed in.
The color this Role is displayed in.Returns
null if the role uses the default color.The raw color RGB value used for this role.Defaults to
Role.DEFAULT_COLOR_RAW if this role has no set color.The Icon of this role.Returns
null if no custom image or emoji is set.Display Settings
Whether this Role is hoisted. Members in a hoisted role are displayed in their own grouping on the user-list.
Whether this role is mentionable.
Returns a mention tag for this role.
Special Roles
Whether this role is the @everyone role for its Guild, which is assigned to everyone who joins the Guild.
Whether this Role is managed by an integration.
The tags of this role. Useful to determine the purpose of a managed role.Requires the
ROLE_TAGS cache flag to be enabled.Role Actions
Management
The RoleManager for this Role. Used to modify role settings.
Deletes this Role.
Creating Roles
Creates a new Role in this Guild with the same settings as this role.It will be placed at the bottom to avoid permission hierarchy conflicts.
Creates a new Role in the specified Guild with the same settings as this role.
Role Tags
The RoleTags interface provides information about managed roles:Whether this role is associated with a bot.
The id for the bot associated with this role.Returns 0 if this role is not for a bot.
Whether this role is the boost role of this guild.
Whether this role is managed by an integration.This is usually true for roles such as those created for Twitch subscribers.
The id for the integration associated with this role.Returns 0 if this role is not for an integration.
Whether this role can be acquired through a premium subscription purchase.
Whether this role has been published for user purchasing.
Whether this role is acquired through a user connection.
Usage Example
Constants
Used to keep consistency between color values:
0x1F_FFFFFF