refactor(Emoji)!: make imageURL() change extension dynamically (#10613)

BREAKING CHANGE: Image URLs of emojis now automatically return GIF or static extensions.
BREAKING CHANGE: `CDN#emoji()` now has an `animated` required parameter.
This commit is contained in:
Idris
2025-01-16 10:59:28 +01:00
committed by GitHub
parent e2bbfe7b13
commit 0c40bc195e
5 changed files with 29 additions and 12 deletions

View File

@@ -58,7 +58,7 @@ class BaseGuildEmoji extends Emoji {
* @method imageURL
* @memberof BaseGuildEmoji
* @instance
* @param {BaseImageURLOptions} [options] Options for the image URL
* @param {ImageURLOptions} [options={}] Options for the image URL
* @returns {string}
*/

View File

@@ -42,11 +42,11 @@ class Emoji extends Base {
/**
* Returns a URL for the emoji or `null` if this is not a custom emoji.
* @param {BaseImageURLOptions} [options] Options for the image URL
* @param {ImageURLOptions} [options={}] Options for the image URL
* @returns {?string}
*/
imageURL(options) {
return this.id && this.client.rest.cdn.emoji(this.id, options);
imageURL(options = {}) {
return this.id && this.client.rest.cdn.emoji(this.id, this.animated, options);
}
/**

View File

@@ -634,7 +634,7 @@ export abstract class BaseGuild extends Base {
export class BaseGuildEmoji extends Emoji {
protected constructor(client: Client<true>, data: RawGuildEmojiData, guild: Guild | GuildPreview);
public imageURL(options?: BaseImageURLOptions): string;
public imageURL(options?: ImageURLOptions): string;
public get url(): string;
public available: boolean | null;
public get createdAt(): Date;
@@ -1333,7 +1333,7 @@ export class Emoji extends Base {
public id: Snowflake | null;
public name: string | null;
public get identifier(): string;
public imageURL(options?: BaseImageURLOptions): string | null;
public imageURL(options?: ImageURLOptions): string | null;
public get url(): string | null;
public toJSON(): unknown;
public toString(): string;