Skip to content

User

User ⇐ Base

Represents a user in the application.

Kind: global class
Extends: Base

new User([data], client)

Constructs a new User object.

ParamTypeDescription
[data]ObjectThe data object containing user information.
clientClientThe client object.

user.fetch(options) ⇒ Promise

Fetches user data using the provided options.

Kind: instance method of User
Returns: Promise - A promise that resolves with the fetched user data.

ParamTypeDescription
optionsObjectThe options for fetching user data.

user.createDM() ⇒ Promise.<DMChannel>

Creates a direct message (DM) channel with the user associated with this instance of the client.

Kind: instance method of User
Returns: Promise.<DMChannel> - A promise that resolves to the created DM channel.

user.send(options) ⇒ Promise

Sends a message to the user using the client’s user send method.

Kind: instance method of User
Returns: Promise - A promise that resolves when the message is sent.

ParamTypeDescription
optionsobjectOptional parameters for sending the message.

user.defaultAvatarURL(format) ⇒ string | null

Returns the URL of the default avatar for the user in the specified format.

Kind: instance method of User
Returns: string | null - The URL of the default avatar image, or null if it is not available.

ParamTypeDescription
formatstringThe format of the avatar image (e.g. “png”, “jpg”, “gif”).

user.displayAvatarURL(options) ⇒ string

Returns the URL of the avatar for the user.

Kind: instance method of User
Returns: string - The URL of the user’s avatar.

ParamTypeDescription
optionsObjectThe options for generating the avatar URL.
[options.dynamic]booleanWhether to generate a dynamic avatar URL.
[options.size]numberThe size of the avatar.
[options.format]stringThe format of the avatar image.

user.bannerURL(options) ⇒ string | null

Generates the URL for the user’s banner image.

Kind: instance method of User
Returns: string | null - The URL of the user’s banner image, or null if no banner is set.

ParamTypeDescription
optionsObjectOptional parameters for customizing the URL.
[options.dynamic]booleanWhether to include dynamic content in the URL.
[options.size]stringThe desired size of the banner image.
[options.format]stringThe desired format of the banner image.

user.avatarDecorationURL(options) ⇒ string | null

Returns the URL of the avatar decoration for the user.

Kind: instance method of User
Returns: string | null - The URL of the avatar decoration, or null if no decoration is set.

ParamTypeDescription
optionsObjectOptional parameters for the URL generation.
options.sizenumberThe desired size of the avatar decoration.
options.formatstringThe desired format of the avatar decoration.

user.hexAccentColor() ⇒ string | null

Returns the hexadecimal representation of the accent color.

Kind: instance method of User
Returns: string | null - - The hexadecimal representation of the accent color, or null if the accent color is not set.