Carbon
Core/Classes

User

Extends

  • Base

Type Parameters

Type ParameterDefault type
IsPartial extends booleanfalse

Constructors

Constructor

new User<IsPartial>(client, rawDataOrId): User<IsPartial>

Parameters

ParameterType
clientClient
rawDataOrIdIsPartial extends true ? string : APIUser

Returns

User<IsPartial>

Overrides

Base.constructor

Properties

PropertyModifierTypeDescriptionInherited from
clientpublicClient-Base.client
idreadonlystringThe ID of the user-

Accessors

accentColor

Get Signature

get accentColor(): IfPartial<IsPartial, null | number>

The accent color of the user.

Returns

IfPartial<IsPartial, null | number>


avatar

Get Signature

get avatar(): IfPartial<IsPartial, null | string>

The avatar hash of the user. You can use User.avatarUrl to get the URL of the avatar.

Returns

IfPartial<IsPartial, null | string>


avatarUrl

Get Signature

get avatarUrl(): IfPartial<IsPartial, null | string>

Get the URL of the user's avatar

Returns

IfPartial<IsPartial, null | string>


Get Signature

get banner(): IfPartial<IsPartial, null | string>

The banner hash of the user. You can use User.bannerUrl to get the URL of the banner.

Returns

IfPartial<IsPartial, null | string>


bannerUrl

Get Signature

get bannerUrl(): IfPartial<IsPartial, null | string>

Get the URL of the user's banner

Returns

IfPartial<IsPartial, null | string>


bot

Get Signature

get bot(): IfPartial<IsPartial, boolean>

Is this user a bot?

Returns

IfPartial<IsPartial, boolean>


discriminator

Get Signature

get discriminator(): IfPartial<IsPartial, string>

The discriminator of the user.

Returns

IfPartial<IsPartial, string>


flags

Get Signature

get flags(): IfPartial<IsPartial, undefined | UserFlags>

The public flags of the user. (Bitfield)

See

https://discord.com/developers/docs/resources/user#user-object-user-flags

Returns

IfPartial<IsPartial, undefined | UserFlags>


globalName

Get Signature

get globalName(): IfPartial<IsPartial, null | string>

The global name of the user.

Returns

IfPartial<IsPartial, null | string>


partial

Get Signature

get partial(): IsPartial

Whether the user is a partial user (meaning it does not have all the data). If this is true, you should use User.fetch to get the full data of the user.

Returns

IsPartial


system

Get Signature

get system(): IfPartial<IsPartial, boolean>

Is this user a system user?

Returns

IfPartial<IsPartial, boolean>


username

Get Signature

get username(): IfPartial<IsPartial, string>

The username of the user.

Returns

IfPartial<IsPartial, string>

Methods

createDm()

createDm(userId): Promise<APIDMChannel>

Instantiate a new DM channel with this user.

Parameters

ParameterType
userIdstring

Returns

Promise<APIDMChannel>


fetch()

fetch(): Promise<User<false>>

Fetch updated data for this user. If the user is partial, this will fetch all the data for the user and populate the fields. If the user is not partial, all fields will be updated with new values from Discord.

Returns

Promise<User<false>>

A Promise that resolves to a non-partial User


send()

send(data): Promise<Message<false>>

Send a message to this user.

Parameters

ParameterType
dataMessagePayload

Returns

Promise<Message<false>>

On this page