Skip to main content
A Role is a role of a server. You get one from guild.roles, member.roles, member.highestRole, a role option of a command or guild.createRole(). Every server has an @everyone role that every member has: guild.everyoneRole, whose id is the id of the server.
How to check and give permissions is in Permissions; how a command receives a role is in Options.

Properties

Snowflake
The unique id Discord gave it.
Date
When it was created: a Discord id contains its creation date.
Snowflake
The id of the server of the role.
Guild
The server of the role.
string
The name of the role.
number
The color as a number (0xff0000); 0 means no color.
boolean
Whether members with this role are shown apart in the member list.
number
Where the role is in the hierarchy: the higher, the more powerful.
Permissions
What the role allows in the server. See Permissions.
boolean
Whether the role belongs to an integration (a bot, boosters…).
boolean
Whether everyone can mention the role.
string | null
The standard emoji shown next to the role, when it has one.
boolean
Whether this is the @everyone role, which every member has.
GuildMember[]
The members that have this role, among the ones the bot knows.
members is read from the members the bot remembers (see Memory), so it is not always every member with the role.

Helpers

These read what the bot remembers: they never send a request.

iconURL()

The URL of the icon of the role, when it has one. See ImageOptions.

isHigherThan()

Whether this role is above another one in the hierarchy. With the same position, the oldest role is above. Discord documentation

toString()

<@&id>: mentions the role when put in a message.

toJSON()

The data of Discord as a plain object, with camelCase names.

Actions

edit()

Changes the role. See RoleEditOptions. Discord documentation

delete()

Deletes the role. Discord documentation

Types

RoleEditOptions is in Options, next to RoleCreateOptions. Permissions is in Permissions.