Appearance
User
Package: @erinjs/core
Represents a user (or bot) on erin.js.
Constructor
| Name | Type | Optional | Description |
|---|---|---|---|
client | Client | No | |
data | APIUserPartial | No | API user from message author, GET /users/{id}, or GET /users/@me |
Properties
| Name | Type | Readonly | Optional | Description |
|---|---|---|---|---|
avatar | string | null | No | No | |
avatarColor | number | null | No | No | RGB avatar color (e.g. 7577782). Null if not set. |
banner | string | null | No | No | Banner hash (from profile, member, or invite context). Null when not available. |
bot | boolean | Yes | No | |
client | Client | Yes | No | |
discriminator | string | No | No | |
flags | number | null | No | No | Public flags bitfield. Null if not set. |
globalName | string | null | No | No | |
id | string | Yes | No | |
system | boolean | Yes | No | Whether this is an official system user. |
username | string | No | No |
Methods
avatarURL()
Get the URL for this user's avatar. Auto-detects animated avatars (hash starting with a_) and uses gif extension.
Returns: string | null
Parameters:
| Name | Type | Optional | Description |
|---|---|---|---|
options | { size?: number; extension?: string; } | Yes | Optional size and extension (default: png, or gif for animated) |
bannerURL()
Get the URL for this user's banner. Returns null if the user has no banner (only available when fetched from profile/member context).
Returns: string | null
Parameters:
| Name | Type | Optional | Description |
|---|---|---|---|
options | { size?: number; extension?: string; } | Yes |
createDM() async
Create or get a DM channel with this user. Returns the DM channel; use {@link DMChannel.send} to send messages.
Returns: Promise<DMChannel>
Parameters:
None
displayAvatarURL()
Get the avatar URL, or the default avatar if none set (erin.js: fluxerstatic.com).
Returns: string
Parameters:
| Name | Type | Optional | Description |
|---|---|---|---|
options | { size?: number; extension?: string; } | Yes |
send() async
Send a DM to this user. Convenience method that creates the DM channel and sends the message.
Returns: Promise<Message>
Parameters:
| Name | Type | Optional | Description |
|---|---|---|---|
options | MessageSendOptions | No |
toString()
Returns a mention string (e.g. <@123456>).
Returns: string
Parameters:
None