@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 +10 -4
- package/dist/index.d.ts +10 -4
- package/dist/index.js +24 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +24 -3
- package/dist/index.mjs.map +1 -1
- package/dist/web.d.mts +10 -4
- package/dist/web.d.ts +10 -4
- package/dist/web.js +24 -3
- package/dist/web.js.map +1 -1
- package/dist/web.mjs +24 -3
- package/dist/web.mjs.map +1 -1
- package/package.json +6 -6
package/dist/web.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 [
|
|
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
|
|
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/web.js
CHANGED
|
@@ -55,10 +55,13 @@ function getDefaultStrategy() {
|
|
|
55
55
|
}
|
|
56
56
|
__name(getDefaultStrategy, "getDefaultStrategy");
|
|
57
57
|
|
|
58
|
+
// src/lib/CDN.ts
|
|
59
|
+
var import_v102 = require("discord-api-types/v10");
|
|
60
|
+
|
|
58
61
|
// src/lib/utils/constants.ts
|
|
59
62
|
var import_util = require("@discordjs/util");
|
|
60
63
|
var import_v10 = require("discord-api-types/v10");
|
|
61
|
-
var DefaultUserAgent = `DiscordBot (https://discord.js.org, 2.
|
|
64
|
+
var DefaultUserAgent = `DiscordBot (https://discord.js.org, 2.5.0)`;
|
|
62
65
|
var DefaultUserAgentAppendix = (0, import_util.getUserAgentAppendix)();
|
|
63
66
|
var DefaultRestOptions = {
|
|
64
67
|
agent: null,
|
|
@@ -96,7 +99,17 @@ var RESTEvents = /* @__PURE__ */ ((RESTEvents2) => {
|
|
|
96
99
|
})(RESTEvents || {});
|
|
97
100
|
var ALLOWED_EXTENSIONS = ["webp", "png", "jpg", "jpeg", "gif"];
|
|
98
101
|
var ALLOWED_STICKER_EXTENSIONS = ["png", "json", "gif"];
|
|
99
|
-
var ALLOWED_SIZES = [
|
|
102
|
+
var ALLOWED_SIZES = [
|
|
103
|
+
16,
|
|
104
|
+
32,
|
|
105
|
+
64,
|
|
106
|
+
128,
|
|
107
|
+
256,
|
|
108
|
+
512,
|
|
109
|
+
1024,
|
|
110
|
+
2048,
|
|
111
|
+
4096
|
|
112
|
+
];
|
|
100
113
|
var OverwrittenMimeTypes = {
|
|
101
114
|
// https://github.com/discordjs/discord.js/issues/8557
|
|
102
115
|
"image/apng": "image/png"
|
|
@@ -456,6 +469,14 @@ var CDN = class {
|
|
|
456
469
|
guildScheduledEventCover(scheduledEventId, coverHash, options) {
|
|
457
470
|
return this.makeURL(`/guild-events/${scheduledEventId}/${coverHash}`, options);
|
|
458
471
|
}
|
|
472
|
+
/**
|
|
473
|
+
* Generates a URL for a soundboard sound.
|
|
474
|
+
*
|
|
475
|
+
* @param soundId - The soundboard sound id
|
|
476
|
+
*/
|
|
477
|
+
soundboardSound(soundId) {
|
|
478
|
+
return `${this.cdn}${import_v102.CDNRoutes.soundboardSound(soundId)}`;
|
|
479
|
+
}
|
|
459
480
|
/**
|
|
460
481
|
* Constructs the URL for the resource, checking whether or not `hash` starts with `a_` if `dynamic` is set to `true`.
|
|
461
482
|
*
|
|
@@ -1382,7 +1403,7 @@ var REST = class _REST extends import_async_event_emitter.AsyncEventEmitter {
|
|
|
1382
1403
|
};
|
|
1383
1404
|
|
|
1384
1405
|
// src/shared.ts
|
|
1385
|
-
var version = "2.
|
|
1406
|
+
var version = "2.5.0";
|
|
1386
1407
|
|
|
1387
1408
|
// src/web.ts
|
|
1388
1409
|
setDefaultStrategy(fetch);
|