Skip to main content
Version: 0.9.1

Class: ClientUser

Represents the authenticated bot's user object.

Extends​

Constructors​

Constructor​

new ClientUser(client, data): ClientUser

Parameters​

ParameterType
clientClient
data{ }

Returns​

ClientUser

Overrides​

User.constructor

Properties​

avatar?​

optional avatar?: Attachment | null

Inherited from​

User.avatar


badges?​

optional badges?: number

Inherited from​

User.badges


bot​

bot: false | BotInformation

Inherited from​

User.bot


cachedAt​

cachedAt: number

Inherited from​

User.cachedAt


client​

protected readonly client: Client

Inherited from​

User.client


createdAt​

createdAt: Date

Inherited from​

User.createdAt


createdTimestamp​

createdTimestamp: number

Inherited from​

User.createdTimestamp


discriminator​

discriminator: string

Inherited from​

User.discriminator


displayName?​

optional displayName?: string | null

Inherited from​

User.displayName


flags?​

optional flags?: number

Inherited from​

User.flags


id​

readonly id: string

Inherited from​

User.id


online​

online: boolean

Inherited from​

User.online


privileged?​

optional privileged?: boolean

Inherited from​

User.privileged


pronouns?​

optional pronouns?: string | null = null

Inherited from​

User.pronouns


relationship​

relationship: UserRelationShip

Inherited from​

User.relationship


status?​

optional status?: { } | null

Inherited from​

User.status


username​

username: string

Inherited from​

User.username

Accessors​

tag​

Get Signature​

get tag(): string

Convenience getter to return the user's tag (username#discriminator)

Returns​

string

Inherited from​

User.tag

Methods​

_clone()​

_clone(): this

Helper to quickly clone a structure

Returns​

this

Inherited from​

User._clone


_patch()​

_patch(data, clear?): void

Parameters​

ParameterType
data{ }
clear?("Avatar" | "StatusText" | "StatusPresence" | "ProfileContent" | "ProfileBackground" | "DisplayName" | "Pronouns" | "Internal")[]

Returns​

void

Inherited from​

User._patch


equals()​

equals(other): boolean

Compares this object with another to see if they represent the same entity.

Parameters​

ParameterType
otherstring | Base

Returns​

boolean

Inherited from​

User.equals


fetch()​

fetch(force?): Promise<ClientUser>

Fetch a User to update their information

Parameters​

ParameterTypeDefault valueDescription
forcebooleanfalseSkip the cache check and force an API request

Returns​

Promise<ClientUser>

The fetched User object

Throws​

Error if the user cannot be found or fetched

Example​

// Fetch a user
await user.fetch();

Inherited from​

User.fetch


toString()​

toString(): string

Returns the UUID string when the object is cast to a string.

Returns​

string

Inherited from​

User.toString