discord.js 15.0.0-dev.1748285936-78d512c34 → 15.0.0-dev.1748347538-2c35084ec

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "discord.js",
4
- "version": "15.0.0-dev.1748285936-78d512c34",
4
+ "version": "15.0.0-dev.1748347538-2c35084ec",
5
5
  "description": "A powerful library for interacting with the Discord API",
6
6
  "main": "./src/index.js",
7
7
  "types": "./typings/index.d.ts",
@@ -61,12 +61,12 @@
61
61
  "magic-bytes.js": "^1.10.0",
62
62
  "tslib": "^2.8.1",
63
63
  "undici": "7.8.0",
64
- "@discordjs/builders": "^1.11.1",
65
64
  "@discordjs/collection": "^2.1.1",
65
+ "@discordjs/builders": "^1.11.1",
66
66
  "@discordjs/formatters": "^0.6.1",
67
- "@discordjs/rest": "^2.5.0",
67
+ "@discordjs/ws": "^2.0.2",
68
68
  "@discordjs/util": "^1.1.1",
69
- "@discordjs/ws": "^2.0.2"
69
+ "@discordjs/rest": "^2.5.0"
70
70
  },
71
71
  "devDependencies": {
72
72
  "@favware/cliff-jumper": "^4.1.0",
@@ -86,9 +86,9 @@
86
86
  "tslint": "6.1.3",
87
87
  "turbo": "^2.5.2",
88
88
  "typescript": "~5.8.3",
89
+ "@discordjs/api-extractor": "^7.52.7",
89
90
  "@discordjs/docgen": "^0.12.1",
90
- "@discordjs/scripts": "^0.1.0",
91
- "@discordjs/api-extractor": "^7.52.7"
91
+ "@discordjs/scripts": "^0.1.0"
92
92
  },
93
93
  "engines": {
94
94
  "node": ">=22.12.0"
@@ -779,6 +779,11 @@ exports.Client = Client;
779
779
  * @see {@link https://discord.js.org/docs/packages/rest/stable/ImageURLOptions:Interface}
780
780
  */
781
781
 
782
+ /**
783
+ * @external EmojiURLOptions
784
+ * @see {@link https://discord.js.org/docs/packages/rest/stable/EmojiURLOptions:TypeAlias}
785
+ */
786
+
782
787
  /**
783
788
  * @external BaseImageURLOptions
784
789
  * @see {@link https://discord.js.org/docs/packages/rest/stable/BaseImageURLOptions:Interface}
@@ -58,7 +58,7 @@ class BaseGuildEmoji extends Emoji {
58
58
  * @method imageURL
59
59
  * @memberof BaseGuildEmoji
60
60
  * @instance
61
- * @param {ImageURLOptions} [options={}] Options for the image URL
61
+ * @param {EmojiURLOptions} [options={}] Options for the emoji URL
62
62
  * @returns {string}
63
63
  */
64
64
 
@@ -42,11 +42,20 @@ class Emoji extends Base {
42
42
 
43
43
  /**
44
44
  * Returns a URL for the emoji or `null` if this is not a custom emoji.
45
- * @param {ImageURLOptions} [options={}] Options for the image URL
45
+ * @param {EmojiURLOptions} [options={}] Options for the emoji URL
46
46
  * @returns {?string}
47
47
  */
48
48
  imageURL(options = {}) {
49
- return this.id && this.client.rest.cdn.emoji(this.id, this.animated, options);
49
+ if (!this.id) return null;
50
+
51
+ // Return a dynamic extension depending on whether the emoji is animated.
52
+ const resolvedOptions = { extension: options.extension, size: options.size };
53
+
54
+ if (!options.extension || options.extension === 'webp') {
55
+ resolvedOptions.animated = options.animated ?? (this.animated || undefined);
56
+ }
57
+
58
+ return this.client.rest.cdn.emoji(this.id, resolvedOptions);
50
59
  }
51
60
 
52
61
  /**
@@ -1,6 +1,6 @@
1
1
  import { ApplicationCommandOptionAllowedChannelTypes, MessageActionRowComponentBuilder } from '@discordjs/builders';
2
2
  import { Collection, ReadonlyCollection } from '@discordjs/collection';
3
- import { BaseImageURLOptions, ImageURLOptions, RawFile, REST, RESTOptions } from '@discordjs/rest';
3
+ import { BaseImageURLOptions, ImageURLOptions, RawFile, REST, RESTOptions, EmojiURLOptions } from '@discordjs/rest';
4
4
  import { Awaitable, JSONEncodable } from '@discordjs/util';
5
5
  import { WebSocketManager, WebSocketManagerOptions } from '@discordjs/ws';
6
6
  import { AsyncEventEmitter } from '@vladfrangu/async_event_emitter';
@@ -590,7 +590,7 @@ export abstract class BaseGuild extends Base {
590
590
 
591
591
  export class BaseGuildEmoji extends Emoji {
592
592
  protected constructor(client: Client<true>, data: APIEmoji, guild: Guild | GuildPreview);
593
- public imageURL(options?: ImageURLOptions): string;
593
+ public imageURL(options?: EmojiURLOptions): string;
594
594
  public get url(): string;
595
595
  public available: boolean | null;
596
596
  public get createdAt(): Date;
@@ -1267,7 +1267,7 @@ export class Emoji extends Base {
1267
1267
  public id: Snowflake | null;
1268
1268
  public name: string | null;
1269
1269
  public get identifier(): string;
1270
- public imageURL(options?: ImageURLOptions): string | null;
1270
+ public imageURL(options?: EmojiURLOptions): string | null;
1271
1271
  public get url(): string | null;
1272
1272
  public toJSON(): unknown;
1273
1273
  public toString(): string;
@@ -1,6 +1,6 @@
1
1
  import { ApplicationCommandOptionAllowedChannelTypes, MessageActionRowComponentBuilder } from '@discordjs/builders';
2
2
  import { Collection, ReadonlyCollection } from '@discordjs/collection';
3
- import { BaseImageURLOptions, ImageURLOptions, RawFile, REST, RESTOptions } from '@discordjs/rest';
3
+ import { BaseImageURLOptions, ImageURLOptions, RawFile, REST, RESTOptions, EmojiURLOptions } from '@discordjs/rest';
4
4
  import { Awaitable, JSONEncodable } from '@discordjs/util';
5
5
  import { WebSocketManager, WebSocketManagerOptions } from '@discordjs/ws';
6
6
  import { AsyncEventEmitter } from '@vladfrangu/async_event_emitter';
@@ -590,7 +590,7 @@ export abstract class BaseGuild extends Base {
590
590
 
591
591
  export class BaseGuildEmoji extends Emoji {
592
592
  protected constructor(client: Client<true>, data: APIEmoji, guild: Guild | GuildPreview);
593
- public imageURL(options?: ImageURLOptions): string;
593
+ public imageURL(options?: EmojiURLOptions): string;
594
594
  public get url(): string;
595
595
  public available: boolean | null;
596
596
  public get createdAt(): Date;
@@ -1267,7 +1267,7 @@ export class Emoji extends Base {
1267
1267
  public id: Snowflake | null;
1268
1268
  public name: string | null;
1269
1269
  public get identifier(): string;
1270
- public imageURL(options?: ImageURLOptions): string | null;
1270
+ public imageURL(options?: EmojiURLOptions): string | null;
1271
1271
  public get url(): string | null;
1272
1272
  public toJSON(): unknown;
1273
1273
  public toString(): string;