mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-17 12:03:31 +01:00
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:
@@ -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}
|
||||
*/
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
4
packages/discord.js/typings/index.d.ts
vendored
4
packages/discord.js/typings/index.d.ts
vendored
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user