@discordjs/rest 2.4.3 → 2.5.0

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
@@ -1,5 +1,6 @@
1
1
  import * as url from 'url';
2
- import { Snowflake } from 'discord-api-types/v10';
2
+ import { ImageSize, Snowflake } from 'discord-api-types/v10';
3
+ export { ImageSize } from 'discord-api-types/v10';
3
4
  import { Readable } from 'node:stream';
4
5
  import { ReadableStream } from 'node:stream/web';
5
6
  import { Collection } from '@discordjs/collection';
@@ -430,10 +431,9 @@ declare enum RESTEvents {
430
431
  }
431
432
  declare const ALLOWED_EXTENSIONS: readonly ["webp", "png", "jpg", "jpeg", "gif"];
432
433
  declare const ALLOWED_STICKER_EXTENSIONS: readonly ["png", "json", "gif"];
433
- declare const ALLOWED_SIZES: readonly [16, 32, 64, 128, 256, 512, 1024, 2048, 4096];
434
+ declare const ALLOWED_SIZES: readonly number[];
434
435
  type ImageExtension = (typeof ALLOWED_EXTENSIONS)[number];
435
436
  type StickerExtension = (typeof ALLOWED_STICKER_EXTENSIONS)[number];
436
- type ImageSize = (typeof ALLOWED_SIZES)[number];
437
437
  declare const OverwrittenMimeTypes: {
438
438
  readonly 'image/apng': "image/png";
439
439
  };
