Skip to content

Commit

Permalink
fix: remove options
Browse files Browse the repository at this point in the history
  • Loading branch information
almeidx committed Nov 2, 2023
1 parent 88e85b6 commit a4417d7
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions packages/discord.js/src/structures/User.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,12 +192,12 @@ class User extends Base {

/**
* A link to the user's avatar decoration.
* @param {ImageURLOptions} [options={}] Options for the image URL
* @param {BaseImageURLOptions} [options={}] Options for the image URL
* @returns {?string}
*/
avatarDecorationURL(options = {}) {
if (this.avatarDecorationData) {
return this.client.rest.cdn.avatarDecoration(this.avatarDecorationData.asset, options);
return this.client.rest.cdn.avatarDecoration(this.avatarDecorationData.asset);
}

return this.avatarDecoration && this.client.rest.cdn.avatarDecoration(this.id, this.avatarDecoration, options);
Expand Down
2 changes: 1 addition & 1 deletion packages/discord.js/typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3162,7 +3162,7 @@ export class User extends PartialTextBasedChannel(Base) {
public get tag(): string;
public username: string;
public avatarURL(options?: ImageURLOptions): string | null;
public avatarDecorationURL(options?: ImageURLOptions): string | null;
public avatarDecorationURL(options?: BaseImageURLOptions): string | null;
public bannerURL(options?: ImageURLOptions): string | null | undefined;
public createDM(force?: boolean): Promise<DMChannel>;
public deleteDM(): Promise<DMChannel>;
Expand Down
4 changes: 2 additions & 2 deletions packages/rest/__tests__/CDN.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ test('avatar decoration default', () => {
expect(cdn.avatarDecoration(id, hash)).toEqual(`${base}/avatar-decorations/${id}/${hash}.webp`);
});

test('avatar decoration presets default', () => {
expect(cdn.avatarDecoration(hash)).toEqual(`${base}/avatar-decoration-presets/${hash}.webp`);
test('avatar decoration preset', () => {
expect(cdn.avatarDecoration(hash)).toEqual(`${base}/avatar-decoration-presets/${hash}.png`);
});

test('banner default', () => {
Expand Down
14 changes: 7 additions & 7 deletions packages/rest/src/lib/CDN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,34 +101,34 @@ export class CDN {
* Generates a user avatar decoration preset URL.
*
* @param asset - The avatar decoration hash
* @param options - Optional options for the avatar decoration preset
*/
public avatarDecoration(asset: string, options?: Readonly<ImageURLOptions>): string;
public avatarDecoration(asset: string): string;

/**
* Generates a user avatar decoration URL.
*
* @deprecated This overload is deprecated. Pass an hash instead.
* @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
*/
public avatarDecoration(
userId: string,
userAvatarDecoration: string,
// eslint-disable-next-line @typescript-eslint/unified-signatures
options?: Readonly<BaseImageURLOptions>,
): string;

public avatarDecoration(
userIdOrAsset: string,
assetOrOptions?: Readonly<ImageURLOptions> | string,
userAvatarDecoration?: string,
options?: Readonly<BaseImageURLOptions>,
): string {
if (typeof assetOrOptions === 'string') {
return this.makeURL(`/avatar-decorations/${userIdOrAsset}/${assetOrOptions}`, options);
if (userAvatarDecoration) {
return this.makeURL(`/avatar-decorations/${userIdOrAsset}/${userAvatarDecoration}`, options);
}

return this.dynamicMakeURL(`/avatar-decoration-presets/${userIdOrAsset}`, userIdOrAsset, assetOrOptions);
return this.makeURL(`/avatar-decoration-presets/${userIdOrAsset}`, { extension: 'png' });
}

/**
Expand Down

0 comments on commit a4417d7

Please sign in to comment.