mirror of
https://github.com/discordjs/discord.js.git
synced 2026-06-04 18:10:08 +00:00
feat: user avatar decorations (#9710)
* feat: user avatar decorations * lint * Update typings/index.d.ts Co-authored-by: David Malchin <malchin459@gmail.com> --------- Co-authored-by: David Malchin <malchin459@gmail.com>
This commit is contained in:
@@ -122,6 +122,16 @@ class User extends Base {
|
||||
*/
|
||||
this.flags = new UserFlags(data.public_flags);
|
||||
}
|
||||
|
||||
if ('avatar_decoration' in data) {
|
||||
/**
|
||||
* The user avatar decoration's hash
|
||||
* @type {?string}
|
||||
*/
|
||||
this.avatarDecoration = data.avatar_decoration;
|
||||
} else {
|
||||
this.avatarDecoration ??= null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -161,6 +171,16 @@ class User extends Base {
|
||||
return this.client.rest.cdn.Avatar(this.id, this.avatar, format, size, dynamic);
|
||||
}
|
||||
|
||||
/**
|
||||
* A link to the user's avatar decoration.
|
||||
* @param {StaticImageURLOptions} [options={}] Options for the image URL
|
||||
* @returns {?string}
|
||||
*/
|
||||
avatarDecorationURL({ format, size } = {}) {
|
||||
if (!this.avatarDecoration) return null;
|
||||
return this.client.rest.cdn.AvatarDecoration(this.id, this.avatarDecoration, format, size);
|
||||
}
|
||||
|
||||
/**
|
||||
* A link to the user's default avatar
|
||||
* @type {string}
|
||||
|
||||
Reference in New Issue
Block a user