Role

export class Role extends Base
export class Role extends Base
Represents a role on Discord.

Extends

Base
Readonly
client:Client<true>
The client that instantiated this
Inherited from Base
color:number
The base 10 color of the role
Readonly
createdAt:Date
The time the role was created at
Readonly
createdTimestamp:number
The timestamp the role was created at
Readonly
editable:boolean
Whether the role is editable by the client user
The flags of this role
guild:Guild
The guild that the role belongs to
Readonly
The hexadecimal version of the role color, with a leading hashtag
hoist:boolean
If true, users that are part of this role will appear in a separate category in the users list
icon:string | null
The icon hash of the role
The role's id (unique to the guild it is part of)
managed:boolean
Whether or not the role is managed by an external service
Readonly
The cached guild members that have this role
mentionable:boolean
Whether or not the role can be mentioned by anyone
name:string
The name of the role
permissions:Readonly<PermissionsBitField>
The permissions of the role
Readonly
position:number
The position of the role in the role manager
rawPosition:number
The raw position of the role from the API
tags:RoleTagData | null
The tags this role has
unicodeEmoji:string | null
The unicode emoji for the role
comparePositionTo(role):number
Compares this role's position to another role's.
Returns
Negative number if this role's position is lower (other role's is higher), positive number if this one is higher (other's is lower), 0 if equal
NameTypeOptionalDescription
roleRoleResolvableNoRole to compare to this one
delete(reason?):Promise<Role>
Deletes the role.
NameTypeOptionalDescription
reasonstringYesReason for deleting this role
edit(options):Promise<Role>
Edits the role.
NameTypeOptionalDescription
optionsRoleEditOptionsNoThe options to provide
equals(role):boolean
Whether this role equals another role. It compares all properties, so for most operations it is advisable to just compare role.id === role2.id as it is much faster and is often what most users need.
NameTypeOptionalDescription
roleRoleNoRole to compare with
iconURL(options?):string | null
A link to the role's icon
Returns
NameTypeOptionalDescription
optionsImageURLOptionsYesOptions for the image URL
permissionsIn(channel, checkAdmin?):Readonly<PermissionsBitField>
Returns channel.permissionsFor(role). Returns permissions for a role in a guild channel, taking into account permission overwrites.
NameTypeOptionalDescription
channelNonThreadGuildBasedChannel | SnowflakeNoThe guild channel to use as context
checkAdminbooleanYesWhether having the permission will return all permissions
setColor(color, reason?):Promise<Role>
Sets a new color for the role.
NameTypeOptionalDescription
colorColorResolvableNoThe color of the role
reasonstringYesReason for changing the role's color
setHoist(hoist?, reason?):Promise<Role>
Sets whether or not the role should be hoisted.
NameTypeOptionalDescription
hoistbooleanYesWhether or not to hoist the role
reasonstringYesReason for setting whether or not the role should be hoisted
setIcon(icon, reason?):Promise<Role>
Sets a new icon for the role.
NameTypeOptionalDescription
iconBufferResolvable | Base64Resolvable | EmojiResolvable | nullNoThe icon for the role The EmojiResolvable should belong to the same guild as the role. If not, pass the emoji's URL directly
reasonstringYesReason for changing the role's icon
setMentionable(mentionable?, reason?):Promise<Role>
Sets whether this role is mentionable.
NameTypeOptionalDescription
mentionablebooleanYesWhether this role should be mentionable
reasonstringYesReason for setting whether or not this role should be mentionable
setName(name, reason?):Promise<Role>
Sets a new name for the role.
NameTypeOptionalDescription
namestringNoThe new name of the role
reasonstringYesReason for changing the role's name
setPermissions(permissions, reason?):Promise<Role>
Sets the permissions of the role.
NameTypeOptionalDescription
permissionsPermissionResolvableNoThe permissions of the role
reasonstringYesReason for changing the role's permissions
setPosition(position, options?):Promise<Role>
Sets the new position of the role.
NameTypeOptionalDescription
positionnumberNoThe new position for the role
optionsSetRolePositionOptionsYesOptions for setting the position
setUnicodeEmoji(unicodeEmoji, reason?):Promise<Role>
Sets a new unicode emoji for the role.
NameTypeOptionalDescription
unicodeEmojistring | nullNoThe new unicode emoji for the role
reasonstringYesReason for changing the role's unicode emoji
toJSON():unknown
toString():RoleMention
When concatenated with a string, this automatically returns the role's mention instead of the Role object.
valueOf():string