User
- class User
A Discord account returned in an event payload or REST response. The object is a snapshot. Call User.fetch when current profile data matters.
- Implements:
Properties
Property
Type
Description
accentColorThe user’s accent color as a 24-bit RGB integer, or
null.avatarHash of the user’s avatar, or
nullif using the default avatar.Hash of the user’s banner, or
nullif no banner is set.botIndicates whether this user is a bot.
undefinedwhen omitted,nullif Discord sent null.createdAtWhen this Discord account was created, decoded from the user snowflake.
discriminatorThe user’s four-digit discriminator (e.g.
"1234").undefinedwhen omitted; not invented as"0".displayNameThe name best suited for display in user-facing output. Returns the global display name when set, otherwise the username.
globalNameThe user’s global display name, or
nullif not set.idUser ID.
primaryGuildThe user’s displayed guild identity, or
nullwhen none is selected.publicFlagsPublic Discord user flags bitfield, or
nullwhen Discord omitted it.usernameThe user’s display name (not globally unique).
Methods
- User.displayAvatarURL(options: { format?: “png” | “jpg” | “webp” | “gif”; size?: number; }) string
Get the CDN URL for the user’s avatar.
- Parameters:
options: Optional size and image format for the avatar.
- Returns:
The CDN URL string.
-
async User.fetch() Promise<
User> Refetch the latest user data from Discord.
- Returns:
The updated user object.