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.

Deprecated

Use User#avatarDecorationData.asset instead. This will be removed in 1.12.0.

avatarDecorationData: null | AvatarDecorationData

The data for this user's avatar decoration.

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.

clan: null | Clan

The primary clan this user is in.

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

  • 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>