mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-16 11:33:30 +01:00
feat(User): add avatarDecorationData (#9888)
* feat(User): add `avatarDecorationData` * fix: remove options * fix(User): check avatar decoration in equals() methods * docs: Add full reference --------- Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
@@ -97,9 +97,17 @@ export class CDN {
|
||||
return this.dynamicMakeURL(`/avatars/${id}/${avatarHash}`, avatarHash, options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a user avatar decoration preset URL.
|
||||
*
|
||||
* @param asset - The avatar decoration hash
|
||||
*/
|
||||
public avatarDecoration(asset: string): string;
|
||||
|
||||
/**
|
||||
* Generates a user avatar decoration URL.
|
||||
*
|
||||
* @deprecated This overload is deprecated. Pass a hash instead.
|
||||
* @param userId - The id of the user
|
||||
* @param userAvatarDecoration - The hash provided by Discord for this avatar decoration
|
||||
* @param options - Optional options for the avatar decoration
|
||||
@@ -107,9 +115,20 @@ export class CDN {
|
||||
public avatarDecoration(
|
||||
userId: string,
|
||||
userAvatarDecoration: string,
|
||||
// eslint-disable-next-line @typescript-eslint/unified-signatures
|
||||
options?: Readonly<BaseImageURLOptions>,
|
||||
): string;
|
||||
|
||||
public avatarDecoration(
|
||||
userIdOrAsset: string,
|
||||
userAvatarDecoration?: string,
|
||||
options?: Readonly<BaseImageURLOptions>,
|
||||
): string {
|
||||
return this.makeURL(`/avatar-decorations/${userId}/${userAvatarDecoration}`, options);
|
||||
if (userAvatarDecoration) {
|
||||
return this.makeURL(`/avatar-decorations/${userIdOrAsset}/${userAvatarDecoration}`, options);
|
||||
}
|
||||
|
||||
return this.makeURL(`/avatar-decoration-presets/${userIdOrAsset}`, { extension: 'png' });
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user