Skip to content

Role

Defined in: packages/structures/src/resources.ts:240

A Discord guild role.

new Role(data): Role

Defined in: packages/structures/src/resources.ts:269

Creates a role from Discord data.

Discord role payload.

number

{ primary_color: number; secondary_color: number | null; tertiary_color: number | null; }

number

number | null

number | null

boolean

string | null

string

boolean

boolean

string

string

number

Record<string, unknown> | null

string | null

Role

BaseStructure.constructor

color: number

Defined in: packages/structures/src/resources.ts:244

Role color as a 24-bit RGB integer.


colors: { primary: number; secondary: number | null; tertiary: number | null; } | null

Defined in: packages/structures/src/resources.ts:260

Gradient or holographic colours, when the role has more than a solid colour.


hoist: boolean

Defined in: packages/structures/src/resources.ts:246

Whether the role is hoisted.


iconHash: string | null

Defined in: packages/structures/src/resources.ts:258

Hash of the role’s custom icon image, if any.


readonly id: string

Defined in: packages/structures/src/base.ts:12

BaseStructure.id


managed: boolean

Defined in: packages/structures/src/resources.ts:250

Whether the role is managed by an integration.


mentionable: boolean

Defined in: packages/structures/src/resources.ts:252

Whether the role is mentionable.


name: string

Defined in: packages/structures/src/resources.ts:242

Role name.


permissions: PermissionsBitField

Defined in: packages/structures/src/resources.ts:248

Permission bitfield.


position: number

Defined in: packages/structures/src/resources.ts:254

Role position in the hierarchy.


tags: Record<string, unknown> | null

Defined in: packages/structures/src/resources.ts:266

Role tags metadata (bot, premium subscriber, etc).


unicodeEmoji: string | null

Defined in: packages/structures/src/resources.ts:256

Unicode emoji used as the role icon, if any.

get colorHex(): string

Defined in: packages/structures/src/resources.ts:309

Returns the role’s color as a #RRGGBB hex string. Returns #000000 for colorless roles.

string


get createdAt(): Date

Defined in: packages/structures/src/base.ts:29

Returns the timestamp this snowflake was created at.

Date

BaseStructure.createdAt


get createdTimestamp(): number

Defined in: packages/structures/src/base.ts:25

Milliseconds since the Unix epoch at which this snowflake was created.

number

BaseStructure.createdTimestamp

iconURL(options?): string | null

Defined in: packages/structures/src/resources.ts:314

Returns the role’s custom icon URL, or null if the role has no icon.

ImageURLOptions = {}

string | null


isEveryone(guildId): boolean

Defined in: packages/structures/src/resources.ts:320

Whether this is the @everyone base role (its ID equals the guild ID).

string

boolean


toString(): string

Defined in: packages/structures/src/resources.ts:325

Discord role mention string. Used automatically in template literals.

string

BaseStructure.toString