Carbon
CoreClasses

User

Extends

  • Base

Type Parameters

Type ParameterDefault type
IsPartial extends booleanfalse

Constructors

new User()

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 accentColor(): IfPartial<IsPartial, null | number>

The accent color of the user.

Returns

IfPartial<IsPartial, null | number>


avatar

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 avatarUrl(): IfPartial<IsPartial, null | string>

Get the URL of the user's avatar

Returns

IfPartial<IsPartial, null | string>


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 bannerUrl(): IfPartial<IsPartial, null | string>

Get the URL of the user's banner

Returns

IfPartial<IsPartial, null | string>


bot

get bot(): IfPartial<IsPartial, boolean>

Is this user a bot?

Returns

IfPartial<IsPartial, boolean>


discriminator

get discriminator(): IfPartial<IsPartial, string>

The discriminator of the user.

Returns

IfPartial<IsPartial, string>


flags

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 globalName(): IfPartial<IsPartial, null | string>

The global name of the user.

Returns

IfPartial<IsPartial, null | string>


partial

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 system(): IfPartial<IsPartial, boolean>

Is this user a system user?

Returns

IfPartial<IsPartial, boolean>


username

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

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


send()

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

Send a message to this user.

Parameters

ParameterType
dataMessagePayload

Returns

Promise<Message<false>>

On this page

Edit on GitHub