@discordjs/rest 3.0.0-dev.1748285947-78d512c34 → 3.0.0-dev.1748606730-762bbc652

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/dist/index.d.mts CHANGED
@@ -443,53 +443,42 @@ declare const BurstHandlerMajorIdKey = "burst";
443
443
  declare const AUTH_UUID_NAMESPACE = "acc82a4c-f887-417b-a69c-f74096ff7e59";
444
444
 
445
445
  /**
446
- * The options used for image URLs
446
+ * The options used for image URLs.
447
447
  */
448
448
  interface BaseImageURLOptions {
449
449
  /**
450
- * The extension to use for the image URL
450
+ * The extension to use for the image URL.
451
451
  *
452
452
  * @defaultValue `'webp'`
453
453
  */
454
454
  extension?: ImageExtension;
455
455
  /**
456
- * The size specified in the image URL
456
+ * The size specified in the image URL.
457
457
  */
458
458
  size?: ImageSize;
459
459
  }
460
- /**
461
- * The options used for image URLs with animated content
462
- */
463
- interface ImageURLOptions extends BaseImageURLOptions {
460
+ interface EmojiURLOptionsWebp extends BaseImageURLOptions {
464
461
  /**
465
- * Whether or not to prefer the static version of an image asset.
462
+ * Whether to use the `animated` query parameter.
466
463
  */
467
- forceStatic?: boolean;
464
+ animated?: boolean;
465
+ extension?: 'webp';
466
+ }
467
+ interface EmojiURLOptionsNotWebp extends BaseImageURLOptions {
468
+ extension: Exclude<ImageExtension, 'webp'>;
468
469
  }
469
470
  /**
470
- * The options to use when making a CDN URL
471
+ * The options used for emoji URLs.
471
472
  */
472
- interface MakeURLOptions {
473
- /**
474
- * The allowed extensions that can be used
475
- */
476
- allowedExtensions?: readonly string[];
477
- /**
478
- * The base URL.
479
- *
480
- * @defaultValue `DefaultRestOptions.cdn`
481
- */
482
- base?: string;
483
- /**
484
- * The extension to use for the image URL
485
- *
486
- * @defaultValue `'webp'`
487
- */
488
- extension?: string | undefined;
473
+ type EmojiURLOptions = EmojiURLOptionsNotWebp | EmojiURLOptionsWebp;
474
+ /**
475
+ * The options used for image URLs that may be animated.
476
+ */
477
+ interface ImageURLOptions extends BaseImageURLOptions {
489
478
  /**
490
- * The size specified in the image URL
479
+ * Whether to prefer the static asset.
491
480
  */
492
- size?: ImageSize;
481
+ forceStatic?: boolean;
493
482
  }
494
483
  /**
495
484
  * The CDN link builder
@@ -565,10 +554,9 @@ declare class CDN {
565
554
  * Generates an emoji's URL.
566
555
  *
567
556
  * @param emojiId - The emoji id
568
- * @param animated - Whether the emoji is animated
569
557
  * @param options - Optional options for the emoji
570
558
  */
571
- emoji(emojiId: string, animated: boolean, options?: Readonly<ImageURLOptions>): string;
559
+ emoji(emojiId: string, options?: Readonly<EmojiURLOptions>): string;
572
560
  /**
573
561
  * Generates a guild member avatar URL.
574
562
  *
@@ -910,4 +898,4 @@ declare function calculateUserDefaultAvatarIndex(userId: Snowflake): number;
910
898
  */
911
899
  declare const version: string;
912
900
 
913
- export { ALLOWED_EXTENSIONS, ALLOWED_SIZES, ALLOWED_STICKER_EXTENSIONS, type APIRequest, AUTH_UUID_NAMESPACE, type AuthData, type BaseImageURLOptions, BurstHandlerMajorIdKey, CDN, DefaultRestOptions, DefaultUserAgent, DefaultUserAgentAppendix, DiscordAPIError, type DiscordError, type DiscordErrorData, type DiscordErrorFieldInformation, type DiscordErrorGroupWrapper, type GetRateLimitOffsetFunction, HTTPError, type HandlerRequestData, type HashData, type IHandler, type ImageExtension, type ImageURLOptions, type InternalRequest, type InvalidRequestWarningData, type MakeURLOptions, type OAuthErrorData, OverwrittenMimeTypes, REST, RESTEvents, type RESTOptions, type RateLimitData, RateLimitError, type RateLimitQueueFilter, type RawFile, type RequestBody, type RequestData, type RequestHeaders, RequestMethod, type ResponseLike, type RestEvents, type RestEventsMap, type RouteData, type RouteLike, type StickerExtension, calculateUserDefaultAvatarIndex, makeURLSearchParams, parseResponse, version };
901
+ export { ALLOWED_EXTENSIONS, ALLOWED_SIZES, ALLOWED_STICKER_EXTENSIONS, type APIRequest, AUTH_UUID_NAMESPACE, type AuthData, type BaseImageURLOptions, BurstHandlerMajorIdKey, CDN, DefaultRestOptions, DefaultUserAgent, DefaultUserAgentAppendix, DiscordAPIError, type DiscordError, type DiscordErrorData, type DiscordErrorFieldInformation, type DiscordErrorGroupWrapper, type EmojiURLOptions, type EmojiURLOptionsNotWebp, type EmojiURLOptionsWebp, type GetRateLimitOffsetFunction, HTTPError, type HandlerRequestData, type HashData, type IHandler, type ImageExtension, type ImageURLOptions, type InternalRequest, type InvalidRequestWarningData, type OAuthErrorData, OverwrittenMimeTypes, REST, RESTEvents, type RESTOptions, type RateLimitData, RateLimitError, type RateLimitQueueFilter, type RawFile, type RequestBody, type RequestData, type RequestHeaders, RequestMethod, type ResponseLike, type RestEvents, type RestEventsMap, type RouteData, type RouteLike, type StickerExtension, calculateUserDefaultAvatarIndex, makeURLSearchParams, parseResponse, version };
package/dist/index.d.ts CHANGED
@@ -443,53 +443,42 @@ declare const BurstHandlerMajorIdKey = "burst";
443
443
  declare const AUTH_UUID_NAMESPACE = "acc82a4c-f887-417b-a69c-f74096ff7e59";
444
444
 
445
445
  /**
446
- * The options used for image URLs
446
+ * The options used for image URLs.
447
447
  */
448
448
  interface BaseImageURLOptions {
449
449
  /**
450
- * The extension to use for the image URL
450
+ * The extension to use for the image URL.
451
451
  *
452
452
  * @defaultValue `'webp'`
453
453
  */
454
454
  extension?: ImageExtension;
455
455
  /**
456
- * The size specified in the image URL
456
+ * The size specified in the image URL.
457
457
  */
458
458
  size?: ImageSize;
459
459
  }
460
- /**
461
- * The options used for image URLs with animated content
462
- */
463
- interface ImageURLOptions extends BaseImageURLOptions {
460
+ interface EmojiURLOptionsWebp extends BaseImageURLOptions {
464
461
  /**
465
- * Whether or not to prefer the static version of an image asset.
462
+ * Whether to use the `animated` query parameter.
466
463
  */
467
- forceStatic?: boolean;
464
+ animated?: boolean;
465
+ extension?: 'webp';
466
+ }
467
+ interface EmojiURLOptionsNotWebp extends BaseImageURLOptions {
468
+ extension: Exclude<ImageExtension, 'webp'>;
468
469
  }
469
470
  /**
470
- * The options to use when making a CDN URL
471
+ * The options used for emoji URLs.
471
472
  */
472
- interface MakeURLOptions {
473
- /**
474
- * The allowed extensions that can be used
475
- */
476
- allowedExtensions?: readonly string[];
477
- /**
478
- * The base URL.
479
- *
480
- * @defaultValue `DefaultRestOptions.cdn`
481
- */
482
- base?: string;
483
- /**
484
- * The extension to use for the image URL
485
- *
486
- * @defaultValue `'webp'`
487
- */
488
- extension?: string | undefined;
473
+ type EmojiURLOptions = EmojiURLOptionsNotWebp | EmojiURLOptionsWebp;
474
+ /**
475
+ * The options used for image URLs that may be animated.
476
+ */
477
+ interface ImageURLOptions extends BaseImageURLOptions {
489
478
  /**
490
- * The size specified in the image URL
479
+ * Whether to prefer the static asset.
491
480
  */
492
- size?: ImageSize;
481
+ forceStatic?: boolean;
493
482
  }
494
483
  /**
495
484
  * The CDN link builder
@@ -565,10 +554,9 @@ declare class CDN {
565
554
  * Generates an emoji's URL.
566
555
  *
567
556
  * @param emojiId - The emoji id
568
- * @param animated - Whether the emoji is animated
569
557
  * @param options - Optional options for the emoji
570
558
  */
571
- emoji(emojiId: string, animated: boolean, options?: Readonly<ImageURLOptions>): string;
559
+ emoji(emojiId: string, options?: Readonly<EmojiURLOptions>): string;
572
560
  /**
573
561
  * Generates a guild member avatar URL.
574
562
  *
@@ -910,4 +898,4 @@ declare function calculateUserDefaultAvatarIndex(userId: Snowflake): number;
910
898
  */
911
899
  declare const version: string;
912
900
 
913
- export { ALLOWED_EXTENSIONS, ALLOWED_SIZES, ALLOWED_STICKER_EXTENSIONS, type APIRequest, AUTH_UUID_NAMESPACE, type AuthData, type BaseImageURLOptions, BurstHandlerMajorIdKey, CDN, DefaultRestOptions, DefaultUserAgent, DefaultUserAgentAppendix, DiscordAPIError, type DiscordError, type DiscordErrorData, type DiscordErrorFieldInformation, type DiscordErrorGroupWrapper, type GetRateLimitOffsetFunction, HTTPError, type HandlerRequestData, type HashData, type IHandler, type ImageExtension, type ImageURLOptions, type InternalRequest, type InvalidRequestWarningData, type MakeURLOptions, type OAuthErrorData, OverwrittenMimeTypes, REST, RESTEvents, type RESTOptions, type RateLimitData, RateLimitError, type RateLimitQueueFilter, type RawFile, type RequestBody, type RequestData, type RequestHeaders, RequestMethod, type ResponseLike, type RestEvents, type RestEventsMap, type RouteData, type RouteLike, type StickerExtension, calculateUserDefaultAvatarIndex, makeURLSearchParams, parseResponse, version };
901
+ export { ALLOWED_EXTENSIONS, ALLOWED_SIZES, ALLOWED_STICKER_EXTENSIONS, type APIRequest, AUTH_UUID_NAMESPACE, type AuthData, type BaseImageURLOptions, BurstHandlerMajorIdKey, CDN, DefaultRestOptions, DefaultUserAgent, DefaultUserAgentAppendix, DiscordAPIError, type DiscordError, type DiscordErrorData, type DiscordErrorFieldInformation, type DiscordErrorGroupWrapper, type EmojiURLOptions, type EmojiURLOptionsNotWebp, type EmojiURLOptionsWebp, type GetRateLimitOffsetFunction, HTTPError, type HandlerRequestData, type HashData, type IHandler, type ImageExtension, type ImageURLOptions, type InternalRequest, type InvalidRequestWarningData, type OAuthErrorData, OverwrittenMimeTypes, REST, RESTEvents, type RESTOptions, type RateLimitData, RateLimitError, type RateLimitQueueFilter, type RawFile, type RequestBody, type RequestData, type RequestHeaders, RequestMethod, type ResponseLike, type RestEvents, type RestEventsMap, type RouteData, type RouteLike, type StickerExtension, calculateUserDefaultAvatarIndex, makeURLSearchParams, parseResponse, version };
package/dist/index.js CHANGED
@@ -127,7 +127,7 @@ var import_v102 = require("discord-api-types/v10");
127
127
  // src/lib/utils/constants.ts
128
128
  var import_util = require("@discordjs/util");
129
129
  var import_v10 = require("discord-api-types/v10");
130
- var DefaultUserAgent = `DiscordBot (https://discord.js.org, 3.0.0-dev.1748285947-78d512c34)`;
130
+ var DefaultUserAgent = `DiscordBot (https://discord.js.org, 3.0.0-dev.1748606730-762bbc652)`;
131
131
  var DefaultUserAgentAppendix = (0, import_util.getUserAgentAppendix)();
132
132
  var DefaultRestOptions = {
133
133
  agent: null,
@@ -275,11 +275,10 @@ var CDN = class {
275
275
  * Generates an emoji's URL.
276
276
  *
277
277
  * @param emojiId - The emoji id
278
- * @param animated - Whether the emoji is animated
279
278
  * @param options - Optional options for the emoji
280
279
  */
281
- emoji(emojiId, animated, options) {
282
- return this.dynamicMakeURL(`/emojis/${emojiId}`, animated ? "a_" : "", options);
280
+ emoji(emojiId, options) {
281
+ return this.makeURL(`/emojis/${emojiId}`, options);
283
282
  }
284
283
  /**
285
284
  * Generates a guild member avatar URL.
@@ -394,7 +393,7 @@ var CDN = class {
394
393
  * @param options - Optional options for the link
395
394
  */
396
395
  dynamicMakeURL(route, hash, { forceStatic = false, ...options } = {}) {
397
- return this.makeURL(route, !forceStatic && hash.startsWith("a_") ? { ...options, extension: "gif" } : options);
396
+ return this.makeURL(route, !forceStatic && hash.startsWith("a_") ? { ...options, animated: true } : options);
398
397
  }
399
398
  /**
400
399
  * Constructs the URL for the resource
@@ -406,7 +405,8 @@ var CDN = class {
406
405
  allowedExtensions = ALLOWED_EXTENSIONS,
407
406
  base = this.cdn,
408
407
  extension = "webp",
409
- size
408
+ size,
409
+ animated
410
410
  } = {}) {
411
411
  extension = String(extension).toLowerCase();
412
412
  if (!allowedExtensions.includes(extension)) {
@@ -418,6 +418,9 @@ Must be one of: ${allowedExtensions.join(", ")}`);
418
418
  Must be one of: ${ALLOWED_SIZES.join(", ")}`);
419
419
  }
420
420
  const url = new URL(`${base}${route}.${extension}`);
421
+ if (animated !== void 0) {
422
+ url.searchParams.set("animated", String(animated));
423
+ }
421
424
  if (size) {
422
425
  url.searchParams.set("size", String(size));
423
426
  }
@@ -1469,7 +1472,7 @@ var REST = class _REST extends import_async_event_emitter.AsyncEventEmitter {
1469
1472
  };
1470
1473
 
1471
1474
  // src/shared.ts
1472
- var version = "3.0.0-dev.1748285947-78d512c34";
1475
+ var version = "3.0.0-dev.1748606730-762bbc652";
1473
1476
 
1474
1477
  // src/index.ts
1475
1478
  globalThis.FormData ??= import_undici2.FormData;