Carbon
CoreClasses

Role

Extends

  • Base

Type Parameters

Type ParameterDefault type
IsPartial extends booleanfalse

Constructors

new Role()

new Role<IsPartial>(client, rawDataOrId): Role<IsPartial>

Parameters

ParameterType
clientClient
rawDataOrIdIsPartial extends true ? string : APIRole

Returns

Role<IsPartial>

Overrides

Base.constructor

Properties

PropertyModifierTypeDescriptionInherited from
clientpublicClient-Base.client
idreadonlystringThe ID of the role.-

Accessors

color

get color(): IfPartial<IsPartial, number>

The color of the role.

Returns

IfPartial<IsPartial, number>


flags

get flags(): IfPartial<IsPartial, RoleFlags>

The flags of this role.

See

https://discord.com/developers/docs/topics/permissions#role-object-role-flags

Returns

IfPartial<IsPartial, RoleFlags>


hoisted

get hoisted(): IfPartial<IsPartial, boolean>

If this role is hoisted.

Returns

IfPartial<IsPartial, boolean>


icon

get icon(): IfPartial<IsPartial, null | string>

The icon hash of the role. You can use Role.iconUrl to get the URL of the icon.

Returns

IfPartial<IsPartial, null | string>


iconUrl

get iconUrl(): IfPartial<IsPartial, null | string>

Get the URL of the role's icon

Returns

IfPartial<IsPartial, null | string>


managed

get managed(): IfPartial<IsPartial, boolean>

If this role is managed by an integration.

Returns

IfPartial<IsPartial, boolean>


mentionable

get mentionable(): IfPartial<IsPartial, boolean>

If this role is mentionable.

Returns

IfPartial<IsPartial, boolean>


name

get name(): IfPartial<IsPartial, string>

The name of the role.

Returns

IfPartial<IsPartial, string>


partial

get partial(): IsPartial

Whether the role is a partial role (meaning it does not have all the data). If this is true, you should use Role.fetch to get the full data of the role.

Returns

IsPartial


permissions

get permissions(): IfPartial<IsPartial, string>

The permissions of the role.

Returns

IfPartial<IsPartial, string>


position

get position(): IfPartial<IsPartial, number>

The position of the role.

Returns

IfPartial<IsPartial, number>


tags

get tags(): IfPartial<IsPartial, undefined | APIRoleTags>

The tags of this role.

See

https://discord.com/developers/docs/topics/permissions#role-object-role-tags-structure

Returns

IfPartial<IsPartial, undefined | APIRoleTags>


unicodeEmoji

get unicodeEmoji(): IfPartial<IsPartial, null | string>

The unicode emoji for the role.

Returns

IfPartial<IsPartial, null | string>

Methods

delete()

delete(guildId): Promise<void>

Parameters

ParameterType
guildIdstring

Returns

Promise<void>


fetch()

fetch(guildId): Promise<void>

Fetch updated data for this role. If the role is partial, this will fetch all the data for the role and populate the fields. If the role is not partial, all fields will be updated with new values from Discord.

Parameters

ParameterType
guildIdstring

Returns

Promise<void>


setColor()

setColor(guildId, color): Promise<void>

Set the color of the role

Parameters

ParameterType
guildIdstring
colornumber

Returns

Promise<void>


setHoisted()

setHoisted(guildId, hoisted): Promise<void>

Set the hoisted status of the role

Parameters

ParameterType
guildIdstring
hoistedboolean

Returns

Promise<void>


setIcon()

setIcon(guildId, icon): Promise<void>

Set the icon of the role

Parameters

ParameterTypeDescription
guildIdstring-
iconstringThe unicode emoji or icon URL to set

Returns

Promise<void>


setMentionable()

setMentionable(guildId, mentionable): Promise<void>

Set the mentionable status of the role

Parameters

ParameterType
guildIdstring
mentionableboolean

Returns

Promise<void>


setName()

setName(guildId, name): Promise<void>

Set the name of the role

Parameters

ParameterType
guildIdstring
namestring

Returns

Promise<void>


setPermissions()

setPermissions(guildId, permissions): Promise<void>

Set the permissions of the role

Parameters

ParameterTypeDescription
guildIdstring-
permissionsstringThe permissions to set as a BitField string, until a better permission structure is implemented

Returns

Promise<void>


setPosition()

setPosition(guildId, position): Promise<void>

Set the position of the role

Parameters

ParameterType
guildIdstring
positionnumber

Returns

Promise<void>

On this page

Edit on GitHub