Role
Extends
Base
Type Parameters
Type Parameter | Default type |
---|---|
IsPartial extends boolean | false |
Constructors
new Role()
new Role<
IsPartial
>(client
,rawDataOrId
):Role
<IsPartial
>
Parameters
Parameter | Type |
---|---|
client | Client |
rawDataOrId | IsPartial extends true ? string : APIRole |
Returns
Role
<IsPartial
>
Overrides
Base.constructor
Properties
Property | Modifier | Type | Description | Inherited from |
---|---|---|---|---|
client | public | Client | - | Base.client |
id | readonly | string | The 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
Parameter | Type |
---|---|
guildId | string |
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
Parameter | Type |
---|---|
guildId | string |
Returns
Promise
<void
>
setColor()
setColor(
guildId
,color
):Promise
<void
>
Set the color of the role
Parameters
Parameter | Type |
---|---|
guildId | string |
color | number |
Returns
Promise
<void
>
setHoisted()
setHoisted(
guildId
,hoisted
):Promise
<void
>
Set the hoisted status of the role
Parameters
Parameter | Type |
---|---|
guildId | string |
hoisted | boolean |
Returns
Promise
<void
>
setIcon()
setIcon(
guildId
,icon
):Promise
<void
>
Set the icon of the role
Parameters
Parameter | Type | Description |
---|---|---|
guildId | string | - |
icon | string | The unicode emoji or icon URL to set |
Returns
Promise
<void
>
setMentionable()
setMentionable(
guildId
,mentionable
):Promise
<void
>
Set the mentionable status of the role
Parameters
Parameter | Type |
---|---|
guildId | string |
mentionable | boolean |
Returns
Promise
<void
>
setName()
setName(
guildId
,name
):Promise
<void
>
Set the name of the role
Parameters
Parameter | Type |
---|---|
guildId | string |
name | string |
Returns
Promise
<void
>
setPermissions()
setPermissions(
guildId
,permissions
):Promise
<void
>
Set the permissions of the role
Parameters
Parameter | Type | Description |
---|---|---|
guildId | string | - |
permissions | string | The 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
Parameter | Type |
---|---|
guildId | string |
position | number |
Returns
Promise
<void
>