Class User

Represents a user.

Hierarchy

Constructors

Properties

accentColor?: null | number

The user's banner color. If this member was received via the gateway, this will never be present.

avatar: null | string

The user's avatar hash.

avatarDecoration?: null | string

The hash of this user's avatar decoration. This will always resolve to a png.

banner?: null | string

The user's banner hash. If this member was received via the gateway, this will never be present.

bot: boolean

If this user is a bot.

discriminator: string

The 4 digits after the user's username.

id: string
publicFlags: number

The user's public flags.

system: boolean

If this user is an official discord system user.

username: string

The user's username.

Accessors

  • get defaultAvatar(): number
  • The default avatar value of this user (discriminator modulo 5).

    Returns number

  • get tag(): string
  • a combination of this user's username and discriminator.

    Returns string

Methods

  • The url of this user's avatar decoration. This will always be a png. Discord does not combine the decoration and their current avatar for you. This is ONLY the decoration.

    Note

    As of 12/8/2022 (Dec 8) avatar_decoration is only visible to bots if they set an X-Super-Properties header with a client_build_number ~162992. You can do this via the rest.superProperties option.

    Parameters

    • Optional size: number

      The dimensions of the image.

    Returns null | string

  • The url of this user's avatar (or default avatar, if they have not set an avatar).

    Parameters

    • Optional format: "jpg" | "jpeg" | "png" | "webp" | "gif"

      The format the url should be.

    • Optional size: number

      The dimensions of the image.

    Returns string