This commit is contained in:
Lukian 2023-06-20 15:28:07 +02:00
parent 68f4b60012
commit 41ae7ff4bd
1010 changed files with 38622 additions and 17071 deletions

View file

@ -4,7 +4,11 @@ import { EventEmitter } from 'node:events';
import { URLSearchParams } from 'node:url';
import { Collection } from '@discordjs/collection';
declare const DefaultUserAgent = "DiscordBot (https://discord.js.org, [VI]{{inject}}[/VI])";
declare const DefaultUserAgent: `DiscordBot (https://discord.js.org, ${string})`;
/**
* The default string to append onto the user agent.
*/
declare const DefaultUserAgentAppendix: string;
declare const DefaultRestOptions: {
readonly agent: Agent;
readonly api: "https://discord.com/api";
@ -17,7 +21,7 @@ declare const DefaultRestOptions: {
readonly rejectOnRateLimit: null;
readonly retries: 3;
readonly timeout: 15000;
readonly userAgentAppendix: `Node.js ${string}`;
readonly userAgentAppendix: string;
readonly version: "10";
readonly hashSweepInterval: 14400000;
readonly hashLifetime: 86400000;
@ -26,7 +30,7 @@ declare const DefaultRestOptions: {
/**
* The events that the REST manager emits
*/
declare const enum RESTEvents {
declare enum RESTEvents {
Debug = "restDebug",
HandlerSweep = "handlerSweep",
HashSweep = "hashSweep",
@ -35,11 +39,15 @@ declare const enum RESTEvents {
Response = "response"
}
declare const ALLOWED_EXTENSIONS: readonly ["webp", "png", "jpg", "jpeg", "gif"];
declare const ALLOWED_STICKER_EXTENSIONS: readonly ["png", "json"];
declare const ALLOWED_STICKER_EXTENSIONS: readonly ["png", "json", "gif"];
declare const ALLOWED_SIZES: readonly [16, 32, 64, 128, 256, 512, 1024, 2048, 4096];
type ImageExtension = typeof ALLOWED_EXTENSIONS[number];
type StickerExtension = typeof ALLOWED_STICKER_EXTENSIONS[number];
type ImageSize = typeof ALLOWED_SIZES[number];
type ImageExtension = (typeof ALLOWED_EXTENSIONS)[number];
type StickerExtension = (typeof ALLOWED_STICKER_EXTENSIONS)[number];
type ImageSize = (typeof ALLOWED_SIZES)[number];
declare const OverwrittenMimeTypes: {
readonly 'image/apng': "image/png";
};
declare const BurstHandlerMajorIdKey = "burst";
/**
* The options used for image URLs
@ -198,6 +206,8 @@ declare class CDN {
*
* @param stickerId - The sticker id
* @param extension - The extension of the sticker
* @privateRemarks
* Stickers cannot have a `.webp` extension, so we default to a `.png`
*/
sticker(stickerId: string, extension?: StickerExtension): string;
/**
@ -355,7 +365,7 @@ interface RESTOptions {
/**
* Extra information to add to the user agent
*
* @defaultValue `Node.js ${process.version}`
* @defaultValue DefaultUserAgentAppendix
*/
userAgentAppendix: string;
/**
@ -627,7 +637,7 @@ interface RequestHeaders {
/**
* Possible API methods to be used when doing requests
*/
declare const enum RequestMethod {
declare enum RequestMethod {
Delete = "DELETE",
Get = "GET",
Patch = "PATCH",
@ -862,4 +872,4 @@ declare function parseResponse(res: Dispatcher.ResponseData): Promise<unknown>;
*/
declare const version: string;
export { ALLOWED_EXTENSIONS, ALLOWED_SIZES, ALLOWED_STICKER_EXTENSIONS, APIRequest, BaseImageURLOptions, CDN, DefaultRestOptions, DefaultUserAgent, DiscordAPIError, DiscordErrorData, HTTPError, HandlerRequestData, HashData, ImageExtension, ImageSize, ImageURLOptions, InternalRequest, InvalidRequestWarningData, MakeURLOptions, OAuthErrorData, REST, RESTEvents, RESTOptions, RateLimitData, RateLimitError, RateLimitQueueFilter, RawFile, RequestBody, RequestData, RequestHeaders, RequestManager, RequestMethod, RequestOptions, RestEvents, RouteData, RouteLike, StickerExtension, makeURLSearchParams, parseResponse, version };
export { ALLOWED_EXTENSIONS, ALLOWED_SIZES, ALLOWED_STICKER_EXTENSIONS, APIRequest, BaseImageURLOptions, BurstHandlerMajorIdKey, CDN, DefaultRestOptions, DefaultUserAgent, DefaultUserAgentAppendix, DiscordAPIError, DiscordErrorData, HTTPError, HandlerRequestData, HashData, ImageExtension, ImageSize, ImageURLOptions, InternalRequest, InvalidRequestWarningData, MakeURLOptions, OAuthErrorData, OverwrittenMimeTypes, REST, RESTEvents, RESTOptions, RateLimitData, RateLimitError, RateLimitQueueFilter, RawFile, RequestBody, RequestData, RequestHeaders, RequestManager, RequestMethod, RequestOptions, RestEvents, RouteData, RouteLike, StickerExtension, makeURLSearchParams, parseResponse, version };