Skip to main content
Version: 0.9.1

Class: User

The base class for all structures.

Extends​

Extended by​

Constructors​

Constructor​

new User(client, data): User

Parameters​

ParameterType
clientClient
data{ }

Returns​

User

Overrides​

Base.constructor

Properties​

avatar?​

optional avatar?: Attachment | null


badges?​

optional badges?: number


bot​

bot: false | BotInformation


cachedAt​

cachedAt: number

Inherited from​

Base.cachedAt


client​

protected readonly client: Client

Inherited from​

Base.client


createdAt​

createdAt: Date


createdTimestamp​

createdTimestamp: number


discriminator​

discriminator: string


displayName?​

optional displayName?: string | null


flags?​

optional flags?: number


id​

readonly id: string

Inherited from​

Base.id


online​

online: boolean


privileged?​

optional privileged?: boolean


pronouns?​

optional pronouns?: string | null = null


relationship​

relationship: UserRelationShip


status?​

optional status?: { } | null


username​

username: string

Accessors​

tag​

Get Signature​

get tag(): string

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

Returns​

string

Methods​

_clone()​

_clone(): this

Helper to quickly clone a structure

Returns​

this

Inherited from​

Base._clone


_patch()​

_patch(data, clear?): void

Parameters​

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

Returns​

void


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​

Base.equals


fetch()​

fetch(force?): Promise<User>

Fetch a User to update their information

Parameters​

ParameterTypeDefault valueDescription
forcebooleanfalseSkip the cache check and force an API request

Returns​

Promise<User>

The fetched User object

Throws​

Error if the user cannot be found or fetched

Example​

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

toString()​

toString(): string

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

Returns​

string

Inherited from​

Base.toString