Role
Defined in: packages/structures/src/resources.ts:240
A Discord guild role.
Extends
Section titled “Extends”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new Role(
data):Role
Defined in: packages/structures/src/resources.ts:269
Creates a role from Discord data.
Parameters
Section titled “Parameters”Discord role payload.
color?
Section titled “color?”number
colors?
Section titled “colors?”{ primary_color: number; secondary_color: number | null; tertiary_color: number | null; }
colors.primary_color
Section titled “colors.primary_color”number
colors.secondary_color
Section titled “colors.secondary_color”number | null
colors.tertiary_color
Section titled “colors.tertiary_color”number | null
hoist?
Section titled “hoist?”boolean
string | null
string
managed?
Section titled “managed?”boolean
mentionable?
Section titled “mentionable?”boolean
string
permissions?
Section titled “permissions?”string
position?
Section titled “position?”number
Record<string, unknown> | null
unicode_emoji?
Section titled “unicode_emoji?”string | null
Returns
Section titled “Returns”Role
Overrides
Section titled “Overrides”Properties
Section titled “Properties”color:
number
Defined in: packages/structures/src/resources.ts:244
Role color as a 24-bit RGB integer.
colors
Section titled “colors”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
Section titled “iconHash”iconHash:
string|null
Defined in: packages/structures/src/resources.ts:258
Hash of the role’s custom icon image, if any.
readonlyid:string
Defined in: packages/structures/src/base.ts:12
Inherited from
Section titled “Inherited from”managed
Section titled “managed”managed:
boolean
Defined in: packages/structures/src/resources.ts:250
Whether the role is managed by an integration.
mentionable
Section titled “mentionable”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
Section titled “permissions”permissions:
PermissionsBitField
Defined in: packages/structures/src/resources.ts:248
Permission bitfield.
position
Section titled “position”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
Section titled “unicodeEmoji”unicodeEmoji:
string|null
Defined in: packages/structures/src/resources.ts:256
Unicode emoji used as the role icon, if any.
Accessors
Section titled “Accessors”colorHex
Section titled “colorHex”Get Signature
Section titled “Get Signature”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.
Returns
Section titled “Returns”string
createdAt
Section titled “createdAt”Get Signature
Section titled “Get Signature”get createdAt():
Date
Defined in: packages/structures/src/base.ts:29
Returns the timestamp this snowflake was created at.
Returns
Section titled “Returns”Date
Inherited from
Section titled “Inherited from”createdTimestamp
Section titled “createdTimestamp”Get Signature
Section titled “Get Signature”get createdTimestamp():
number
Defined in: packages/structures/src/base.ts:25
Milliseconds since the Unix epoch at which this snowflake was created.
Returns
Section titled “Returns”number
Inherited from
Section titled “Inherited from”BaseStructure.createdTimestamp
Methods
Section titled “Methods”iconURL()
Section titled “iconURL()”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.
Parameters
Section titled “Parameters”options?
Section titled “options?”ImageURLOptions = {}
Returns
Section titled “Returns”string | null
isEveryone()
Section titled “isEveryone()”isEveryone(
guildId):boolean
Defined in: packages/structures/src/resources.ts:320
Whether this is the @everyone base role (its ID equals the guild ID).
Parameters
Section titled “Parameters”guildId
Section titled “guildId”string
Returns
Section titled “Returns”boolean
toString()
Section titled “toString()”toString():
string
Defined in: packages/structures/src/resources.ts:325
Discord role mention string. Used automatically in template literals.
Returns
Section titled “Returns”string