Represents the payload for creating or updating a role in a guild. This class encapsulates all the parameters needed to define a role.

Constructors

  • Creates a new RolePayload instance.

    Parameters

    • Optionaldata: {
          color?: number;
          hoist?: boolean;
          icon?: string;
          mentionable?: boolean;
          name?: string;
          permissions?: string;
          unicode_emoji?: string;
      }

      Optional initial data to set in the payload.

      • Optionalcolor?: number
      • Optionalhoist?: boolean
      • Optionalicon?: string
      • Optionalmentionable?: boolean
      • Optionalname?: string
      • Optionalpermissions?: string
      • Optionalunicode_emoji?: string

    Returns RolePayload

Accessors

  • get color(): number
  • Gets the color of the role.

    Returns number

    The color as an integer.

  • set color(value): void
  • Sets the color of the role.

    Parameters

    • value: number

      The color as an integer (RGB value).

    Returns void

  • get hoist(): boolean
  • Gets the hoist status of the role.

    Returns boolean

    True if the role should be hoisted.

  • set hoist(value): void
  • Sets the hoist status of the role.

    Parameters

    • value: boolean

      True if the role should be displayed separately in the sidebar.

    Returns void

  • get icon(): string
  • Gets the icon for the role.

    Returns string

    The icon as a string, or null if not set.

  • set icon(value): void
  • Sets the icon for the role.

    Parameters

    • value: string

      The icon as a string, or null to remove it.

    Returns void

  • get mentionable(): boolean
  • Gets the mentionable status of the role.

    Returns boolean

    True if the role is mentionable.

  • set mentionable(value): void
  • Sets the mentionable status of the role.

    Parameters

    • value: boolean

      True if the role should be mentionable.

    Returns void

  • get name(): string
  • Gets the name of the role.

    Returns string

    The name of the role.

  • set name(value): void
  • Sets the name of the role.

    Parameters

    • value: string

      The name of the role (max 100 characters).

    Returns void

    Error if the name exceeds 100 characters.

  • get permissions(): string
  • Gets the permissions for the role.

    Returns string

    The permissions as a string.

  • set permissions(value): void
  • Sets the permissions for the role.

    Parameters

    • value: string

      The permissions as a bitwise string.

    Returns void

  • get unicodeEmoji(): string
  • Gets the unicode emoji for the role.

    Returns string

    The unicode emoji as a string, or null if not set.

  • set unicodeEmoji(value): void
  • Sets the unicode emoji for the role.

    Parameters

    • value: string

      The unicode emoji as a string, or null to remove it.

    Returns void

Methods

  • Converts the payload to a JSON-serializable object.

    Returns any

    A JSON-serializable representation of the payload.