@@ -663,6 +663,12 @@ declare class CDN {
663
663
  * @param options - Optional options for the cover image
664
664
  */
665
665
  guildScheduledEventCover(scheduledEventId: string, coverHash: string, options?: Readonly<BaseImageURLOptions>): string;
666
+ /**
667
+ * Generates a URL for a soundboard sound.
668
+ *
669
+ * @param soundId - The soundboard sound id
670
+ */
671
+ soundboardSound(soundId: string): string;
666
672
  /**
667
673
  * Constructs the URL for the resource, checking whether or not `hash` starts with `a_` if `dynamic` is set to `true`.
668
674
  *
@@ -923,4 +929,4 @@ declare function calculateUserDefaultAvatarIndex(userId: Snowflake): number;
923
929
  */
924
930
  declare const version: string;
925
931
 
926
- export { ALLOWED_EXTENSIONS, ALLOWED_SIZES, ALLOWED_STICKER_EXTENSIONS, type APIRequest, type BaseImageURLOptions, BurstHandlerMajorIdKey, CDN, DEPRECATION_WARNING_PREFIX, DefaultRestOptions, DefaultUserAgent, DefaultUserAgentAppendix, DiscordAPIError, type DiscordErrorData, type GetRateLimitOffsetFunction, HTTPError, type HandlerRequestData, type HashData, type ImageExtension, type ImageSize, 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 };
932
+ export { ALLOWED_EXTENSIONS, ALLOWED_SIZES, ALLOWED_STICKER_EXTENSIONS, type APIRequest, type BaseImageURLOptions, BurstHandlerMajorIdKey, CDN, DEPRECATION_WARNING_PREFIX, DefaultRestOptions, DefaultUserAgent, DefaultUserAgentAppendix, DiscordAPIError, type DiscordErrorData, type GetRateLimitOffsetFunction, HTTPError, type HandlerRequestData, type HashData, 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 };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import * as url from 'url';
2
- import { Snowflake } from 'discord-api-types/v10';
2
+ import { ImageSize, Snowflake } from 'discord-api-types/v10';
3
+ export { ImageSize } from 'discord-api-types/v10';
3
4
  import { Readable } from 'node:stream';
4
5
  import { ReadableStream } from 'node:stream/web';
5
6
  import { Collection } from '@discordjs/collection';
@@ -430,10 +431,9 @@ declare enum RESTEvents {
430
431
  }
431
432
  declare const ALLOWED_EXTENSIONS: readonly ["webp", "png", "jpg", "jpeg", "gif"];
432
433
  declare const ALLOWED_STICKER_EXTENSIONS: readonly ["png", "json", "gif"];
433
- declare const ALLOWED_SIZES: readonly [16, 32, 64, 128, 256, 512, 1024, 2048, 4096];
434
+ declare const ALLOWED_SIZES: readonly number[];
434
435
  type ImageExtension = (typeof ALLOWED_EXTENSIONS)[number];
435
436
  type StickerExtension = (typeof ALLOWED_STICKER_EXTENSIONS)[number];
436
- type ImageSize = (typeof ALLOWED_SIZES)[number];
437
437
  declare const OverwrittenMimeTypes: {
438
438
  readonly 'image/apng': "image/png";
439
439
  };
@@ -663,6 +663,12 @@ declare class CDN {
663
663
  * @param options - Optional options for the cover image
664
664
  */
665
665
  guildScheduledEventCover(scheduledEventId: string, coverHash: string, options?: Readonly<BaseImageURLOptions>): string;
666
+ /**
667
+ * Generates a URL for a soundboard sound.
668
+ *
669
+ * @param soundId - The soundboard sound id
670
+ */
671
+ soundboardSound(soundId: string): string;
666
672
  /**
667
673
  * Constructs the URL for the resource, checking whether or not `hash` starts with `a_` if `dynamic` is set to `true`.
668
674
  *
@@ -923,4 +929,4 @@ declare function calculateUserDefaultAvatarIndex(userId: Snowflake): number;
923
929
  */
924
930
  declare const version: string;
925
931
 
926
- export { ALLOWED_EXTENSIONS, ALLOWED_SIZES, ALLOWED_STICKER_EXTENSIONS, type APIRequest, type BaseImageURLOptions, BurstHandlerMajorIdKey, CDN, DEPRECATION_WARNING_PREFIX, DefaultRestOptions, DefaultUserAgent, DefaultUserAgentAppendix, DiscordAPIError, type DiscordErrorData, type GetRateLimitOffsetFunction, HTTPError, type HandlerRequestData, type HashData, type ImageExtension, type ImageSize, 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 };
932
+ export { ALLOWED_EXTENSIONS, ALLOWED_SIZES, ALLOWED_STICKER_EXTENSIONS, type APIRequest, type BaseImageURLOptions, BurstHandlerMajorIdKey, CDN, DEPRECATION_WARNING_PREFIX, DefaultRestOptions, DefaultUserAgent, DefaultUserAgentAppendix, DiscordAPIError, type DiscordErrorData, type GetRateLimitOffsetFunction, HTTPError, type HandlerRequestData, type HashData, 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 };
package/dist/index.js CHANGED
@@ -121,10 +121,13 @@ async function resolveBody(body) {
121
121
  }
122
122
  __name(resolveBody, "resolveBody");
123
123
 
124
+ // src/lib/CDN.ts
125
+ var import_v102 = require("discord-api-types/v10");
126
+
124
127
  // src/lib/utils/constants.ts
125
128
  var import_util = require("@discordjs/util");
126
129
  var import_v10 = require("discord-api-types/v10");
127
- var DefaultUserAgent = `DiscordBot (https://discord.js.org, 2.4.3)`;
130
+ var DefaultUserAgent = `DiscordBot (https://discord.js.org, 2.5.0)`;
128
131
  var DefaultUserAgentAppendix = (0, import_util.getUserAgentAppendix)();
129
132
  var DefaultRestOptions = {
130
133
  agent: null,
@@ -162,7 +165,17 @@ var RESTEvents = /* @__PURE__ */ ((RESTEvents2) => {
162
165
  })(RESTEvents || {});
163
166
  var ALLOWED_EXTENSIONS = ["webp", "png", "jpg", "jpeg", "gif"];
164
167
  var ALLOWED_STICKER_EXTENSIONS = ["png", "json", "gif"];
165
- var ALLOWED_SIZES = [16, 32, 64, 128, 256, 512, 1024, 2048, 4096];
168
+ var ALLOWED_SIZES = [
169
+ 16,
170
+ 32,
171
+ 64,
172
+ 128,
173
+ 256,
174
+ 512,
175
+ 1024,
176
+ 2048,
177
+ 4096
178
+ ];
166
179
  var OverwrittenMimeTypes = {
167
180
  // https://github.com/discordjs/discord.js/issues/8557
168
181
  "image/apng": "image/png"
@@ -522,6 +535,14 @@ var CDN = class {
522
535
  guildScheduledEventCover(scheduledEventId, coverHash, options) {
523
536
  return this.makeURL(`/guild-events/${scheduledEventId}/${coverHash}`, options);
524
537
  }
538
+ /**
539
+ * Generates a URL for a soundboard sound.
540
+ *
541
+ * @param soundId - The soundboard sound id
542
+ */
543
+ soundboardSound(soundId) {
544
+ return `${this.cdn}${import_v102.CDNRoutes.soundboardSound(soundId)}`;
545
+ }
525
546
  /**
526
547
  * Constructs the URL for the resource, checking whether or not `hash` starts with `a_` if `dynamic` is set to `true`.
527
548
  *
@@ -1448,7 +1469,7 @@ var REST = class _REST extends import_async_event_emitter.AsyncEventEmitter {
1448
1469
  };
1449
1470
 
1450
1471
  // src/shared.ts
1451
- var version = "2.4.3";
1472
+ var version = "2.5.0";
1452
1473
 
1453
1474
  // src/index.ts
1454
1475
  globalThis.FormData ??= import_undici2.FormData;