-
Notifications
You must be signed in to change notification settings - Fork 144
Role
extends Snowflake
Represents a Discord guild role, which is used to assign priority, permissions, and a color to guild members.
Instances of this class should not be constructed by users.
Properties Inherited From Snowflake
Name | Type | Description |
---|---|---|
client | Client | A shortcut to the client object to which this container is visible. |
createdAt | number | The Unix time in seconds at which this object was created by Discord. Additional decimal points may be present, though only the first 3 (milliseconds) should be considered accurate. Equivalent to Date.parseSnowflake(Snowflake.id) . |
id | string | The Snowflake ID that can be used to identify the object. This is guaranteed to be unique except in cases where an object shares the ID of its parent. |
parent | Container/Client | The parent object of to which this container is a child. For example, the parent of a role is the guild in which the role exists. |
timestamp | string | The date and time at which this object was created by Discord, represented as an ISO 8601 string plus microseconds when available. Equivalent to Date.fromSnowflake(Snowflake.id):toISO() . |
Name | Type | Description |
---|---|---|
color | number | Represents the display color of the role as a decimal value. |
emojis | FilteredIterable | A filtered iterable of guild emojis that have this role. If you want to check whether a specific emoji has this role, it would be better to get the emoji object elsewhere and use Emoji:hasRole rather than check whether the emoji exists here. |
guild | Guild | The guild in which this role exists. |
hoisted | boolean | Whether members with this role should be shown separated from other members in the guild member list. |
managed | boolean | Whether this role is managed by some integration or bot inclusion. |
members | FilteredIterable | A filtered iterable of guild members that have this role. If you want to check whether a specific member has this role, it would be better to get the member object elsewhere and use Member:hasRole rather than check whether the member exists here. |
mentionString | string | A string that, when included in a message content, may resolve as a role notification in the official Discord client. |
mentionable | boolean | Whether this role can be mentioned in a text channel message. |
name | string | The name of the role. This should be between 1 and 100 characters in length. |
permissions | number | Represents the total permissions of the role as a decimal value. |
position | number | The position of the role, where 0 is the lowest. |
Methods Inherited From Snowflake
Defines the behavior of the ==
operator. Allows containers to be directly compared according to their type and __hash
return values.
Returns: boolean
Returns Snowflake.id
Returns: string
Defines the behavior of the tostring
function. All containers follow the format ClassName: hash
.
Returns: string
Returns a unique Date object that represents when the object was created by Discord. Equivalent to Date.fromSnowflake(Snowflake.id)
This method only operates on data in memory.
Returns: Date
Permanently deletes the role. This cannot be undone!
This method always makes an HTTP request.
Returns: boolean
Disables all permissions for this role. This does not necessarily fully disallow the permissions.
This method always makes an HTTP request.
Returns: boolean
Disallows anyone to mention this role in text messages.
This method always makes an HTTP request.
Returns: boolean
Parameter | Type |
---|---|
... | Permission-Resolvables |
Disables individual permissions for this role. This does not necessarily fully disallow the permissions.
This method always makes an HTTP request.
Returns: boolean
Enables all permissions for this role. This does not necessarily fully allow the permissions.
This method always makes an HTTP request.
Returns: boolean
Allows anyone to mention this role in text messages.
This method always makes an HTTP request.
Returns: boolean
Parameter | Type |
---|---|
... | Permission-Resolvables |
Enables individual permissions for this role. This does not necessarily fully allow the permissions.
This method always makes an HTTP request.
Returns: boolean
Returns a color object that represents the role's display color.
This method only operates on data in memory.
Returns: Color
Returns a permissions object that represents the permissions that this role has enabled.
This method only operates on data in memory.
Returns: Permissions
Causes members with this role to display above unhoisted roles in the member list.
This method always makes an HTTP request.
Returns: boolean
Parameter | Type |
---|---|
n | number |
Moves a role down its list. The parameter n
indicates how many spaces the role should be moved, clamped to the lowest position, with a default of 1 if it is omitted. This will also normalize the positions of all roles. Note that the default everyone role cannot be moved.
This method always makes an HTTP request.
Returns: boolean
Parameter | Type |
---|---|
n | number |
Moves a role up its list. The parameter n
indicates how many spaces the role should be moved, clamped to the highest position, with a default of 1 if it is omitted. This will also normalize the positions of all roles. Note that the default everyone role cannot be moved.
This method always makes an HTTP request.
Returns: boolean
Parameter | Type |
---|---|
color | Color-Resolvable |
Sets the role's display color.
This method always makes an HTTP request.
Returns: boolean
Parameter | Type |
---|---|
name | string |
Sets the role's name. The name must be between 1 and 100 characters in length.
This method always makes an HTTP request.
Returns: boolean
Parameter | Type |
---|---|
permissions | Permissions-Resolvable |
Sets the permissions that this role explicitly allows.
This method always makes an HTTP request.
Returns: boolean
Causes member with this role to display amongst other unhoisted members.
This method always makes an HTTP request.
Returns: boolean