linter pass + export types
This commit is contained in:
parent
a7ce02cf33
commit
b55cea1de8
113
.eslintrc.json
113
.eslintrc.json
@ -15,17 +15,38 @@
|
|||||||
"sourceType": "module"
|
"sourceType": "module"
|
||||||
},
|
},
|
||||||
"rules": {
|
"rules": {
|
||||||
|
"@typescript-eslint/no-unused-vars": "off",
|
||||||
|
"@typescript-eslint/no-non-null-assertion":"off",
|
||||||
"accessor-pairs": "warn",
|
"accessor-pairs": "warn",
|
||||||
"array-callback-return": "warn",
|
"array-callback-return": "warn",
|
||||||
"array-bracket-newline": [ "warn", "consistent" ],
|
"array-bracket-newline": [
|
||||||
"array-bracket-spacing": [ "warn", "always", { "objectsInArrays": false, "arraysInArrays": false }],
|
"warn",
|
||||||
|
"consistent"
|
||||||
|
],
|
||||||
|
"array-bracket-spacing": [
|
||||||
|
"warn",
|
||||||
|
"always",
|
||||||
|
{
|
||||||
|
"objectsInArrays": false,
|
||||||
|
"arraysInArrays": false
|
||||||
|
}
|
||||||
|
],
|
||||||
"arrow-spacing": "warn",
|
"arrow-spacing": "warn",
|
||||||
"block-scoped-var": "warn",
|
"block-scoped-var": "warn",
|
||||||
"block-spacing": [ "warn", "always" ],
|
"block-spacing": [
|
||||||
"brace-style": [ "warn", "1tbs" ],
|
"warn",
|
||||||
|
"always"
|
||||||
|
],
|
||||||
|
"brace-style": [
|
||||||
|
"warn",
|
||||||
|
"allman"
|
||||||
|
],
|
||||||
"callback-return": "warn",
|
"callback-return": "warn",
|
||||||
"camelcase": "warn",
|
"camelcase": "warn",
|
||||||
"comma-dangle": [ "warn", "only-multiline" ],
|
"comma-dangle": [
|
||||||
|
"warn",
|
||||||
|
"only-multiline"
|
||||||
|
],
|
||||||
"comma-spacing": [
|
"comma-spacing": [
|
||||||
"warn",
|
"warn",
|
||||||
{
|
{
|
||||||
@ -68,9 +89,25 @@
|
|||||||
"implicit-arrow-linebreak": "warn",
|
"implicit-arrow-linebreak": "warn",
|
||||||
"indent": "warn",
|
"indent": "warn",
|
||||||
"init-declarations": "warn",
|
"init-declarations": "warn",
|
||||||
"jsx-quotes": [ "warn", "prefer-single" ],
|
"quotes": ["error" , "single"],
|
||||||
"key-spacing": [ "warn", { "beforeColon": false, "afterColon": true }],
|
"jsx-quotes": [
|
||||||
"keyword-spacing": [ "warn", { "after": true, "before": true }],
|
"warn",
|
||||||
|
"prefer-single"
|
||||||
|
],
|
||||||
|
"key-spacing": [
|
||||||
|
"warn",
|
||||||
|
{
|
||||||
|
"beforeColon": false,
|
||||||
|
"afterColon": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"keyword-spacing": [
|
||||||
|
"warn",
|
||||||
|
{
|
||||||
|
"after": true,
|
||||||
|
"before": true
|
||||||
|
}
|
||||||
|
],
|
||||||
"linebreak-style": [
|
"linebreak-style": [
|
||||||
"error",
|
"error",
|
||||||
"unix"
|
"unix"
|
||||||
@ -79,6 +116,24 @@
|
|||||||
"lines-around-directive": "warn",
|
"lines-around-directive": "warn",
|
||||||
"max-classes-per-file": "warn",
|
"max-classes-per-file": "warn",
|
||||||
"max-nested-callbacks": "warn",
|
"max-nested-callbacks": "warn",
|
||||||
|
"max-len": [
|
||||||
|
"warn",
|
||||||
|
{
|
||||||
|
"code": 140,
|
||||||
|
"ignoreComments": true,
|
||||||
|
"ignoreStrings": true,
|
||||||
|
"ignoreTemplateLiterals": true,
|
||||||
|
"ignoreRegExpLiterals": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"max-lines-per-function": [
|
||||||
|
"warn",
|
||||||
|
100
|
||||||
|
],
|
||||||
|
"max-depth": [
|
||||||
|
"warn",
|
||||||
|
3
|
||||||
|
],
|
||||||
"new-parens": "warn",
|
"new-parens": "warn",
|
||||||
"no-alert": "warn",
|
"no-alert": "warn",
|
||||||
"no-array-constructor": "warn",
|
"no-array-constructor": "warn",
|
||||||
@ -96,7 +151,6 @@
|
|||||||
"no-extend-native": "warn",
|
"no-extend-native": "warn",
|
||||||
"no-extra-bind": "warn",
|
"no-extra-bind": "warn",
|
||||||
"no-extra-label": "warn",
|
"no-extra-label": "warn",
|
||||||
"no-extra-parens": "warn",
|
|
||||||
"no-floating-decimal": "warn",
|
"no-floating-decimal": "warn",
|
||||||
"no-implicit-coercion": "warn",
|
"no-implicit-coercion": "warn",
|
||||||
"no-implicit-globals": "warn",
|
"no-implicit-globals": "warn",
|
||||||
@ -147,7 +201,7 @@
|
|||||||
"no-unmodified-loop-condition": "warn",
|
"no-unmodified-loop-condition": "warn",
|
||||||
"no-unneeded-ternary": "error",
|
"no-unneeded-ternary": "error",
|
||||||
"no-unused-expressions": "warn",
|
"no-unused-expressions": "warn",
|
||||||
"no-use-before-define": "error",
|
"@typescript-eslint/no-use-before-define": "error",
|
||||||
"no-useless-call": "warn",
|
"no-useless-call": "warn",
|
||||||
"no-useless-computed-key": "warn",
|
"no-useless-computed-key": "warn",
|
||||||
"no-useless-concat": "warn",
|
"no-useless-concat": "warn",
|
||||||
@ -155,20 +209,39 @@
|
|||||||
"no-useless-rename": "warn",
|
"no-useless-rename": "warn",
|
||||||
"no-useless-return": "warn",
|
"no-useless-return": "warn",
|
||||||
"no-var": "warn",
|
"no-var": "warn",
|
||||||
"no-void": "warn",
|
// "no-void": "warn",
|
||||||
"no-whitespace-before-property": "error",
|
"no-whitespace-before-property": "error",
|
||||||
"nonblock-statement-body-position": [ "warn", "below" ],
|
"nonblock-statement-body-position": [
|
||||||
|
"warn",
|
||||||
|
"below"
|
||||||
|
],
|
||||||
"object-curly-spacing": [
|
"object-curly-spacing": [
|
||||||
"warn",
|
"warn",
|
||||||
"always"
|
"always"
|
||||||
],
|
],
|
||||||
"object-property-newline": [ "warn", { "allowAllPropertiesOnSameLine": true }],
|
"object-property-newline": [
|
||||||
|
"warn",
|
||||||
|
{
|
||||||
|
"allowAllPropertiesOnSameLine": true
|
||||||
|
}
|
||||||
|
],
|
||||||
"object-shorthand": "warn",
|
"object-shorthand": "warn",
|
||||||
"one-var-declaration-per-line": "warn",
|
"one-var-declaration-per-line": "warn",
|
||||||
"operator-assignment": "warn",
|
"operator-assignment": "warn",
|
||||||
"operator-linebreak": [ "warn", "before" ],
|
"operator-linebreak": [
|
||||||
|
"warn",
|
||||||
|
"before"
|
||||||
|
],
|
||||||
"padding-line-between-statements": "warn",
|
"padding-line-between-statements": "warn",
|
||||||
"padded-blocks": [ "warn", { "switches": "never" }, { "allowSingleLineBlocks": true }],
|
"padded-blocks": [
|
||||||
|
"warn",
|
||||||
|
{
|
||||||
|
"switches": "never"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"allowSingleLineBlocks": true
|
||||||
|
}
|
||||||
|
],
|
||||||
"prefer-arrow-callback": "warn",
|
"prefer-arrow-callback": "warn",
|
||||||
"prefer-const": "warn",
|
"prefer-const": "warn",
|
||||||
"prefer-destructuring": "warn",
|
"prefer-destructuring": "warn",
|
||||||
@ -189,12 +262,18 @@
|
|||||||
"last"
|
"last"
|
||||||
],
|
],
|
||||||
"space-before-blocks": "warn",
|
"space-before-blocks": "warn",
|
||||||
"space-before-function-paren": [ "error", "always" ],
|
"space-before-function-paren": [
|
||||||
|
"error",
|
||||||
|
"always"
|
||||||
|
],
|
||||||
"space-in-parens": [
|
"space-in-parens": [
|
||||||
"warn",
|
"warn",
|
||||||
"never"
|
"never"
|
||||||
],
|
],
|
||||||
"spaced-comment": [ "warn", "always" ],
|
"spaced-comment": [
|
||||||
|
"warn",
|
||||||
|
"always"
|
||||||
|
],
|
||||||
"strict": "warn",
|
"strict": "warn",
|
||||||
"switch-colon-spacing": "warn",
|
"switch-colon-spacing": "warn",
|
||||||
"symbol-description": "warn",
|
"symbol-description": "warn",
|
||||||
|
3
index.ts
3
index.ts
@ -1,3 +1,4 @@
|
|||||||
import { WebhookClient } from "./src/WebhookClient.js";
|
import { WebhookClient } from './src/WebhookClient.js';
|
||||||
|
export { Payload, WebhookClientOptions } from './src/types/Webhook.js';
|
||||||
export { WebhookClient };
|
export { WebhookClient };
|
||||||
export default WebhookClient;
|
export default WebhookClient;
|
54
src/Http.ts
54
src/Http.ts
@ -1,7 +1,8 @@
|
|||||||
import fetch from 'node-fetch';
|
|
||||||
import RequestError from './util/RequestError.js';
|
import RequestError from './util/RequestError.js';
|
||||||
import { ApiErrorData } from './types/Api.js';
|
import { ApiErrorData } from './types/Api.js';
|
||||||
import EventEmitter from 'events';
|
import EventEmitter from 'events';
|
||||||
|
import fetch from 'node-fetch';
|
||||||
|
|
||||||
type RequestOptions = {
|
type RequestOptions = {
|
||||||
body?: string,
|
body?: string,
|
||||||
@ -21,7 +22,8 @@ type QueuedRequest = {
|
|||||||
reject: (err: RequestError) => void
|
reject: (err: RequestError) => void
|
||||||
}
|
}
|
||||||
|
|
||||||
class HttpClient extends EventEmitter {
|
class HttpClient extends EventEmitter
|
||||||
|
{
|
||||||
|
|
||||||
userAgent: string;
|
userAgent: string;
|
||||||
baseUrl: string | null;
|
baseUrl: string | null;
|
||||||
@ -32,7 +34,8 @@ class HttpClient extends EventEmitter {
|
|||||||
} = { remaining: 5 };
|
} = { remaining: 5 };
|
||||||
#queue: QueuedRequest[];
|
#queue: QueuedRequest[];
|
||||||
|
|
||||||
constructor ({ userAgent, baseUrl }: HttpClientOptions = {}) {
|
constructor ({ userAgent, baseUrl }: HttpClientOptions = {})
|
||||||
|
{
|
||||||
|
|
||||||
super();
|
super();
|
||||||
|
|
||||||
@ -45,7 +48,8 @@ class HttpClient extends EventEmitter {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#parseRateLimit (limits: {[key: string]: string}) {
|
#parseRateLimit (limits: {[key: string]: string})
|
||||||
|
{
|
||||||
// const bucket = limits['x-ratelimit-bucket'];
|
// const bucket = limits['x-ratelimit-bucket'];
|
||||||
const limit = parseInt(limits['x-ratelimit-limit']);
|
const limit = parseInt(limits['x-ratelimit-limit']);
|
||||||
if (isNaN(limit)) // if this doesn't exist the headers weren't returned
|
if (isNaN(limit)) // if this doesn't exist the headers weren't returned
|
||||||
@ -55,7 +59,8 @@ class HttpClient extends EventEmitter {
|
|||||||
const resetAfter = parseInt(limits['x-ratelimit-reset-after']) * 1000;
|
const resetAfter = parseInt(limits['x-ratelimit-reset-after']) * 1000;
|
||||||
this.#limit.remaining = remaining;
|
this.#limit.remaining = remaining;
|
||||||
if (this.#queue.length && !this.#limit.timeout)
|
if (this.#queue.length && !this.#limit.timeout)
|
||||||
this.#limit.timeout = setTimeout(async () => {
|
this.#limit.timeout = setTimeout(async () =>
|
||||||
|
{
|
||||||
this.#processQueue();
|
this.#processQueue();
|
||||||
delete this.#limit.timeout;
|
delete this.#limit.timeout;
|
||||||
}, resetAfter);
|
}, resetAfter);
|
||||||
@ -63,12 +68,15 @@ class HttpClient extends EventEmitter {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async #processQueue () {
|
async #processQueue ()
|
||||||
|
{
|
||||||
const queue = [ ...this.#queue ];
|
const queue = [ ...this.#queue ];
|
||||||
this.#queue = [];
|
this.#queue = [];
|
||||||
for (const req of queue) {
|
for (const req of queue)
|
||||||
|
{
|
||||||
const { path, options, resolve, reject } = req;
|
const { path, options, resolve, reject } = req;
|
||||||
if (!this.#limit.remaining) {
|
if (!this.#limit.remaining)
|
||||||
|
{
|
||||||
this.#queue.push(req);
|
this.#queue.push(req);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -78,7 +86,8 @@ class HttpClient extends EventEmitter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async #_request (path: string, options: RequestOptions): Promise<object | string | null> {
|
async #_request (path: string, options: RequestOptions): Promise<object | string | null>
|
||||||
|
{
|
||||||
|
|
||||||
let { headers } = options;
|
let { headers } = options;
|
||||||
const { body, method } = options;
|
const { body, method } = options;
|
||||||
@ -99,21 +108,25 @@ class HttpClient extends EventEmitter {
|
|||||||
const response = await fetch(url, request);
|
const response = await fetch(url, request);
|
||||||
|
|
||||||
const contentType = response.headers.get('Content-Type');
|
const contentType = response.headers.get('Content-Type');
|
||||||
const ratelimit = [ ...response.headers.entries() ].filter(([ key ]) => key.includes('x-ratelimit')).reduce((prev: {[key: string]: string}, [ key, val ]) => {
|
const ratelimit = [ ...response.headers.entries() ].filter(([ key ]) => key.includes('x-ratelimit')).reduce((prev: {[key: string]: string}, [ key, val ]) =>
|
||||||
|
{
|
||||||
prev[key] = val;
|
prev[key] = val;
|
||||||
return prev;
|
return prev;
|
||||||
}, {});
|
}, {});
|
||||||
|
|
||||||
this.#parseRateLimit(ratelimit);
|
this.#parseRateLimit(ratelimit);
|
||||||
|
|
||||||
if (response.status === 429) {
|
if (response.status === 429)
|
||||||
|
{
|
||||||
this.emit('rateLimited');
|
this.emit('rateLimited');
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) =>
|
||||||
|
{
|
||||||
this.#queue.push({ path, options, resolve, reject });
|
this.#queue.push({ path, options, resolve, reject });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok)
|
||||||
|
{
|
||||||
let message: ApiErrorData | null = null;
|
let message: ApiErrorData | null = null;
|
||||||
if (contentType === 'application/json')
|
if (contentType === 'application/json')
|
||||||
message = await response.json() as ApiErrorData;
|
message = await response.json() as ApiErrorData;
|
||||||
@ -134,9 +147,12 @@ class HttpClient extends EventEmitter {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async request (path: string, options: RequestOptions): Promise<object | string | null> {
|
async request (path: string, options: RequestOptions): Promise<object | string | null>
|
||||||
if (!this.#limit.remaining) {
|
{
|
||||||
return new Promise((resolve, reject) => {
|
if (!this.#limit.remaining)
|
||||||
|
{
|
||||||
|
return new Promise((resolve, reject) =>
|
||||||
|
{
|
||||||
this.#queue.push({ path, options, resolve, reject });
|
this.#queue.push({ path, options, resolve, reject });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -144,11 +160,13 @@ class HttpClient extends EventEmitter {
|
|||||||
return this.#_request(path, options);
|
return this.#_request(path, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
get (url: string) {
|
get (url: string)
|
||||||
|
{
|
||||||
return this.request(url, { method: 'GET' });
|
return this.request(url, { method: 'GET' });
|
||||||
}
|
}
|
||||||
|
|
||||||
post (url: string, body: object) {
|
post (url: string, body: object)
|
||||||
|
{
|
||||||
const headers = {
|
const headers = {
|
||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json'
|
||||||
};
|
};
|
||||||
|
@ -7,7 +7,8 @@ import { RequestError, WebhookError } from './util/index.js';
|
|||||||
|
|
||||||
const WebhookDestroyed = new WebhookError('Webhook does not exist');
|
const WebhookDestroyed = new WebhookError('Webhook does not exist');
|
||||||
|
|
||||||
class WebhookClient extends EventEmitter {
|
class WebhookClient extends EventEmitter
|
||||||
|
{
|
||||||
|
|
||||||
// Discord credentials
|
// Discord credentials
|
||||||
#url: string;
|
#url: string;
|
||||||
@ -24,14 +25,16 @@ class WebhookClient extends EventEmitter {
|
|||||||
#http: HttpClient;
|
#http: HttpClient;
|
||||||
#destroyed = false;
|
#destroyed = false;
|
||||||
|
|
||||||
constructor ({ url, token, id }: WebhookClientOptions) {
|
constructor ({ url, token, id }: WebhookClientOptions)
|
||||||
|
{
|
||||||
|
|
||||||
super();
|
super();
|
||||||
|
|
||||||
if (!url && (!token || !id))
|
if (!url && (!token || !id))
|
||||||
throw new Error('Missing webhook credentials, either pass a url or token and id');
|
throw new Error('Missing webhook credentials, either pass a url or token and id');
|
||||||
|
|
||||||
if (url && (!id || !token)) {
|
if (url && (!id || !token))
|
||||||
|
{
|
||||||
const parts = url.split('/');
|
const parts = url.split('/');
|
||||||
id = parts[parts.length - 2];
|
id = parts[parts.length - 2];
|
||||||
token = parts[parts.length - 1];
|
token = parts[parts.length - 1];
|
||||||
@ -51,7 +54,8 @@ class WebhookClient extends EventEmitter {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#patch (data: WebhookData) {
|
#patch (data: WebhookData)
|
||||||
|
{
|
||||||
|
|
||||||
if (data.id)
|
if (data.id)
|
||||||
this.#id = data.id;
|
this.#id = data.id;
|
||||||
@ -69,14 +73,18 @@ class WebhookClient extends EventEmitter {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
async fetch () {
|
async fetch ()
|
||||||
|
{
|
||||||
if (this.#destroyed)
|
if (this.#destroyed)
|
||||||
throw WebhookDestroyed;
|
throw WebhookDestroyed;
|
||||||
|
|
||||||
let result = null;
|
let result = null;
|
||||||
try {
|
try
|
||||||
|
{
|
||||||
result = await this.#http.get(this.#url);
|
result = await this.#http.get(this.#url);
|
||||||
} catch (err) {
|
}
|
||||||
|
catch (err)
|
||||||
|
{
|
||||||
if (err instanceof RequestError && err.httpCode === 404)
|
if (err instanceof RequestError && err.httpCode === 404)
|
||||||
this.#destroyed = true;
|
this.#destroyed = true;
|
||||||
throw err;
|
throw err;
|
||||||
@ -84,7 +92,8 @@ class WebhookClient extends EventEmitter {
|
|||||||
return this.#patch(result as WebhookData);
|
return this.#patch(result as WebhookData);
|
||||||
}
|
}
|
||||||
|
|
||||||
async send (content: string | Payload) {
|
async send (content: string | Payload)
|
||||||
|
{
|
||||||
if (this.#destroyed)
|
if (this.#destroyed)
|
||||||
throw WebhookDestroyed;
|
throw WebhookDestroyed;
|
||||||
|
|
||||||
@ -100,39 +109,48 @@ class WebhookClient extends EventEmitter {
|
|||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
get url () {
|
get url ()
|
||||||
|
{
|
||||||
return this.#url;
|
return this.#url;
|
||||||
}
|
}
|
||||||
|
|
||||||
get id () {
|
get id ()
|
||||||
|
{
|
||||||
return this.#id;
|
return this.#id;
|
||||||
}
|
}
|
||||||
|
|
||||||
get name () {
|
get name ()
|
||||||
|
{
|
||||||
return this.#name;
|
return this.#name;
|
||||||
}
|
}
|
||||||
|
|
||||||
get type () {
|
get type ()
|
||||||
|
{
|
||||||
return this.#type;
|
return this.#type;
|
||||||
}
|
}
|
||||||
|
|
||||||
get channelId () {
|
get channelId ()
|
||||||
|
{
|
||||||
return this.#channelId;
|
return this.#channelId;
|
||||||
}
|
}
|
||||||
|
|
||||||
get guildId () {
|
get guildId ()
|
||||||
|
{
|
||||||
return this.#guildId;
|
return this.#guildId;
|
||||||
}
|
}
|
||||||
|
|
||||||
get avatar () {
|
get avatar ()
|
||||||
|
{
|
||||||
return this.#avatar;
|
return this.#avatar;
|
||||||
}
|
}
|
||||||
|
|
||||||
get token () {
|
get token ()
|
||||||
|
{
|
||||||
return this.#token;
|
return this.#token;
|
||||||
}
|
}
|
||||||
|
|
||||||
get [Symbol.toStringTag] () {
|
get [Symbol.toStringTag] ()
|
||||||
|
{
|
||||||
return `{
|
return `{
|
||||||
name: ${this.name},
|
name: ${this.name},
|
||||||
type: ${this.type},
|
type: ${this.type},
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
import { ApiErrorData } from "../types/Api.js";
|
import { ApiErrorData } from '../types/Api.js';
|
||||||
|
|
||||||
class RequestError extends Error {
|
class RequestError extends Error
|
||||||
|
{
|
||||||
code?: number;
|
code?: number;
|
||||||
httpCode: number;
|
httpCode: number;
|
||||||
constructor (response: ApiErrorData) {
|
constructor (response: ApiErrorData)
|
||||||
|
{
|
||||||
super(`[${response.code ?? response.httpCode}] ${response.message}`);
|
super(`[${response.code ?? response.httpCode}] ${response.message}`);
|
||||||
|
|
||||||
this.code = response.code;
|
this.code = response.code;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import RequestError from "./RequestError.js";
|
import RequestError from './RequestError.js';
|
||||||
import WebhookError from "./WebhookError.js";
|
import WebhookError from './WebhookError.js';
|
||||||
|
|
||||||
export { RequestError, WebhookError };
|
export { RequestError, WebhookError };
|
@ -1,5 +1,5 @@
|
|||||||
import WebhookClient from '../build/esm/index.js';
|
import WebhookClient from '../build/esm/index.js';
|
||||||
import EventEmitter from "events";
|
import EventEmitter from 'events';
|
||||||
|
|
||||||
const webhook = new WebhookClient({ url: 'https://discord.com/api/webhooks/1093874668886294548/uDMRD6g1lmq_2EZynsbKytzWoMM-0N4te0m61r_cv1BsSnDKDxG3fvI6sxSoG5t5b_xn' });
|
const webhook = new WebhookClient({ url: 'https://discord.com/api/webhooks/1093874668886294548/uDMRD6g1lmq_2EZynsbKytzWoMM-0N4te0m61r_cv1BsSnDKDxG3fvI6sxSoG5t5b_xn' });
|
||||||
// new WebhookClient({ token: 'uDMRD6g1lmq_2EZynsbKytzWoMM-0N4te0m61r_cv1BsSnDKDxG3fvI6sxSoG5t5b_xn', id: '1093874668886294548' });
|
// new WebhookClient({ token: 'uDMRD6g1lmq_2EZynsbKytzWoMM-0N4te0m61r_cv1BsSnDKDxG3fvI6sxSoG5t5b_xn', id: '1093874668886294548' });
|
||||||
|
224
tsconfig.json
224
tsconfig.json
@ -1,113 +1,113 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
/* Visit https://aka.ms/tsconfig to read more about this file */
|
/* Visit https://aka.ms/tsconfig to read more about this file */
|
||||||
|
|
||||||
/* Projects */
|
/* Projects */
|
||||||
// "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
|
// "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
|
||||||
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
|
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
|
||||||
// "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
|
// "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
|
||||||
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
|
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
|
||||||
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
|
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
|
||||||
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
|
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
|
||||||
|
|
||||||
/* Language and Environment */
|
/* Language and Environment */
|
||||||
"target": "ES2022", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
|
"target": "ES2022", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
|
||||||
"lib": ["ES2022"], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
|
"lib": ["ES2022"], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
|
||||||
// "jsx": "preserve", /* Specify what JSX code is generated. */
|
// "jsx": "preserve", /* Specify what JSX code is generated. */
|
||||||
// "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
|
// "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
|
||||||
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
|
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
|
||||||
// "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
|
// "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
|
||||||
// "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
|
// "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
|
||||||
// "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
|
// "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
|
||||||
// "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
|
// "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
|
||||||
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
|
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
|
||||||
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
|
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
|
||||||
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
|
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
|
||||||
|
|
||||||
/* Modules */
|
/* Modules */
|
||||||
"module": "ES2022", /* Specify what module code is generated. */
|
"module": "ES2022", /* Specify what module code is generated. */
|
||||||
// "rootDir": "./", /* Specify the root folder within your source files. */
|
// "rootDir": "./", /* Specify the root folder within your source files. */
|
||||||
"moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
|
"moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
|
||||||
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
|
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
|
||||||
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
||||||
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
|
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
|
||||||
"typeRoots": [
|
"typeRoots": [
|
||||||
"./node_modules/@types",
|
"./node_modules/@types",
|
||||||
"./@types"
|
"./@types"
|
||||||
], /* Specify multiple folders that act like './node_modules/@types'. */
|
], /* Specify multiple folders that act like './node_modules/@types'. */
|
||||||
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
|
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
|
||||||
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
||||||
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
|
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
|
||||||
// "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */
|
// "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */
|
||||||
// "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */
|
// "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */
|
||||||
// "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */
|
// "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */
|
||||||
// "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */
|
// "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */
|
||||||
// "resolveJsonModule": true, /* Enable importing .json files. */
|
// "resolveJsonModule": true, /* Enable importing .json files. */
|
||||||
// "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */
|
// "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */
|
||||||
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
|
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
|
||||||
|
|
||||||
/* JavaScript Support */
|
/* JavaScript Support */
|
||||||
"allowJs": false, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
|
"allowJs": false, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
|
||||||
// "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
|
// "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
|
||||||
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
|
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
|
||||||
|
|
||||||
/* Emit */
|
/* Emit */
|
||||||
"declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
|
"declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
|
||||||
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
|
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
|
||||||
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
|
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
|
||||||
"sourceMap": true, /* Create source map files for emitted JavaScript files. */
|
"sourceMap": true, /* Create source map files for emitted JavaScript files. */
|
||||||
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
|
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
|
||||||
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
|
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
|
||||||
"outDir": "./build/esm", /* Specify an output folder for all emitted files. */
|
"outDir": "./build/esm", /* Specify an output folder for all emitted files. */
|
||||||
// "removeComments": true, /* Disable emitting comments. */
|
// "removeComments": true, /* Disable emitting comments. */
|
||||||
// "noEmit": true, /* Disable emitting files from a compilation. */
|
// "noEmit": true, /* Disable emitting files from a compilation. */
|
||||||
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
|
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
|
||||||
// "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */
|
// "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */
|
||||||
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
|
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
|
||||||
// "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
|
// "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
|
||||||
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
||||||
// "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
|
// "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
|
||||||
// "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
|
// "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
|
||||||
// "newLine": "crlf", /* Set the newline character for emitting files. */
|
// "newLine": "crlf", /* Set the newline character for emitting files. */
|
||||||
"stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
|
"stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
|
||||||
// "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
|
// "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
|
||||||
// "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
|
// "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
|
||||||
// "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
|
// "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
|
||||||
// "declarationDir": "./", /* Specify the output directory for generated declaration files. */
|
// "declarationDir": "./", /* Specify the output directory for generated declaration files. */
|
||||||
// "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
|
// "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
|
||||||
|
|
||||||
/* Interop Constraints */
|
/* Interop Constraints */
|
||||||
// "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
|
// "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
|
||||||
// "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */
|
// "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */
|
||||||
// "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
|
// "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
|
||||||
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
|
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
|
||||||
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
|
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
|
||||||
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
|
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
|
||||||
|
|
||||||
/* Type Checking */
|
/* Type Checking */
|
||||||
"strict": true, /* Enable all strict type-checking options. */
|
"strict": true, /* Enable all strict type-checking options. */
|
||||||
"noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
|
"noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
|
||||||
// "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
|
// "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
|
||||||
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
|
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
|
||||||
// "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
|
// "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
|
||||||
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
|
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
|
||||||
"noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
|
"noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
|
||||||
// "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
|
// "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
|
||||||
"alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
|
"alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
|
||||||
"noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
|
"noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
|
||||||
"noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
|
"noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
|
||||||
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
|
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
|
||||||
"noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
|
"noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
|
||||||
"noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
|
"noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
|
||||||
// "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
|
// "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
|
||||||
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
|
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
|
||||||
// "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
|
// "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
|
||||||
// "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
|
// "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
|
||||||
// "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
|
// "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
|
||||||
|
|
||||||
/* Completeness */
|
/* Completeness */
|
||||||
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
|
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
|
||||||
"skipLibCheck": true /* Skip type checking all .d.ts files. */
|
"skipLibCheck": true /* Skip type checking all .d.ts files. */
|
||||||
},
|
},
|
||||||
"compileOnSave": true
|
"compileOnSave": true
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user