Role

class Role()

A guild role, including its permission bitfield, hierarchy position, and display settings.

exported from lib.weeble.d

Implements:

Properties

Role.color

type: readonly number | undefined

24-bit RGB color for this role. undefined when omitted; 0 only when Discord sent 0.

Role.colors

type: readonly RoleColors | undefined

Role colors. Prefer this over the legacy singular color field.

Role.createdAt

type: readonly Date

When this role was created.

Role.guildId

type: readonly string

Guild ID this role belongs to.

Role.hoist

type: readonly boolean | undefined

Indicates whether this role is displayed separately in the member list.

Role.icon

type: readonly string | null | undefined

Hash of the role’s icon, or null if not set.

Role.id

type: readonly string

Role ID.

Role.managed

type: readonly boolean | undefined

Indicates whether this role is managed by an integration.

Role.mentionable

type: readonly boolean | undefined

Indicates whether this role can be mentioned by anyone.

Role.name

type: readonly string

Role name.

Role.permissions

type: readonly bigint | undefined

Permission bitmask for this role.

Role.position

type: readonly number | undefined

Position in the role hierarchy (higher = higher priority).

Role.unicodeEmoji

type: readonly string | null | undefined

Unicode emoji displayed as the role icon, or null.

Methods

async Role.delete(reason: string) Promise<void>

Delete this role.

Parameters:
  • reason — – Reason for deletion, shown in audit log.

async Role.edit(options: RoleEditOptions) Promise<Role>

Edit role properties.

Parameters:
  • options — – Role properties to update.

Returns:

The updated role.

async Role.getMembers(options: FetchMembersOptions) Promise<GuildMember[]>

Fetch guild members who have this role.

Role.toMention() string

Get the mention string for this role.

Returns:

The role mention string (<@&roleId>).