Skip to content

Role

Represents a role in a guild.

Kind: global class
Extends: Base

Constructs a new Role object.

ParamTypeDescription
[data]ObjectThe data for the role.
guildIdstringThe ID of the guild that the role belongs to.
clientClientThe client instance.

Retrieves the guild associated with this guildId.

Kind: instance property of Role
Returns: The guild object if found, otherwise null.

role.members ⇒ Collection.<Snowflake, GuildMember>

Section titled “role.members ⇒ Collection.<Snowflake, GuildMember>”

Retrieves the members of the guild who have the specified role.

Kind: instance property of Role
Returns: Collection.<Snowflake, GuildMember> - A collection of guild members who have the role.

Fetches the roles for the guild.

Kind: instance method of Role
Returns: Promise - A promise that resolves with the fetched roles.

ParamTypeDescription
[options]ObjectOptional parameters for the fetch operation.

Edits the role with the specified options.

Kind: instance method of Role
Returns: Promise - A promise that resolves when the role has been edited.

ParamTypeDescription
optionsObjectThe options to edit the role with.

Deletes the role from the guild.

Kind: instance method of Role
Returns: Promise.<void> - - A promise that resolves when the role is deleted.

ParamTypeDescription
reasonstringThe reason for deleting the role.

Clones the current role.

Kind: instance method of Role
Returns: Promise.<Role> - A promise that resolves to the cloned role.

Sets the name of an object and provides a reason for the change.

Kind: instance method of Role
Returns: Promise - A promise that resolves when the name is successfully set.

ParamTypeDescription
namestringThe new name to set.
reasonstringThe reason for changing the name.

role.setPermissions(permissions, reason) ⇒ Promise

Section titled “role.setPermissions(permissions, reason) ⇒ Promise”

Sets the permissions for an entity with the given reason.

Kind: instance method of Role
Returns: Promise - - A promise that resolves when the permissions are set.

ParamTypeDescription
permissionsObjectThe permissions to set for the entity.
reasonstringThe reason for setting the permissions.

Sets the color of an object and provides a reason for the change.

Kind: instance method of Role
Returns: Promise - - A promise that resolves when the color is successfully set.

ParamTypeDescription
colorstringThe new color to set.
reasonstringThe reason for the color change.

Sets the hoist value and reason for a specific item.

Kind: instance method of Role
Returns: Promise - - A promise that resolves when the hoist value is set.

ParamTypeDescription
hoistbooleanThe hoist value to set.
reasonstringThe reason for setting the hoist value.

Sets the icon of an object and provides a reason for the change.

Kind: instance method of Role
Returns: Promise - A promise that resolves when the icon is successfully set.

ParamTypeDescription
iconanyThe new icon to set.
reasonstringThe reason for changing the icon.

role.setUnicodeEmoji(unicodeEmoji, reason) ⇒ Promise

Section titled “role.setUnicodeEmoji(unicodeEmoji, reason) ⇒ Promise”

Sets the unicode emoji for an entity.

Kind: instance method of Role
Returns: Promise - A promise that resolves when the unicode emoji is set.

ParamTypeDescription
unicodeEmojistringThe unicode emoji to set.
reasonstringThe reason for setting the unicode emoji.

role.setMentionable(mentionable, reason) ⇒ Promise.<void>

Section titled “role.setMentionable(mentionable, reason) ⇒ Promise.<void>”

Sets the mentionable status of an entity.

Kind: instance method of Role
Returns: Promise.<void> - - A promise that resolves when the mentionable status is set.

ParamTypeDescription
mentionablebooleanWhether the entity should be mentionable or not.
reasonstringThe reason for setting the mentionable status.

Sets the position of the role within the guild’s role hierarchy.

Kind: instance method of Role
Returns: Promise.<Role> - - A promise that resolves to the modified Role object.

ParamTypeDescription
positionnumberThe new position of the role.
reasonstringThe reason for modifying the role’s position.

role.permissionsIn(channel) ⇒ Permissions

Section titled “role.permissionsIn(channel) ⇒ Permissions”

Retrieves the permissions of the bot in the specified channel.

Kind: instance method of Role
Returns: Permissions - - The permissions of the bot in the channel.
Throws:

  • RangeError - If the channel is not cached.
ParamTypeDescription
channelstring | ChannelThe channel to check permissions in.

role.deniedPermissionsIn(channel) ⇒ PermissionFlags | null

Section titled “role.deniedPermissionsIn(channel) ⇒ PermissionFlags | null”

Retrieves the denied permissions for the specified channel.

Kind: instance method of Role
Returns: PermissionFlags | null - - The denied permissions for the channel, or null if no permissions are found.
Throws:

  • RangeError - If the channel is not cached.
ParamTypeDescription
channelstring | ChannelThe channel or channel ID to retrieve the permissions from.

Returns the URL of the icon for this role.

Kind: instance method of Role
Returns: string | null - The URL of the icon, or null if no icon is available.

ParamTypeDescription
optionsObjectAn optional object containing additional options for the icon URL.
[options.dynamic]booleanWhether the icon should be dynamically generated.
[options.size]numberThe desired size of the icon.
[options.format]stringThe desired format of the icon.