Skip to content
SinisterRectus edited this page Sep 27, 2017 · 21 revisions

extends Snowflake

Represents a Discord guild role, which is used to assign priority, permissions, and a color to guild members.

Methods

boolean delete()

Permanently deletes the role. This cannot be undone!

boolean moveDown([n])

  • 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.

boolean moveUp([n])

  • 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.

boolean setName(name)

  • name: string

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

boolean setColor(color)

  • color: Color Resolveable

Sets the role's display color.

boolean setPermissions(permissions)

  • permissions: Permissions Resolveable

Sets the permissions that this role explicitly allows.

boolean hoist()

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

boolean unhoist()

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

boolean enableMentioning()

Allows anyone to mention this role in text messages.

boolean disableMentioning()

Disallows anyone to mention this role in text messages.

boolean enablePermissions(...)

  • ...: Permissions Resolveable(s)

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

boolean disablePermissions(...)

  • ...: Permissions Resolveable(s)

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

boolean enableAllPermissions()

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

boolean disableAllPermissions()

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

Color getColor()

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

Permissions getPermissions()

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

Properties

boolean hoisted

Whether members with this role should be shown separated from other members in the guild member list.

boolean mentionable

Whether this role can be mentioned in a text channel message.

boolean managed

Whether this role is managed by some integration or bot inclusion.

string name

The name of the role. This should be between 1 and 100 characters in length.

number position

The position of the role, where 0 is the lowest.

number color

Represents the display color of the role as a decimal value.

number permissions

Represents the total permissions of the role as a decimal value.

string mentionString

A string that, when included in a message content, may resolve as a role notification in the official Discord client.

Guild guild

The guild in which this role exists.

FilteredIterable members

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.

Clone this wiki locally