Represents a user on Discord.
Extends
BaseConstructs a new instance of the
User
className | Type | Optional | Description |
---|---|---|---|
client | Client<true> | No | None |
data | RawUserData | No | None |
The base 10 accent color of the user's banner The user must be force fetched for this property to be present or be updated
The user banner's hash The user must be force fetched for this property to be present or be updated
The discriminator of this user
'0'
, or a 4-digit stringified number if they're using the legacy username systemThe hexadecimal version of the user accent color, with a leading hash The user must be force fetched for this property to be present
The tag of this user This user's username, or their legacy tag (e.g.
hydrabolt#0001
) if they're using the legacy username systemA link to the user's avatar decoration.
Returns
Name | Type | Optional | Description |
---|---|---|---|
options | BaseImageURLOptions | Yes | None |
A link to the user's avatar.
Returns
Name | Type | Optional | Description |
---|---|---|---|
options | ImageURLOptions | Yes | Options for the image URL |
A link to the user's banner. See for more info
Returns
Name | Type | Optional | Description |
---|---|---|---|
options | ImageURLOptions | Yes | Options for the image URL |
Creates a DM channel between the client and the user.
Name | Type | Optional | Description |
---|---|---|---|
force | boolean | Yes | Whether to skip the cache check and request the API |
Deletes a DM channel (if one exists) between the client and the user. Resolves with the channel if successful.
A link to the user's avatar if they have one. Otherwise a link to their default avatar will be returned.
Name | Type | Optional | Description |
---|---|---|---|
options | ImageURLOptions | Yes | Options for the image URL |
Checks if the user is equal to another. It compares id, username, discriminator, avatar, banner, accent color, and bot flags. It is recommended to compare equality by using
user.id === user2.id
unless you want to compare all properties.Name | Type | Optional | Description |
---|---|---|---|
user | User | No | User to compare with |
Fetches this user.
Name | Type | Optional | Description |
---|---|---|---|
force | boolean | Yes | Whether to skip the cache check and request the API |
Sends a message to this user.
Example
Name | Type | Optional | Description |
---|---|---|---|
options | string | MessagePayload | MessageCreateOptions | No | The options to provide |
When concatenated with a string, this automatically returns the user's mention instead of the User object.
Example
Name | Type | Optional | Description |
---|---|---|---|
options | string | MessagePayload | MessageCreateOptions | No | None |