Skip to content
SinisterRectus edited this page Dec 8, 2018 · 21 revisions

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
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.
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.
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().

Properties

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

__hash()

Returns Snowflake.id

Returns: string

Methods

delete()

Permanently deletes the role. This cannot be undone!

Returns: boolean

disableAllPermissions()

Disables all permissions for this role. This does not necessarily fully disallow the permissions.

Returns: boolean

disableMentioning()

Disallows anyone to mention this role in text messages.

Returns: boolean

disablePermissions(...)

Parameter Type
... Permission-Resolvables

Disables individual permissions for this role. This does not necessarily fully disallow the permissions.

Returns: boolean

enableAllPermissions()

Enables all permissions for this role. This does not necessarily fully allow the permissions.

Returns: boolean

enableMentioning()

Allows anyone to mention this role in text messages.

Returns: boolean

enablePermissions(...)

Parameter Type
... Permission-Resolvables

Enables individual permissions for this role. This does not necessarily fully allow the permissions.

Returns: boolean

getColor()

Returns a color object that represents the role's display color.

Returns: Color

getPermissions()

Returns a permissions object that represents the permissions that this role has enabled.

Returns: Permissions

hoist()

Causes members with this role to display above unhoisted roles in the member list.

Returns: boolean

moveDown(n)

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.

Returns: boolean

moveUp(n)

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.

Returns: boolean

setColor(color)

Parameter Type
color Color-Resolvable

Sets the role's display color.

Returns: boolean

setName(name)

Parameter Type
name string

Sets the role's name. The name must be between 1 and 100 characters in length.

Returns: boolean

setPermissions(permissions)

Parameter Type
permissions Permissions-Resolvable

Sets the permissions that this role explicitly allows.

Returns: boolean

unhoist()

Causes member with this role to display amongst other unhoisted members.

Returns: boolean

Clone this wiki locally