User
User ⇐ Base
Represents a user in the application.
Kind: global class
Extends: Base
- User ⇐
Base
- new User([data], client)
- .fetch(options) ⇒
Promise
- .createDM() ⇒
Promise.<DMChannel>
- .send(options) ⇒
Promise
- .defaultAvatarURL(format) ⇒
string
|null
- .displayAvatarURL(options) ⇒
string
- .bannerURL(options) ⇒
string
|null
- .avatarDecorationURL(options) ⇒
string
|null
- .hexAccentColor() ⇒
string
|null
new User([data], client)
Constructs a new User object.
Param | Type | Description |
---|---|---|
[data] | Object | The data object containing user information. |
client | Client | The 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.
Param | Type | Description |
---|---|---|
options | Object | The 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.
Param | Type | Description |
---|---|---|
options | object | Optional 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.
Param | Type | Description |
---|---|---|
format | string | The 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.
Param | Type | Description |
---|---|---|
options | Object | The options for generating the avatar URL. |
[options.dynamic] | boolean | Whether to generate a dynamic avatar URL. |
[options.size] | number | The size of the avatar. |
[options.format] | string | The 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.
Param | Type | Description |
---|---|---|
options | Object | Optional parameters for customizing the URL. |
[options.dynamic] | boolean | Whether to include dynamic content in the URL. |
[options.size] | string | The desired size of the banner image. |
[options.format] | string | The 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.
Param | Type | Description |
---|---|---|
options | Object | Optional parameters for the URL generation. |
options.size | number | The desired size of the avatar decoration. |
options.format | string | The 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.