Results

Namespace

Type

A role belongs to a discord.Guild and can be assigned to groups of discord.GuildMembers to change the color of their name and apply permission changes.

Multiple roles can be assigned to a single user.

Roles can be hoisted in the member list (displayed separately), and ordered.

Hierarchy

  • Role <-- You are here!

Implements

Index

Properties

Readonly color

color: number

The color for this role. It is a hexadecimal color code represented in integer format.

The default color for roles (no color) is 0.

Readonly guildId

guildId: Snowflake

The id of the discord.Guild this role belongs to.

Readonly hoist

hoist: boolean

true if this role is hoisted in the member list (displayed separately).

Members are grouped into their highest positioned role in the member list if a role is hoisted.

Readonly id

The role's unique Discord id. This field never changes.

Readonly managed

managed: boolean

true if this role was created by an integration or bot application.

Managed roles have restrictions around what can be edited, depending on the application.

Readonly mentionable

mentionable: boolean

true if this role can be mentioned in messages by members of the guild.

When a role is mentioned, they receive a ping/notification if they have notifications enabled for mentions on the guild.

Readonly name

name: string

The display name for the role.

Readonly permissions

permissions: number

The permission bit set assigned to this role. Members receive permissions in the order roles are positioned.

Readonly position

position: number

The position of this role.

Hoisted roles are displayed in this order.

Role permissions are applied to members in the order of the permission set on roles.

Methods

delete

  • delete(): Promise<void>
  • Deletes the role and removes it from all the members who had it assigned.

    If an error occurs, a discord.ApiError is thrown.

    Returns Promise<void>

edit

  • edit(options: IRoleOptions): Promise<Role>
  • Updates the guild role.

    All properties of the options parameter are optional, but you must send at least one modification.

    If an error occurs, a discord.ApiError is thrown.

    Parameters

    Returns Promise<Role>

toMention

  • toMention(): string
  • Returns a mention string in the format of <@!id> where id is the id of this user.

    Can be used in a message to mention/ping the role.

    Returns string

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc