Class User

Represents a user.

Hierarchy (view full)

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 this user's username, if they have not been migrated. If migrated, this will be a single "0".

globalName: null | string

The user's display name, if set.

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 isMigrated(): boolean
  • If this user has migrated to the new username system.

    Returns boolean

  • get tag(): string
  • This user's unique username, if migrated, else a combination of the 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.

    Parameters

    • Optional size: number

      The dimensions of the image.

    Returns null | string

    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.

  • 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

  • The url of this user's banner.

    Parameters

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

      The format the url should be.

    • Optional size: number

      The dimensions of the image.

    Returns null | string

  • Create a test entitlement for this user.

    Parameters

    • skuID: string

      The ID of the SKU to create an entitlement for.

    • Optional applicationID: string

      The ID of the application to create the entitlement for. If present, defaults to the logged in client's application id.

    Returns Promise<TestEntitlement>