From cedf75f28e10c2b3c4223f1e50fd97b678eb4ebe Mon Sep 17 00:00:00 2001 From: Jonathan Ho <48591478+H01001000@users.noreply.github.com> Date: Thu, 20 Oct 2022 22:44:34 +0800 Subject: [PATCH] fix: bigbot template (#2535) * chore: fix script extension * chore: remove extention * fix: at least it run can now * chore: fix dev script * refactor: change to use env file for config * chore: update readme --- template/bigbot/.env.example | 88 +- template/bigbot/.swcrc | 31 + template/bigbot/README.md | 12 +- template/bigbot/nodemon.json | 6 + template/bigbot/package-lock.json | 999 +++++++++++++++++- template/bigbot/package.json | 28 +- template/bigbot/src/analytics.ts | 6 +- template/bigbot/src/bot/bot.ts | 11 +- .../src/bot/events/interactions/command.ts | 48 +- .../bigbot/src/bot/events/interactions/mod.ts | 3 +- template/bigbot/src/bot/events/mod.ts | 6 +- template/bigbot/src/bot/index.ts | 30 +- .../bigbot/src/bot/languages/translate.ts | 3 +- template/bigbot/src/bot/typings/discordeno.ts | 19 +- .../src/bot/utils/slash/createCommand.ts | 155 +-- .../src/bot/utils/slash/updateCommands.ts | 3 +- template/bigbot/src/configs.ts | 91 +- template/bigbot/src/gateway/index.ts | 34 +- template/bigbot/src/gateway/worker.ts | 5 +- template/bigbot/src/rest/index.ts | 11 +- template/bigbot/tsconfig.json | 17 +- 21 files changed, 1298 insertions(+), 308 deletions(-) create mode 100644 template/bigbot/.swcrc create mode 100644 template/bigbot/nodemon.json diff --git a/template/bigbot/.env.example b/template/bigbot/.env.example index 4aeeec32a..6f538a571 100644 --- a/template/bigbot/.env.example +++ b/template/bigbot/.env.example @@ -1,4 +1,86 @@ -# For Prisma use. Remember to remove the `[` and `]` -DATABASE_URL=postgres://[username]:[password]@[host]:[port]/[db] +# For Prisma use. Remember to remove the [ and ] +DATABASE_URL=postgres:#[username]:[password]@[host]:[port]/[db] -# For other configs, update src/configs.ts \ No newline at end of file +# For other configs, update src/configs.ts + +# General Configurations +# Whether or not this process is a local development version. Change to false for the main production bot. */ +# SETUP-DD-TEMP: Change this to false in your server for production bot. Keep true in local testing. +DEVELOPMENT=true + +# The server id where you develop/test the bot. */ +# SETUP-DD-TEMP: Change the id to a server where you develop the bot privately. +DEV_SERVER_ID= + +# The discord bot token, without the BOT prefix. */ +# SETUP-DD-TEMP: Add the bot token here. +DISCORD_TOKEN= + +# Bot Configurations +# The secret passcode that the bot code (event handler) is listening for. This is used to prevent someone else from trying to send malicious messages to your bot. */ +# SETUP-DD-TEMP: Add a secret passcode here. +EVENT_HANDLER_AUTHORIZATION=server + +# The host where the event handler will run. Must follow https:#nodejs.org/api/net.html#serverlistenoptions-callback. */ +# SETUP-DD-TEMP: Set the event handler's host here. +EVENT_HANDLER_HOST=localhost + +# The port where the event handler is listening for events. */ +# SETUP-DD-TEMP: Set the desired port where events will be sent to be processed. +EVENT_HANDLER_PORT=8081 + +# The full webhook url where the bot can send errors to alert you that the bot is missing translations. */ +# SETUP-DD-TEMP: Set a full discord webhook url here. +MISSING_TRANSLATION_WEBHOOK= + +# The full webhook url where the bot can send errors to alert you that the bot is throwing errors. */ +# SETUP-DD-TEMP: Set a full discord webhook url here. +BUGS_ERRORS_REPORT_WEBHOOK= + +# Rest Proxy Configurations +# The authorization code that the REST proxy will check for to make sure the requests are coming from you. */ +# SETUP-DD-TEMP: Add a secret passcode here. +REST_AUTHORIZATION=secret + +# The host where the REST proxy will run. Must follow https:#nodejs.org/api/net.html#serverlistenoptions-callback. */ +# SETUP-DD-TEMP: Set the REST proxy's host here. +REST_HOST=localhost + +# The port that will run the REST proxy. */ +# SETUP-DD-TEMP: Choose the port number here that will be used for the REST proxy. +REST_PORT=8000 + +# Gateway Proxy Configurations + +# The amount of shards to start. Useful with multiple servers where each server is handling a portion of your bot. */ +# SETUP-DD-TEMP: To start all bots, leave it as undefined. Specify he number of shards this process should handle. +TOTAL_SHARDS= + +# The amount of shards to start per worker. */ +# SETUP-DD-TEMP: Choose how many shards to start per worker. If you are not sure just stick to 16. +SHARDS_PER_WORKER=16 + +# The total amount of workers to start. Generally this should be equal to the number of cores your server has. */ +# SETUP-DD-TEMP: Choose how many workers to start up. If you are not sure, check how many cores your server has. +TOTAL_WORKERS=4 + +# The secret passcode that the gateway is listening for. This is used to prevent someone else from trying to send malicious messages to your bot. */ +# SETUP-DD-TEMP: Add a secret passcode here. +GATEWAY_AUTHORIZATION= + +# The host where the gateway will run. Must follow https:#nodejs.org/api/net.html#serverlistenoptions-callback. */ +# SETUP-DD-TEMP: Set the gateways's host here. +GATEWAY_HOST=localhost + +# The port where the gateway will run. This is where the bot will send its messages to the gateway. */ +# SETUP-DD-TEMP: Set the gateways's port here. +GATEWAY_PORT=8080 + +# Database Configurations + +# These INFLUX configs are only if you wish to enable analytics. */ +# SETUP-DD-TEMP: This is optional. If you want to build analytics, add influxdb here. +INFLUX_BUCKET= +INFLUX_ORG= +INFLUX_TOKEN= +INFLUX_URL= diff --git a/template/bigbot/.swcrc b/template/bigbot/.swcrc new file mode 100644 index 000000000..5ae43bb99 --- /dev/null +++ b/template/bigbot/.swcrc @@ -0,0 +1,31 @@ +{ + "minify": true, + "jsc": { + "parser": { + "syntax": "typescript", + "decorators": true, + "dynamicImport": true + }, + "transform": { + "legacyDecorator": true, + "decoratorMetadata": true + }, + "target": "es2022", + "keepClassNames": true, + "loose": true, + "minify": { + "compress": { + "unused": true + }, + "mangle": true + } + }, + "module": { + "type": "es6", + "strict": false, + "strictMode": true, + "lazy": false, + "noInterop": false + }, + "sourceMaps": "inline" +} \ No newline at end of file diff --git a/template/bigbot/README.md b/template/bigbot/README.md index 6912fed8c..7c71c117a 100644 --- a/template/bigbot/README.md +++ b/template/bigbot/README.md @@ -17,15 +17,11 @@ Make sure to install the latest version when you use it. To start your bot, you will need to start a few processes. The instructions below will use `node` but you can use something like `pm2` to help keep your processes alive. -Please compile everything first with `tsc`. +Please compile everything first with `npm run build`. - Start REST - - `ts-node src/rest/index.ts` + - `npm run startr` - Start Gateway - - `ts-node src/gateway/index.ts` + - `npm run startg` - Start Bot - - `ts-node src/bot/index.ts` - -## Improvements - -- Change configs.ts file to use an .env file. + - `npm run startb` diff --git a/template/bigbot/nodemon.json b/template/bigbot/nodemon.json new file mode 100644 index 000000000..7cc03a26e --- /dev/null +++ b/template/bigbot/nodemon.json @@ -0,0 +1,6 @@ +{ + "watch": "./src/**/*.ts", + "ext ": "env,ts", + "signal": "SIGKILL", + "exec": "npm run build && node --experimental-specifier-resolution=node" +} \ No newline at end of file diff --git a/template/bigbot/package-lock.json b/template/bigbot/package-lock.json index 210520184..67b19850c 100644 --- a/template/bigbot/package-lock.json +++ b/template/bigbot/package-lock.json @@ -12,20 +12,23 @@ "@prisma/client": "^3.15.2", "colorette": "^2.0.19", "discordeno": "^16.0.1", + "dotenv": "^16.0.3", "express": "^4.18.1", "fastify": "^4.8.1", "nanoid": "^4.0.0", - "ts-node": "^10.9.1", - "tslib": "^2.3.1", + "node-fetch": "^3.2.10", "web-worker": "^1.2.0" }, "devDependencies": { + "@swc/cli": "^0.1.57", + "@swc/core": "^1.3.9", "@types/express": "^4.17.13", "@types/node": "^17.0.23", "@types/ws": "^8.5.3", "nodemon": "^2.0.15", "prettier": "2.6.2", "prisma": "^4.2.1", + "ts-node": "^10.9.1", "typescript": "^4.6.3" } }, @@ -33,6 +36,7 @@ "version": "0.8.1", "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", + "dev": true, "dependencies": { "@jridgewell/trace-mapping": "0.3.9" }, @@ -96,6 +100,7 @@ "version": "3.1.0", "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz", "integrity": "sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==", + "dev": true, "engines": { "node": ">=6.0.0" } @@ -103,17 +108,54 @@ "node_modules/@jridgewell/sourcemap-codec": { "version": "1.4.14", "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz", - "integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==" + "integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==", + "dev": true }, "node_modules/@jridgewell/trace-mapping": { "version": "0.3.9", "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", + "dev": true, "dependencies": { "@jridgewell/resolve-uri": "^3.0.3", "@jridgewell/sourcemap-codec": "^1.4.10" } }, + "node_modules/@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dev": true, + "dependencies": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, + "dependencies": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + }, + "engines": { + "node": ">= 8" + } + }, "node_modules/@prisma/client": { "version": "3.15.2", "resolved": "https://registry.npmjs.org/@prisma/client/-/client-3.15.2.tgz", @@ -146,25 +188,357 @@ "resolved": "https://registry.npmjs.org/@prisma/engines-version/-/engines-version-3.15.1-1.461d6a05159055555eb7dfb337c9fb271cbd4d7e.tgz", "integrity": "sha512-e3k2Vd606efd1ZYy2NQKkT4C/pn31nehyLhVug6To/q8JT8FpiMrDy7zmm3KLF0L98NOQQcutaVtAPhzKhzn9w==" }, + "node_modules/@swc/cli": { + "version": "0.1.57", + "resolved": "https://registry.npmjs.org/@swc/cli/-/cli-0.1.57.tgz", + "integrity": "sha512-HxM8TqYHhAg+zp7+RdTU69bnkl4MWdt1ygyp6BDIPjTiaJVH6Dizn2ezbgDS8mnFZI1FyhKvxU/bbaUs8XhzQg==", + "dev": true, + "dependencies": { + "commander": "^7.1.0", + "fast-glob": "^3.2.5", + "slash": "3.0.0", + "source-map": "^0.7.3" + }, + "bin": { + "spack": "bin/spack.js", + "swc": "bin/swc.js" + }, + "engines": { + "node": ">= 12.13" + }, + "peerDependencies": { + "@swc/core": "^1.2.66", + "chokidar": "^3.5.1" + }, + "peerDependenciesMeta": { + "chokidar": { + "optional": true + } + } + }, + "node_modules/@swc/core": { + "version": "1.3.9", + "resolved": "https://registry.npmjs.org/@swc/core/-/core-1.3.9.tgz", + "integrity": "sha512-PCRCO9vIoEX3FyS3z/FkWVYJzuspUq0LLaWdK3L30+KQDtH29K+LQdRc2Dzin2MU5MpY4bSHydAwl9M6cmZ9OA==", + "dev": true, + "hasInstallScript": true, + "bin": { + "swcx": "run_swcx.js" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/swc" + }, + "optionalDependencies": { + "@swc/core-android-arm-eabi": "1.3.9", + "@swc/core-android-arm64": "1.3.9", + "@swc/core-darwin-arm64": "1.3.9", + "@swc/core-darwin-x64": "1.3.9", + "@swc/core-freebsd-x64": "1.3.9", + "@swc/core-linux-arm-gnueabihf": "1.3.9", + "@swc/core-linux-arm64-gnu": "1.3.9", + "@swc/core-linux-arm64-musl": "1.3.9", + "@swc/core-linux-x64-gnu": "1.3.9", + "@swc/core-linux-x64-musl": "1.3.9", + "@swc/core-win32-arm64-msvc": "1.3.9", + "@swc/core-win32-ia32-msvc": "1.3.9", + "@swc/core-win32-x64-msvc": "1.3.9" + } + }, + "node_modules/@swc/core-android-arm-eabi": { + "version": "1.3.9", + "resolved": "https://registry.npmjs.org/@swc/core-android-arm-eabi/-/core-android-arm-eabi-1.3.9.tgz", + "integrity": "sha512-+F+sU2l49Po4tJoNtIpFwt0k1sspymvPMM+DCpnkHF1idzRiOU5NGgVzmLDjoO9AnxHa7EBJ3itN+PP2Dd06+A==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "dependencies": { + "@swc/wasm": "1.2.122" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@swc/core-android-arm64": { + "version": "1.3.9", + "resolved": "https://registry.npmjs.org/@swc/core-android-arm64/-/core-android-arm64-1.3.9.tgz", + "integrity": "sha512-HSWdex3yd4CRefkM2WVz0nTKjpirNZnwSlghqe4ct9QAYGMiiPesYgWPAnq/PpnYfmjQse4yvEclamGiek6zDA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "dependencies": { + "@swc/wasm": "1.2.130" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@swc/core-android-arm64/node_modules/@swc/wasm": { + "version": "1.2.130", + "resolved": "https://registry.npmjs.org/@swc/wasm/-/wasm-1.2.130.tgz", + "integrity": "sha512-rNcJsBxS70+pv8YUWwf5fRlWX6JoY/HJc25HD/F8m6Kv7XhJdqPPMhyX6TKkUBPAG7TWlZYoxa+rHAjPy4Cj3Q==", + "dev": true, + "optional": true + }, + "node_modules/@swc/core-darwin-arm64": { + "version": "1.3.9", + "resolved": "https://registry.npmjs.org/@swc/core-darwin-arm64/-/core-darwin-arm64-1.3.9.tgz", + "integrity": "sha512-E7WJY1LsMJtOtUYc/JXl8qlt6USnzodWmdO1eAAOSAODEdX9AjgG3fRT94o3UcmvMrto7sxBXVExj8wG7Cxeng==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=10" + } + }, + "node_modules/@swc/core-darwin-x64": { + "version": "1.3.9", + "resolved": "https://registry.npmjs.org/@swc/core-darwin-x64/-/core-darwin-x64-1.3.9.tgz", + "integrity": "sha512-0+dFCAcLEBxwIO+0Nt+OT8mjPpvBMBWIuFWB1DNiUu2K73+OB0i+llzsCJFoasISHR+YJD0bGyv+8AtVuUdFAw==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=10" + } + }, + "node_modules/@swc/core-freebsd-x64": { + "version": "1.3.9", + "resolved": "https://registry.npmjs.org/@swc/core-freebsd-x64/-/core-freebsd-x64-1.3.9.tgz", + "integrity": "sha512-JbHIeklQPRBEZUfKAKt/IB/ayi7dJZ9tEGu/fDxNfk8Znu1Md+YOKRyN5FPMXfYrL5yFUXnlFOb2LX6wjNhhjQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ], + "dependencies": { + "@swc/wasm": "1.2.130" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@swc/core-freebsd-x64/node_modules/@swc/wasm": { + "version": "1.2.130", + "resolved": "https://registry.npmjs.org/@swc/wasm/-/wasm-1.2.130.tgz", + "integrity": "sha512-rNcJsBxS70+pv8YUWwf5fRlWX6JoY/HJc25HD/F8m6Kv7XhJdqPPMhyX6TKkUBPAG7TWlZYoxa+rHAjPy4Cj3Q==", + "dev": true, + "optional": true + }, + "node_modules/@swc/core-linux-arm-gnueabihf": { + "version": "1.3.9", + "resolved": "https://registry.npmjs.org/@swc/core-linux-arm-gnueabihf/-/core-linux-arm-gnueabihf-1.3.9.tgz", + "integrity": "sha512-Yc1G8FGXmq6yGKtu5wYCcvVWBtqU0/3FUk6zJM+7pFiivKsVHJcgWrkgLO1u6h7bgEdQIYwfM3/BbRNE5CtdnA==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "dependencies": { + "@swc/wasm": "1.2.130" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@swc/core-linux-arm-gnueabihf/node_modules/@swc/wasm": { + "version": "1.2.130", + "resolved": "https://registry.npmjs.org/@swc/wasm/-/wasm-1.2.130.tgz", + "integrity": "sha512-rNcJsBxS70+pv8YUWwf5fRlWX6JoY/HJc25HD/F8m6Kv7XhJdqPPMhyX6TKkUBPAG7TWlZYoxa+rHAjPy4Cj3Q==", + "dev": true, + "optional": true + }, + "node_modules/@swc/core-linux-arm64-gnu": { + "version": "1.3.9", + "resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-gnu/-/core-linux-arm64-gnu-1.3.9.tgz", + "integrity": "sha512-PrBjmPIMhoQLCpfaZl2b1cCXnaNPddQB/ssMVqQ6eXChBJfcv14M5BjxtI2ORi4HoEDlsbX+k50sL666M3lnBw==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=10" + } + }, + "node_modules/@swc/core-linux-arm64-musl": { + "version": "1.3.9", + "resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-musl/-/core-linux-arm64-musl-1.3.9.tgz", + "integrity": "sha512-jJT56vt81o2N3O2nXp+MZGM6mbgkNx6lvvRT6yISW29fLM6NHBXmkGcjaWOD9VFJDRmu/MtFxbElPxr6ikrFYQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=10" + } + }, + "node_modules/@swc/core-linux-x64-gnu": { + "version": "1.3.9", + "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.3.9.tgz", + "integrity": "sha512-60ZreTvrJk3N7xvPzQeQJDePsXUmSUZkKD6lc0xzug4bv53NyUIQ8gH8nzVsV++D9NZeVxXp6WqqFLcgt7yEDQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=10" + } + }, + "node_modules/@swc/core-linux-x64-musl": { + "version": "1.3.9", + "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.3.9.tgz", + "integrity": "sha512-UBApPfUSP+w6ye6V1oT4EGh3LFCFrZaQsC1CkTuiYXXSmQMzkYE0Jzegn3R7MHWCJSneRwXRTKrkdhrNBUqWKA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=10" + } + }, + "node_modules/@swc/core-win32-arm64-msvc": { + "version": "1.3.9", + "resolved": "https://registry.npmjs.org/@swc/core-win32-arm64-msvc/-/core-win32-arm64-msvc-1.3.9.tgz", + "integrity": "sha512-4FQSalXbbnqTLVGRljRnw/bJ99Jwj1WnXz/aJM/SVL8S9Zbc82+3v+wXL/9NGwaAndu2QUkb2KPYNAHvB7PCdw==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "dependencies": { + "@swc/wasm": "1.2.130" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@swc/core-win32-arm64-msvc/node_modules/@swc/wasm": { + "version": "1.2.130", + "resolved": "https://registry.npmjs.org/@swc/wasm/-/wasm-1.2.130.tgz", + "integrity": "sha512-rNcJsBxS70+pv8YUWwf5fRlWX6JoY/HJc25HD/F8m6Kv7XhJdqPPMhyX6TKkUBPAG7TWlZYoxa+rHAjPy4Cj3Q==", + "dev": true, + "optional": true + }, + "node_modules/@swc/core-win32-ia32-msvc": { + "version": "1.3.9", + "resolved": "https://registry.npmjs.org/@swc/core-win32-ia32-msvc/-/core-win32-ia32-msvc-1.3.9.tgz", + "integrity": "sha512-ZkTw1Cm+b2QBf/NjkJJbocvgT0NWdfPQL0OyMkuTAinRzfrMmq/lmshjnqj3ysFVeI4uuJTNemiT6mivpLmuBw==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "dependencies": { + "@swc/wasm": "1.2.130" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@swc/core-win32-ia32-msvc/node_modules/@swc/wasm": { + "version": "1.2.130", + "resolved": "https://registry.npmjs.org/@swc/wasm/-/wasm-1.2.130.tgz", + "integrity": "sha512-rNcJsBxS70+pv8YUWwf5fRlWX6JoY/HJc25HD/F8m6Kv7XhJdqPPMhyX6TKkUBPAG7TWlZYoxa+rHAjPy4Cj3Q==", + "dev": true, + "optional": true + }, + "node_modules/@swc/core-win32-x64-msvc": { + "version": "1.3.9", + "resolved": "https://registry.npmjs.org/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.3.9.tgz", + "integrity": "sha512-moKi2prCKzYnXXlrLf5nwAN4uGSm4YpsW2xzYiZWJJDRqu74VoUWoDkG25jalHTfN/PSBQg4dkFWhhUe89JJVw==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=10" + } + }, + "node_modules/@swc/wasm": { + "version": "1.2.122", + "resolved": "https://registry.npmjs.org/@swc/wasm/-/wasm-1.2.122.tgz", + "integrity": "sha512-sM1VCWQxmNhFtdxME+8UXNyPNhxNu7zdb6ikWpz0YKAQQFRGT5ThZgJrubEpah335SUToNg8pkdDF7ibVCjxbQ==", + "dev": true, + "optional": true + }, "node_modules/@tsconfig/node10": { "version": "1.0.9", "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz", - "integrity": "sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==" + "integrity": "sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==", + "dev": true }, "node_modules/@tsconfig/node12": { "version": "1.0.11", "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", - "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==" + "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==", + "dev": true }, "node_modules/@tsconfig/node14": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", - "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==" + "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==", + "dev": true }, "node_modules/@tsconfig/node16": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.3.tgz", - "integrity": "sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ==" + "integrity": "sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ==", + "dev": true }, "node_modules/@types/body-parser": { "version": "1.19.2", @@ -217,7 +591,8 @@ "node_modules/@types/node": { "version": "17.0.45", "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.45.tgz", - "integrity": "sha512-w+tIMs3rq2afQdsPJlODhoUEKzFP1ayaoyl1CcnwtIlsVe7K7bA1NGm4s3PraqTLlXnbIN84zuBlxBWo1u9BLw==" + "integrity": "sha512-w+tIMs3rq2afQdsPJlODhoUEKzFP1ayaoyl1CcnwtIlsVe7K7bA1NGm4s3PraqTLlXnbIN84zuBlxBWo1u9BLw==", + "dev": true }, "node_modules/@types/qs": { "version": "6.9.7", @@ -288,6 +663,7 @@ "version": "8.8.0", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.0.tgz", "integrity": "sha512-QOxyigPVrpZ2GXT+PFyZTl6TtOFc5egxHIP9IlQ+RbupQuX4RkT/Bee4/kQuC02Xkzg84JcT7oLYtDIQxp+v7w==", + "dev": true, "bin": { "acorn": "bin/acorn" }, @@ -299,6 +675,7 @@ "version": "8.2.0", "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", + "dev": true, "engines": { "node": ">=0.4.0" } @@ -355,7 +732,8 @@ "node_modules/arg": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", - "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==" + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", + "dev": true }, "node_modules/array-flatten": { "version": "1.1.1", @@ -566,6 +944,15 @@ "resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.19.tgz", "integrity": "sha512-3tlv/dIP7FWvj3BsbHrGLJ6l/oKh1O3TcgBqMn+yyCagOxc23fyzDS6HypQbgxWbkpDnf52p1LuR4eWDQ/K9WQ==" }, + "node_modules/commander": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz", + "integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==", + "dev": true, + "engines": { + "node": ">= 10" + } + }, "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", @@ -607,7 +994,16 @@ "node_modules/create-require": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", - "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==" + "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", + "dev": true + }, + "node_modules/data-uri-to-buffer": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-4.0.0.tgz", + "integrity": "sha512-Vr3mLBA8qWmcuschSLAOogKgQ/Jwxulv3RNE4FXnYWRGujzrRWQI4m12fQqRkwX06C0KanhLr4hK+GydchZsaA==", + "engines": { + "node": ">= 12" + } }, "node_modules/debug": { "version": "2.6.9", @@ -638,6 +1034,7 @@ "version": "4.0.2", "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "dev": true, "engines": { "node": ">=0.3.1" } @@ -653,6 +1050,14 @@ "ws": "^8.4.0" } }, + "node_modules/dotenv": { + "version": "16.0.3", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.3.tgz", + "integrity": "sha512-7GO6HghkA5fYG9TYnNxi14/7K9f5occMlp3zXAuSxn7CKCxt9xbNWG7yF8hTCSUchlfWSe3uLmlPfigevRItzQ==", + "engines": { + "node": ">=12" + } + }, "node_modules/ee-first": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", @@ -746,6 +1151,22 @@ "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" }, + "node_modules/fast-glob": { + "version": "3.2.12", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.12.tgz", + "integrity": "sha512-DVj4CQIYYow0BlaelwK1pHl5n5cRSJfM60UA0zK891sVInoPri2Ekj7+e1CT3/3qxXenpI+nBBmQAcJPJgaj4w==", + "dev": true, + "dependencies": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.4" + }, + "engines": { + "node": ">=8.6.0" + } + }, "node_modules/fast-json-stringify": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/fast-json-stringify/-/fast-json-stringify-5.1.0.tgz", @@ -808,6 +1229,28 @@ "reusify": "^1.0.4" } }, + "node_modules/fetch-blob": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/fetch-blob/-/fetch-blob-3.2.0.tgz", + "integrity": "sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/jimmywarting" + }, + { + "type": "paypal", + "url": "https://paypal.me/jimmywarting" + } + ], + "dependencies": { + "node-domexception": "^1.0.0", + "web-streams-polyfill": "^3.0.3" + }, + "engines": { + "node": "^12.20 || >= 14.13" + } + }, "node_modules/fill-range": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", @@ -850,6 +1293,17 @@ "node": ">=14" } }, + "node_modules/formdata-polyfill": { + "version": "4.0.10", + "resolved": "https://registry.npmjs.org/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz", + "integrity": "sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==", + "dependencies": { + "fetch-blob": "^3.1.2" + }, + "engines": { + "node": ">=12.20.0" + } + }, "node_modules/forwarded": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", @@ -1081,7 +1535,8 @@ "node_modules/make-error": { "version": "1.3.6", "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", - "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==" + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", + "dev": true }, "node_modules/media-typer": { "version": "0.3.0", @@ -1096,6 +1551,15 @@ "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", "integrity": "sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w==" }, + "node_modules/merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, "node_modules/methods": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", @@ -1104,6 +1568,19 @@ "node": ">= 0.6" } }, + "node_modules/micromatch": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", + "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", + "dev": true, + "dependencies": { + "braces": "^3.0.2", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=8.6" + } + }, "node_modules/mime": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", @@ -1170,6 +1647,41 @@ "node": ">= 0.6" } }, + "node_modules/node-domexception": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz", + "integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/jimmywarting" + }, + { + "type": "github", + "url": "https://paypal.me/jimmywarting" + } + ], + "engines": { + "node": ">=10.5.0" + } + }, + "node_modules/node-fetch": { + "version": "3.2.10", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-3.2.10.tgz", + "integrity": "sha512-MhuzNwdURnZ1Cp4XTazr69K0BTizsBroX7Zx3UgDSVcZYKF/6p0CBe4EUb/hLqmzVhl0UpYfgRljQ4yxE+iCxA==", + "dependencies": { + "data-uri-to-buffer": "^4.0.0", + "fetch-blob": "^3.1.4", + "formdata-polyfill": "^4.0.10" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/node-fetch" + } + }, "node_modules/nodemon": { "version": "2.0.19", "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-2.0.19.tgz", @@ -1416,6 +1928,26 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, "node_modules/quick-format-unescaped": { "version": "4.0.4", "resolved": "https://registry.npmjs.org/quick-format-unescaped/-/quick-format-unescaped-4.0.4.tgz", @@ -1507,6 +2039,29 @@ "resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.3.0.tgz", "integrity": "sha512-V2hovdzFbOi77/WajaSMXk2OLm+xNIeQdMMuB7icj7bk6zi2F8GGAxigcnDFpJHbNyNcgyJDiP+8nOrY5cZGrA==" }, + "node_modules/run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "queue-microtask": "^1.2.2" + } + }, "node_modules/safe-buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", @@ -1652,6 +2207,15 @@ "semver": "bin/semver.js" } }, + "node_modules/slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/sonic-boom": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/sonic-boom/-/sonic-boom-3.2.0.tgz", @@ -1660,6 +2224,15 @@ "atomic-sleep": "^1.0.0" } }, + "node_modules/source-map": { + "version": "0.7.4", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.4.tgz", + "integrity": "sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, "node_modules/split2": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/split2/-/split2-4.1.0.tgz", @@ -1748,6 +2321,7 @@ "version": "10.9.1", "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz", "integrity": "sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==", + "dev": true, "dependencies": { "@cspotcode/source-map-support": "^0.8.0", "@tsconfig/node10": "^1.0.7", @@ -1786,11 +2360,6 @@ } } }, - "node_modules/tslib": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz", - "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==" - }, "node_modules/type-is": { "version": "1.6.18", "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", @@ -1807,6 +2376,7 @@ "version": "4.8.2", "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.2.tgz", "integrity": "sha512-C0I1UsrrDHo2fYI5oaCGbSejwX4ch+9Y5jTQELvovfmFkK3HHSZJB8MSJcWLmCUBzQBchCrZ9rMRV6GuNrvGtw==", + "dev": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -1859,7 +2429,8 @@ "node_modules/v8-compile-cache-lib": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", - "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==" + "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", + "dev": true }, "node_modules/vary": { "version": "1.1.2", @@ -1869,6 +2440,14 @@ "node": ">= 0.8" } }, + "node_modules/web-streams-polyfill": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.2.1.tgz", + "integrity": "sha512-e0MO3wdXWKrLbL0DgGnUV7WHVuw9OUvL4hjgnPkIeEvESk74gAITi5G606JtZPp39cd8HA9VQzCIvA49LpPN5Q==", + "engines": { + "node": ">= 8" + } + }, "node_modules/web-worker": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/web-worker/-/web-worker-1.2.0.tgz", @@ -1917,6 +2496,7 @@ "version": "3.1.1", "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", + "dev": true, "engines": { "node": ">=6" } @@ -1927,6 +2507,7 @@ "version": "0.8.1", "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", + "dev": true, "requires": { "@jridgewell/trace-mapping": "0.3.9" } @@ -1986,22 +2567,51 @@ "@jridgewell/resolve-uri": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz", - "integrity": "sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==" + "integrity": "sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==", + "dev": true }, "@jridgewell/sourcemap-codec": { "version": "1.4.14", "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz", - "integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==" + "integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==", + "dev": true }, "@jridgewell/trace-mapping": { "version": "0.3.9", "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", + "dev": true, "requires": { "@jridgewell/resolve-uri": "^3.0.3", "@jridgewell/sourcemap-codec": "^1.4.10" } }, + "@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dev": true, + "requires": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + } + }, + "@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true + }, + "@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, + "requires": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + } + }, "@prisma/client": { "version": "3.15.2", "resolved": "https://registry.npmjs.org/@prisma/client/-/client-3.15.2.tgz", @@ -2021,25 +2631,223 @@ "resolved": "https://registry.npmjs.org/@prisma/engines-version/-/engines-version-3.15.1-1.461d6a05159055555eb7dfb337c9fb271cbd4d7e.tgz", "integrity": "sha512-e3k2Vd606efd1ZYy2NQKkT4C/pn31nehyLhVug6To/q8JT8FpiMrDy7zmm3KLF0L98NOQQcutaVtAPhzKhzn9w==" }, + "@swc/cli": { + "version": "0.1.57", + "resolved": "https://registry.npmjs.org/@swc/cli/-/cli-0.1.57.tgz", + "integrity": "sha512-HxM8TqYHhAg+zp7+RdTU69bnkl4MWdt1ygyp6BDIPjTiaJVH6Dizn2ezbgDS8mnFZI1FyhKvxU/bbaUs8XhzQg==", + "dev": true, + "requires": { + "commander": "^7.1.0", + "fast-glob": "^3.2.5", + "slash": "3.0.0", + "source-map": "^0.7.3" + } + }, + "@swc/core": { + "version": "1.3.9", + "resolved": "https://registry.npmjs.org/@swc/core/-/core-1.3.9.tgz", + "integrity": "sha512-PCRCO9vIoEX3FyS3z/FkWVYJzuspUq0LLaWdK3L30+KQDtH29K+LQdRc2Dzin2MU5MpY4bSHydAwl9M6cmZ9OA==", + "dev": true, + "requires": { + "@swc/core-android-arm-eabi": "1.3.9", + "@swc/core-android-arm64": "1.3.9", + "@swc/core-darwin-arm64": "1.3.9", + "@swc/core-darwin-x64": "1.3.9", + "@swc/core-freebsd-x64": "1.3.9", + "@swc/core-linux-arm-gnueabihf": "1.3.9", + "@swc/core-linux-arm64-gnu": "1.3.9", + "@swc/core-linux-arm64-musl": "1.3.9", + "@swc/core-linux-x64-gnu": "1.3.9", + "@swc/core-linux-x64-musl": "1.3.9", + "@swc/core-win32-arm64-msvc": "1.3.9", + "@swc/core-win32-ia32-msvc": "1.3.9", + "@swc/core-win32-x64-msvc": "1.3.9" + } + }, + "@swc/core-android-arm-eabi": { + "version": "1.3.9", + "resolved": "https://registry.npmjs.org/@swc/core-android-arm-eabi/-/core-android-arm-eabi-1.3.9.tgz", + "integrity": "sha512-+F+sU2l49Po4tJoNtIpFwt0k1sspymvPMM+DCpnkHF1idzRiOU5NGgVzmLDjoO9AnxHa7EBJ3itN+PP2Dd06+A==", + "dev": true, + "optional": true, + "requires": { + "@swc/wasm": "1.2.122" + } + }, + "@swc/core-android-arm64": { + "version": "1.3.9", + "resolved": "https://registry.npmjs.org/@swc/core-android-arm64/-/core-android-arm64-1.3.9.tgz", + "integrity": "sha512-HSWdex3yd4CRefkM2WVz0nTKjpirNZnwSlghqe4ct9QAYGMiiPesYgWPAnq/PpnYfmjQse4yvEclamGiek6zDA==", + "dev": true, + "optional": true, + "requires": { + "@swc/wasm": "1.2.130" + }, + "dependencies": { + "@swc/wasm": { + "version": "1.2.130", + "resolved": "https://registry.npmjs.org/@swc/wasm/-/wasm-1.2.130.tgz", + "integrity": "sha512-rNcJsBxS70+pv8YUWwf5fRlWX6JoY/HJc25HD/F8m6Kv7XhJdqPPMhyX6TKkUBPAG7TWlZYoxa+rHAjPy4Cj3Q==", + "dev": true, + "optional": true + } + } + }, + "@swc/core-darwin-arm64": { + "version": "1.3.9", + "resolved": "https://registry.npmjs.org/@swc/core-darwin-arm64/-/core-darwin-arm64-1.3.9.tgz", + "integrity": "sha512-E7WJY1LsMJtOtUYc/JXl8qlt6USnzodWmdO1eAAOSAODEdX9AjgG3fRT94o3UcmvMrto7sxBXVExj8wG7Cxeng==", + "dev": true, + "optional": true + }, + "@swc/core-darwin-x64": { + "version": "1.3.9", + "resolved": "https://registry.npmjs.org/@swc/core-darwin-x64/-/core-darwin-x64-1.3.9.tgz", + "integrity": "sha512-0+dFCAcLEBxwIO+0Nt+OT8mjPpvBMBWIuFWB1DNiUu2K73+OB0i+llzsCJFoasISHR+YJD0bGyv+8AtVuUdFAw==", + "dev": true, + "optional": true + }, + "@swc/core-freebsd-x64": { + "version": "1.3.9", + "resolved": "https://registry.npmjs.org/@swc/core-freebsd-x64/-/core-freebsd-x64-1.3.9.tgz", + "integrity": "sha512-JbHIeklQPRBEZUfKAKt/IB/ayi7dJZ9tEGu/fDxNfk8Znu1Md+YOKRyN5FPMXfYrL5yFUXnlFOb2LX6wjNhhjQ==", + "dev": true, + "optional": true, + "requires": { + "@swc/wasm": "1.2.130" + }, + "dependencies": { + "@swc/wasm": { + "version": "1.2.130", + "resolved": "https://registry.npmjs.org/@swc/wasm/-/wasm-1.2.130.tgz", + "integrity": "sha512-rNcJsBxS70+pv8YUWwf5fRlWX6JoY/HJc25HD/F8m6Kv7XhJdqPPMhyX6TKkUBPAG7TWlZYoxa+rHAjPy4Cj3Q==", + "dev": true, + "optional": true + } + } + }, + "@swc/core-linux-arm-gnueabihf": { + "version": "1.3.9", + "resolved": "https://registry.npmjs.org/@swc/core-linux-arm-gnueabihf/-/core-linux-arm-gnueabihf-1.3.9.tgz", + "integrity": "sha512-Yc1G8FGXmq6yGKtu5wYCcvVWBtqU0/3FUk6zJM+7pFiivKsVHJcgWrkgLO1u6h7bgEdQIYwfM3/BbRNE5CtdnA==", + "dev": true, + "optional": true, + "requires": { + "@swc/wasm": "1.2.130" + }, + "dependencies": { + "@swc/wasm": { + "version": "1.2.130", + "resolved": "https://registry.npmjs.org/@swc/wasm/-/wasm-1.2.130.tgz", + "integrity": "sha512-rNcJsBxS70+pv8YUWwf5fRlWX6JoY/HJc25HD/F8m6Kv7XhJdqPPMhyX6TKkUBPAG7TWlZYoxa+rHAjPy4Cj3Q==", + "dev": true, + "optional": true + } + } + }, + "@swc/core-linux-arm64-gnu": { + "version": "1.3.9", + "resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-gnu/-/core-linux-arm64-gnu-1.3.9.tgz", + "integrity": "sha512-PrBjmPIMhoQLCpfaZl2b1cCXnaNPddQB/ssMVqQ6eXChBJfcv14M5BjxtI2ORi4HoEDlsbX+k50sL666M3lnBw==", + "dev": true, + "optional": true + }, + "@swc/core-linux-arm64-musl": { + "version": "1.3.9", + "resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-musl/-/core-linux-arm64-musl-1.3.9.tgz", + "integrity": "sha512-jJT56vt81o2N3O2nXp+MZGM6mbgkNx6lvvRT6yISW29fLM6NHBXmkGcjaWOD9VFJDRmu/MtFxbElPxr6ikrFYQ==", + "dev": true, + "optional": true + }, + "@swc/core-linux-x64-gnu": { + "version": "1.3.9", + "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.3.9.tgz", + "integrity": "sha512-60ZreTvrJk3N7xvPzQeQJDePsXUmSUZkKD6lc0xzug4bv53NyUIQ8gH8nzVsV++D9NZeVxXp6WqqFLcgt7yEDQ==", + "dev": true, + "optional": true + }, + "@swc/core-linux-x64-musl": { + "version": "1.3.9", + "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.3.9.tgz", + "integrity": "sha512-UBApPfUSP+w6ye6V1oT4EGh3LFCFrZaQsC1CkTuiYXXSmQMzkYE0Jzegn3R7MHWCJSneRwXRTKrkdhrNBUqWKA==", + "dev": true, + "optional": true + }, + "@swc/core-win32-arm64-msvc": { + "version": "1.3.9", + "resolved": "https://registry.npmjs.org/@swc/core-win32-arm64-msvc/-/core-win32-arm64-msvc-1.3.9.tgz", + "integrity": "sha512-4FQSalXbbnqTLVGRljRnw/bJ99Jwj1WnXz/aJM/SVL8S9Zbc82+3v+wXL/9NGwaAndu2QUkb2KPYNAHvB7PCdw==", + "dev": true, + "optional": true, + "requires": { + "@swc/wasm": "1.2.130" + }, + "dependencies": { + "@swc/wasm": { + "version": "1.2.130", + "resolved": "https://registry.npmjs.org/@swc/wasm/-/wasm-1.2.130.tgz", + "integrity": "sha512-rNcJsBxS70+pv8YUWwf5fRlWX6JoY/HJc25HD/F8m6Kv7XhJdqPPMhyX6TKkUBPAG7TWlZYoxa+rHAjPy4Cj3Q==", + "dev": true, + "optional": true + } + } + }, + "@swc/core-win32-ia32-msvc": { + "version": "1.3.9", + "resolved": "https://registry.npmjs.org/@swc/core-win32-ia32-msvc/-/core-win32-ia32-msvc-1.3.9.tgz", + "integrity": "sha512-ZkTw1Cm+b2QBf/NjkJJbocvgT0NWdfPQL0OyMkuTAinRzfrMmq/lmshjnqj3ysFVeI4uuJTNemiT6mivpLmuBw==", + "dev": true, + "optional": true, + "requires": { + "@swc/wasm": "1.2.130" + }, + "dependencies": { + "@swc/wasm": { + "version": "1.2.130", + "resolved": "https://registry.npmjs.org/@swc/wasm/-/wasm-1.2.130.tgz", + "integrity": "sha512-rNcJsBxS70+pv8YUWwf5fRlWX6JoY/HJc25HD/F8m6Kv7XhJdqPPMhyX6TKkUBPAG7TWlZYoxa+rHAjPy4Cj3Q==", + "dev": true, + "optional": true + } + } + }, + "@swc/core-win32-x64-msvc": { + "version": "1.3.9", + "resolved": "https://registry.npmjs.org/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.3.9.tgz", + "integrity": "sha512-moKi2prCKzYnXXlrLf5nwAN4uGSm4YpsW2xzYiZWJJDRqu74VoUWoDkG25jalHTfN/PSBQg4dkFWhhUe89JJVw==", + "dev": true, + "optional": true + }, + "@swc/wasm": { + "version": "1.2.122", + "resolved": "https://registry.npmjs.org/@swc/wasm/-/wasm-1.2.122.tgz", + "integrity": "sha512-sM1VCWQxmNhFtdxME+8UXNyPNhxNu7zdb6ikWpz0YKAQQFRGT5ThZgJrubEpah335SUToNg8pkdDF7ibVCjxbQ==", + "dev": true, + "optional": true + }, "@tsconfig/node10": { "version": "1.0.9", "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz", - "integrity": "sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==" + "integrity": "sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==", + "dev": true }, "@tsconfig/node12": { "version": "1.0.11", "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", - "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==" + "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==", + "dev": true }, "@tsconfig/node14": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", - "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==" + "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==", + "dev": true }, "@tsconfig/node16": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.3.tgz", - "integrity": "sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ==" + "integrity": "sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ==", + "dev": true }, "@types/body-parser": { "version": "1.19.2", @@ -2092,7 +2900,8 @@ "@types/node": { "version": "17.0.45", "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.45.tgz", - "integrity": "sha512-w+tIMs3rq2afQdsPJlODhoUEKzFP1ayaoyl1CcnwtIlsVe7K7bA1NGm4s3PraqTLlXnbIN84zuBlxBWo1u9BLw==" + "integrity": "sha512-w+tIMs3rq2afQdsPJlODhoUEKzFP1ayaoyl1CcnwtIlsVe7K7bA1NGm4s3PraqTLlXnbIN84zuBlxBWo1u9BLw==", + "dev": true }, "@types/qs": { "version": "6.9.7", @@ -2156,12 +2965,14 @@ "acorn": { "version": "8.8.0", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.0.tgz", - "integrity": "sha512-QOxyigPVrpZ2GXT+PFyZTl6TtOFc5egxHIP9IlQ+RbupQuX4RkT/Bee4/kQuC02Xkzg84JcT7oLYtDIQxp+v7w==" + "integrity": "sha512-QOxyigPVrpZ2GXT+PFyZTl6TtOFc5egxHIP9IlQ+RbupQuX4RkT/Bee4/kQuC02Xkzg84JcT7oLYtDIQxp+v7w==", + "dev": true }, "acorn-walk": { "version": "8.2.0", "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", - "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==" + "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", + "dev": true }, "ajv": { "version": "8.11.0", @@ -2200,7 +3011,8 @@ "arg": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", - "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==" + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", + "dev": true }, "array-flatten": { "version": "1.1.1", @@ -2344,6 +3156,12 @@ "resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.19.tgz", "integrity": "sha512-3tlv/dIP7FWvj3BsbHrGLJ6l/oKh1O3TcgBqMn+yyCagOxc23fyzDS6HypQbgxWbkpDnf52p1LuR4eWDQ/K9WQ==" }, + "commander": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz", + "integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==", + "dev": true + }, "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", @@ -2376,7 +3194,13 @@ "create-require": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", - "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==" + "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", + "dev": true + }, + "data-uri-to-buffer": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-4.0.0.tgz", + "integrity": "sha512-Vr3mLBA8qWmcuschSLAOogKgQ/Jwxulv3RNE4FXnYWRGujzrRWQI4m12fQqRkwX06C0KanhLr4hK+GydchZsaA==" }, "debug": { "version": "2.6.9", @@ -2399,7 +3223,8 @@ "diff": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", - "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==" + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "dev": true }, "discordeno": { "version": "16.0.1", @@ -2412,6 +3237,11 @@ "ws": "^8.4.0" } }, + "dotenv": { + "version": "16.0.3", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.3.tgz", + "integrity": "sha512-7GO6HghkA5fYG9TYnNxi14/7K9f5occMlp3zXAuSxn7CKCxt9xbNWG7yF8hTCSUchlfWSe3uLmlPfigevRItzQ==" + }, "ee-first": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", @@ -2490,6 +3320,19 @@ "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" }, + "fast-glob": { + "version": "3.2.12", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.12.tgz", + "integrity": "sha512-DVj4CQIYYow0BlaelwK1pHl5n5cRSJfM60UA0zK891sVInoPri2Ekj7+e1CT3/3qxXenpI+nBBmQAcJPJgaj4w==", + "dev": true, + "requires": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.4" + } + }, "fast-json-stringify": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/fast-json-stringify/-/fast-json-stringify-5.1.0.tgz", @@ -2549,6 +3392,15 @@ "reusify": "^1.0.4" } }, + "fetch-blob": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/fetch-blob/-/fetch-blob-3.2.0.tgz", + "integrity": "sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ==", + "requires": { + "node-domexception": "^1.0.0", + "web-streams-polyfill": "^3.0.3" + } + }, "fill-range": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", @@ -2582,6 +3434,14 @@ "safe-regex2": "^2.0.0" } }, + "formdata-polyfill": { + "version": "4.0.10", + "resolved": "https://registry.npmjs.org/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz", + "integrity": "sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==", + "requires": { + "fetch-blob": "^3.1.2" + } + }, "forwarded": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", @@ -2744,7 +3604,8 @@ "make-error": { "version": "1.3.6", "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", - "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==" + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", + "dev": true }, "media-typer": { "version": "0.3.0", @@ -2756,11 +3617,27 @@ "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", "integrity": "sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w==" }, + "merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "dev": true + }, "methods": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==" }, + "micromatch": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", + "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", + "dev": true, + "requires": { + "braces": "^3.0.2", + "picomatch": "^2.3.1" + } + }, "mime": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", @@ -2803,6 +3680,21 @@ "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==" }, + "node-domexception": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz", + "integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==" + }, + "node-fetch": { + "version": "3.2.10", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-3.2.10.tgz", + "integrity": "sha512-MhuzNwdURnZ1Cp4XTazr69K0BTizsBroX7Zx3UgDSVcZYKF/6p0CBe4EUb/hLqmzVhl0UpYfgRljQ4yxE+iCxA==", + "requires": { + "data-uri-to-buffer": "^4.0.0", + "fetch-blob": "^3.1.4", + "formdata-polyfill": "^4.0.10" + } + }, "nodemon": { "version": "2.0.19", "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-2.0.19.tgz", @@ -2978,6 +3870,12 @@ "side-channel": "^1.0.4" } }, + "queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true + }, "quick-format-unescaped": { "version": "4.0.4", "resolved": "https://registry.npmjs.org/quick-format-unescaped/-/quick-format-unescaped-4.0.4.tgz", @@ -3044,6 +3942,15 @@ "resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.3.0.tgz", "integrity": "sha512-V2hovdzFbOi77/WajaSMXk2OLm+xNIeQdMMuB7icj7bk6zi2F8GGAxigcnDFpJHbNyNcgyJDiP+8nOrY5cZGrA==" }, + "run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "requires": { + "queue-microtask": "^1.2.2" + } + }, "safe-buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", @@ -3155,6 +4062,12 @@ } } }, + "slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "dev": true + }, "sonic-boom": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/sonic-boom/-/sonic-boom-3.2.0.tgz", @@ -3163,6 +4076,12 @@ "atomic-sleep": "^1.0.0" } }, + "source-map": { + "version": "0.7.4", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.4.tgz", + "integrity": "sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA==", + "dev": true + }, "split2": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/split2/-/split2-4.1.0.tgz", @@ -3227,6 +4146,7 @@ "version": "10.9.1", "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz", "integrity": "sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==", + "dev": true, "requires": { "@cspotcode/source-map-support": "^0.8.0", "@tsconfig/node10": "^1.0.7", @@ -3243,11 +4163,6 @@ "yn": "3.1.1" } }, - "tslib": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz", - "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==" - }, "type-is": { "version": "1.6.18", "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", @@ -3260,7 +4175,8 @@ "typescript": { "version": "4.8.2", "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.2.tgz", - "integrity": "sha512-C0I1UsrrDHo2fYI5oaCGbSejwX4ch+9Y5jTQELvovfmFkK3HHSZJB8MSJcWLmCUBzQBchCrZ9rMRV6GuNrvGtw==" + "integrity": "sha512-C0I1UsrrDHo2fYI5oaCGbSejwX4ch+9Y5jTQELvovfmFkK3HHSZJB8MSJcWLmCUBzQBchCrZ9rMRV6GuNrvGtw==", + "dev": true }, "undefsafe": { "version": "2.0.5", @@ -3297,13 +4213,19 @@ "v8-compile-cache-lib": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", - "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==" + "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", + "dev": true }, "vary": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==" }, + "web-streams-polyfill": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.2.1.tgz", + "integrity": "sha512-e0MO3wdXWKrLbL0DgGnUV7WHVuw9OUvL4hjgnPkIeEvESk74gAITi5G606JtZPp39cd8HA9VQzCIvA49LpPN5Q==" + }, "web-worker": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/web-worker/-/web-worker-1.2.0.tgz", @@ -3331,7 +4253,8 @@ "yn": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", - "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==" + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", + "dev": true } } } diff --git a/template/bigbot/package.json b/template/bigbot/package.json index a5ad8ed28..219118e4f 100644 --- a/template/bigbot/package.json +++ b/template/bigbot/package.json @@ -2,39 +2,41 @@ "name": "dd-big-bot", "version": "1.0.0", "main": "index.js", + "type": "module", "scripts": { - "dev": "nodemon -e ts --exec 'npm run start'", - "start": "node --no-warnings dist/index.js", "devbg": "npx prisma generate && tsc --watch", "fmt": "prettier -w ./src", - "dg": "ts-node src/gateway/index.ts", - "dr": "ts-node src/rest/index.js", - "db": "ts-node src/bot/index.ts", - "tsc": "tsc", - "tscw": "tsc --watch", - "devr": "node dist/rest/index", - "devg": "node dist/gateway/index", - "devb": "node dist/bot/index" + "devg": "nodemon --ignore ./src/bot/**/* --ignore ./src/rest/**/* --ignore ./dist/**/* -e ts dist/gateway/index.js", + "devr": "nodemon --ignore ./src/bot/**/* --ignore ./src/gateway/**/* --ignore ./dist/**/* -e ts dist/rest/index.js", + "devb": "nodemon --ignore ./src/rest/**/* --ignore ./src/gateway/**/* --ignore ./dist/**/* -e ts dist/bot/index.js", + "type": "tsc --noEmit", + "build": "swc src --out-dir dist", + "startr": "node --experimental-specifier-resolution=node dist/rest/index.js", + "startg": "node --experimental-specifier-resolution=node dist/gateway/index.js", + "startb": "node --experimental-specifier-resolution=node dist/bot/index.js" }, "dependencies": { "@influxdata/influxdb-client": "^1.29.0", "@prisma/client": "^3.15.2", "colorette": "^2.0.19", "discordeno": "^16.0.1", + "dotenv": "^16.0.3", "express": "^4.18.1", "fastify": "^4.8.1", "nanoid": "^4.0.0", - "ts-node": "^10.9.1", - "tslib": "^2.3.1", + "node-fetch": "^3.2.10", "web-worker": "^1.2.0" }, "devDependencies": { + "@swc/cli": "^0.1.57", + "@swc/core": "^1.3.9", "@types/express": "^4.17.13", "@types/node": "^17.0.23", "@types/ws": "^8.5.3", "nodemon": "^2.0.15", "prettier": "2.6.2", "prisma": "^4.2.1", + "ts-node": "^10.9.1", "typescript": "^4.6.3" }, "prettier": { @@ -45,4 +47,4 @@ "semi": true, "printWidth": 120 } -} +} \ No newline at end of file diff --git a/template/bigbot/src/analytics.ts b/template/bigbot/src/analytics.ts index af9dbb8d0..a2018e257 100644 --- a/template/bigbot/src/analytics.ts +++ b/template/bigbot/src/analytics.ts @@ -1,5 +1,9 @@ import { InfluxDB } from "@influxdata/influxdb-client"; -import { INFLUX_BUCKET, INFLUX_ORG, INFLUX_TOKEN, INFLUX_URL } from "./configs.js"; + +const INFLUX_BUCKET = process.env.INFLUX_BUCKET as string +const INFLUX_ORG = process.env.INFLUX_ORG as string +const INFLUX_TOKEN = process.env.INFLUX_TOKEN as string +const INFLUX_URL = process.env.INFLUX_URL as string export const influxDB = INFLUX_URL && INFLUX_TOKEN ? new InfluxDB({ url: INFLUX_URL, token: INFLUX_TOKEN }) : undefined; export const Influx = influxDB?.getWriteApi(INFLUX_ORG, INFLUX_BUCKET); diff --git a/template/bigbot/src/bot/bot.ts b/template/bigbot/src/bot/bot.ts index f32264e9c..f6773f62d 100644 --- a/template/bigbot/src/bot/bot.ts +++ b/template/bigbot/src/bot/bot.ts @@ -1,10 +1,13 @@ import { Bot, Collection, createBot, createRestManager } from "discordeno"; import enableHelpersPlugin from "discordeno/helpers-plugin"; import { createLogger } from "discordeno/logger"; -import { DISCORD_TOKEN, INTENTS, REST_AUTHORIZATION, REST_URL } from "../configs.js"; -import { setupEventHandlers } from "./events/mod.js"; -import { MessageCollector } from "./utils/collectors.js"; -import { customizeInternals } from "./utils/internals/mod.js"; +import { INTENTS, REST_URL } from "../configs"; +import { setupEventHandlers } from "./events/mod"; +import { MessageCollector } from "./utils/collectors"; +import { customizeInternals } from "./utils/internals/mod"; + +const DISCORD_TOKEN = process.env.DISCORD_TOKEN as string +const REST_AUTHORIZATION = process.env.REST_AUTHORIZATION as string export const bot = enableHelpersPlugin( customizeBot( diff --git a/template/bigbot/src/bot/events/interactions/command.ts b/template/bigbot/src/bot/events/interactions/command.ts index 253dd19dd..903579cf1 100644 --- a/template/bigbot/src/bot/events/interactions/command.ts +++ b/template/bigbot/src/bot/events/interactions/command.ts @@ -10,11 +10,12 @@ import { InteractionResponseTypes, Member, Role, - User, + User } from "discordeno"; import { bot, BotWithCustomProps } from "../../bot.js"; import COMMANDS from "../../commands/mod.js"; import { getLanguage, loadLanguage, serverLanguages, translate, translationKeys } from "../../languages/translate.js"; +import { InteractionWithCustomProps } from "../../typings/discordeno.js"; import { Command, ConvertArgumentDefinitionsToArgs } from "../../utils/slash/createCommand.js"; function logCommand( @@ -22,11 +23,10 @@ function logCommand( type: "Failure" | "Success" | "Trigger" | "Slowmode" | "Missing" | "Inhibit", commandName: string, ) { - const command = `[COMMAND: ${bgYellow(black(commandName || "Unknown"))} - ${ - bgBlack( - ["Failure", "Slowmode", "Missing"].includes(type) ? red(type) : type === "Success" ? green(type) : white(type), - ) - }]`; + const command = `[COMMAND: ${bgYellow(black(commandName || "Unknown"))} - ${bgBlack( + ["Failure", "Slowmode", "Missing"].includes(type) ? red(type) : type === "Success" ? green(type) : white(type), + ) + }]`; const user = bgGreen( black(`${info.user.username}#${info.user.discriminator.toString().padStart(4, "0")}(${info.id})`), @@ -36,7 +36,7 @@ function logCommand( bot.logger.info(`${command} by ${user} in ${guild} with MessageID: ${info.id}`); } -export async function executeSlashCommand(bot: BotWithCustomProps, interaction: Interaction) { +export async function executeSlashCommand(bot: BotWithCustomProps, interaction: InteractionWithCustomProps) { const data = interaction.data; const name = data?.name as keyof typeof COMMANDS; @@ -89,7 +89,7 @@ export async function executeSlashCommand(bot: BotWithCustomProps, interaction: } /** Runs the inhibitors to see if a command is allowed to run. */ -export async function commandAllowed(interaction: Interaction, command: Command) { +export async function commandAllowed(interaction: InteractionWithCustomProps, command: Command) { // CHECK WHETHER THE USER/GUILD IS VIP if (command.vipOnly) { // SETUP-DD-TEMP: Check if this server/user is a vip. @@ -149,21 +149,21 @@ function convertOptionValue( option: InteractionDataOption, translateOptions?: Record, ): [ - string, - ( - | { user: User; member: Member } - | Role - | { - id: bigint; - name: string; - type: ChannelTypes; - permissions: bigint; - } - | boolean - | string - | number - ), -] { + string, + ( + | { user: User; member: Member } + | Role + | { + id: bigint; + name: string; + type: ChannelTypes; + permissions: bigint; + } + | boolean + | string + | number + ), + ] { // THE OPTION IS A CHANNEL if (option.type === ApplicationCommandOptionTypes.Channel) { const channel = interaction.data?.resolved?.channels?.get(BigInt(option.value as string)); @@ -269,7 +269,7 @@ export function optionParser( [translateOptions?.[interaction.data.options[0].name] ?? interaction.data.options[0].name]: { [ translateOptions?.[interaction.data.options[0]!.options![0]!.name] ?? - interaction.data.options[0]!.options![0]!.name + interaction.data.options[0]!.options![0]!.name ]: convertedOptions, }, }; diff --git a/template/bigbot/src/bot/events/interactions/mod.ts b/template/bigbot/src/bot/events/interactions/mod.ts index ddda8ee41..dbf0d2521 100644 --- a/template/bigbot/src/bot/events/interactions/mod.ts +++ b/template/bigbot/src/bot/events/interactions/mod.ts @@ -1,5 +1,6 @@ import { InteractionTypes, MessageComponentTypes } from "discordeno"; import { bot } from "../../bot.js"; +import { InteractionWithCustomProps } from "../../typings/discordeno.js"; import { executeButtonClick } from "./button.js"; import { executeSlashCommand } from "./command.js"; import { executeModalSubmit } from "./modal.js"; @@ -7,7 +8,7 @@ import { executeModalSubmit } from "./modal.js"; export function setInteractionCreateEvent() { bot.events.interactionCreate = async function (_, interaction) { if (interaction.type === InteractionTypes.ApplicationCommand) { - await executeSlashCommand(bot, interaction); + await executeSlashCommand(bot, interaction as InteractionWithCustomProps); } else if (interaction.type === InteractionTypes.MessageComponent) { if (!interaction.data) return; diff --git a/template/bigbot/src/bot/events/mod.ts b/template/bigbot/src/bot/events/mod.ts index 625f3736e..5c0062394 100644 --- a/template/bigbot/src/bot/events/mod.ts +++ b/template/bigbot/src/bot/events/mod.ts @@ -1,6 +1,6 @@ -import { setInteractionCreateEvent } from "./interactions/mod.js"; -import { setMessageCreateEvent } from "./messages/create.js"; -import { setRawEvent } from "./raw.js"; +import { setInteractionCreateEvent } from "./interactions/mod"; +import { setMessageCreateEvent } from "./messages/create"; +import { setRawEvent } from "./raw"; export function setupEventHandlers() { setInteractionCreateEvent(); diff --git a/template/bigbot/src/bot/index.ts b/template/bigbot/src/bot/index.ts index c7ad154e0..64acf4266 100644 --- a/template/bigbot/src/bot/index.ts +++ b/template/bigbot/src/bot/index.ts @@ -1,18 +1,20 @@ import { DiscordGatewayPayload } from "discordeno"; -import Embeds from "discordeno/embeds"; +// ReferenceError: publishMessage is not defined +// import Embeds from "discordeno/embeds"; +import dotenv from 'dotenv'; import express from "express"; -import { - BOT_ID, - BUGS_ERRORS_REPORT_WEBHOOK, - DEVELOPMENT, - EVENT_HANDLER_AUTHORIZATION, - EVENT_HANDLER_PORT, - EVENT_HANDLER_URL, -} from "../configs.js"; +import { BOT_ID, EVENT_HANDLER_URL } from "../configs.js"; import { bot } from "./bot.js"; import { updateDevCommands } from "./utils/slash/updateCommands.js"; import { webhookURLToIDAndToken } from "./utils/webhook.js"; +dotenv.config() + +const BUGS_ERRORS_REPORT_WEBHOOK = process.env.BUGS_ERRORS_REPORT_WEBHOOK as string +const DEVELOPMENT = process.env.DEVELOPMENT as string +const EVENT_HANDLER_AUTHORIZATION = process.env.EVENT_HANDLER_AUTHORIZATION as string +const EVENT_HANDLER_PORT = process.env.EVENT_HANDLER_PORT as string + process .on("unhandledRejection", (error) => { const { id, token } = webhookURLToIDAndToken(BUGS_ERRORS_REPORT_WEBHOOK); @@ -28,6 +30,8 @@ process if (!error) return; + // ReferenceError: publishMessage is not defined + /* const embeds = new Embeds() .setDescription(["```js", error, "```"].join(`\n`)) .setTimestamp() @@ -35,6 +39,7 @@ process // SEND ERROR TO THE LOG CHANNEL ON THE DEV SERVER return bot.helpers.sendWebhookMessage(bot.transformers.snowflake(id), token, { embeds }).catch(console.error); + */ }) .on("uncaughtException", async (error) => { const { id, token } = webhookURLToIDAndToken(BUGS_ERRORS_REPORT_WEBHOOK); @@ -50,13 +55,14 @@ process if (!error) process.exit(1); + /* const embeds = new Embeds() .setDescription(["```js", error.stack, "```"].join(`\n`)) .setTimestamp() .setFooter("Unhandled Exception Error Occurred"); - - // SEND ERROR TO THE LOG CHANNEL ON THE DEV SERVER - await bot.helpers.sendWebhookMessage(bot.transformers.snowflake(id), token, { embeds }).catch(console.error); + // SEND ERROR TO THE LOG CHANNEL ON THE DEV SERVER + await bot.helpers.sendWebhookMessage(bot.transformers.snowflake(id), token, { embeds }).catch(console.error); + */ process.exit(1); }); diff --git a/template/bigbot/src/bot/languages/translate.ts b/template/bigbot/src/bot/languages/translate.ts index 2d47dadaf..5c0c8a100 100644 --- a/template/bigbot/src/bot/languages/translate.ts +++ b/template/bigbot/src/bot/languages/translate.ts @@ -1,10 +1,11 @@ import Embeds from "discordeno/embeds"; -import { MISSING_TRANSLATION_WEBHOOK } from "../../configs.js"; import { bot } from "../bot.js"; import { webhookURLToIDAndToken } from "../utils/webhook.js"; import english from "./english.js"; import languages from "./languages.js"; +const MISSING_TRANSLATION_WEBHOOK = process.env.MISSING_TRANSLATION_WEBHOOK as string; + /** This should hold the language names per guild id. */ export const serverLanguages = new Map(); diff --git a/template/bigbot/src/bot/typings/discordeno.ts b/template/bigbot/src/bot/typings/discordeno.ts index 532ca295c..ef559bf80 100644 --- a/template/bigbot/src/bot/typings/discordeno.ts +++ b/template/bigbot/src/bot/typings/discordeno.ts @@ -1,13 +1,10 @@ // This file allows you to tell typescript about any additions you have made to the internal discordeno objects. -import { InteractionResponse, Message } from "discordeno"; +import { Interaction, InteractionResponse, Message } from "discordeno"; -declare module "discordeno" { - // We want to add something to the Interaction object. - interface Interaction { - // Normally, to send a response you would have to do something like bot.helpers.sendInteractionResponse(interaction.id, interaction.token, { type: InteractionResponseTypes.ChannelMessageWithSource, data: { content: "text here" } }) - // But with this reply method we added, it is as simple as interaction.reply("text here"). - // Feel free to delete these comments once you have understood the concept. - /** Send a reply to an interaction. */ - reply(response: InteractionResponse | string): Promise; - } -} +export interface InteractionWithCustomProps extends Interaction { + // Normally, to send a response you would have to do something like bot.helpers.sendInteractionResponse(interaction.id, interaction.token, { type: InteractionResponseTypes.ChannelMessageWithSource, data: { content: "text here" } }) + // But with this reply method we added, it is as simple as interaction.reply("text here"). + // Feel free to delete these comments once you have understood the concept. + /** Send a reply to an interaction. */ + reply(response: InteractionResponse | string): Promise; +} \ No newline at end of file diff --git a/template/bigbot/src/bot/utils/slash/createCommand.ts b/template/bigbot/src/bot/utils/slash/createCommand.ts index 5f5a12cd0..74ec36817 100644 --- a/template/bigbot/src/bot/utils/slash/createCommand.ts +++ b/template/bigbot/src/bot/utils/slash/createCommand.ts @@ -7,10 +7,11 @@ import { Member, PermissionStrings, Role, - User, + User } from "discordeno"; import english from "../../languages/english.js"; import { translationKeys } from "../../languages/translate.js"; +import { InteractionWithCustomProps } from "../../typings/discordeno.js"; import { PermissionLevelHandlers } from "./permLevels.js"; export function createCommand(command: Command) { @@ -156,79 +157,79 @@ export type ConvertArgumentDefinitionsToArgs // STRING - ? { - // @ts-ignore TODO: fix this some day - [_ in getName]?: T[P]["choices"] extends readonly { name: string; value: string }[] // @ts-ignore - ? T[P]["choices"][number]["value"] - : string; - } - : T[P] extends StringArgumentDefinition ? { - // @ts-ignore TODO: fix this some day - [_ in getName]: T[P]["choices"] extends readonly { name: string; value: string }[] // @ts-ignore - ? T[P]["choices"][number]["value"] - : string; - } - // INTEGER - : T[P] extends IntegerOptionalArgumentDefinition ? { - [_ in getName]?: T[P]["choices"] extends readonly { name: string; value: number }[] // @ts-ignore - ? T[P]["choices"][number]["value"] - : number; - } - : T[P] extends IntegerArgumentDefinition ? { - [_ in getName]: T[P]["choices"] extends readonly { name: string; value: number }[] // @ts-ignore - ? T[P]["choices"][number]["value"] - : number; - } - // BOOLEAN - : T[P] extends BooleanOptionalArgumentDefinition ? { [_ in getName]?: boolean } - : T[P] extends BooleanArgumentDefinition ? { [_ in getName]: boolean } - // USER - : T[P] extends UserOptionalArgumentDefinition ? { - [_ in getName]?: { - user: User; - member: Member; - }; - } - : T[P] extends UserArgumentDefinition ? { - [_ in getName]: { - user: User; - member: Member; - }; - } - // CHANNEL - : T[P] extends ChannelOptionalArgumentDefinition ? { [_ in getName]?: Channel } - : T[P] extends ChannelArgumentDefinition ? { [_ in getName]: Channel } - // ROLE - : T[P] extends RoleOptionalArgumentDefinition ? { [_ in getName]?: Role } - : T[P] extends RoleArgumentDefinition ? { [_ in getName]: Role } - // MENTIONABLE - : T[P] extends MentionableOptionalArgumentDefinition ? { - [_ in getName]?: - | Role - | { - user: User; - member: Member; - }; - } - : T[P] extends MentionableArgumentDefinition ? { - [_ in getName]: - | Role - | { - user: User; - member: Member; - }; - } - // SUBCOMMAND - : T[P] extends SubcommandArgumentDefinition ? { - [_ in getName]?: T[P]["options"] extends readonly ArgumentDefinition[] // @ts-ignore somehow this check does not work - ? ConvertArgumentDefinitionsToArgs - : {}; - } - // SUBCOMMANDGROUP - : T[P] extends SubcommandGroupArgumentDefinition ? { - [_ in getName]?: ConvertArgumentDefinitionsToArgs; - } - : never; + ? { + // @ts-ignore TODO: fix this some day + [_ in getName]?: T[P]["choices"] extends readonly { name: string; value: string }[] // @ts-ignore + ? T[P]["choices"][number]["value"] + : string; + } + : T[P] extends StringArgumentDefinition ? { + // @ts-ignore TODO: fix this some day + [_ in getName]: T[P]["choices"] extends readonly { name: string; value: string }[] // @ts-ignore + ? T[P]["choices"][number]["value"] + : string; + } + // INTEGER + : T[P] extends IntegerOptionalArgumentDefinition ? { + [_ in getName]?: T[P]["choices"] extends readonly { name: string; value: number }[] // @ts-ignore + ? T[P]["choices"][number]["value"] + : number; + } + : T[P] extends IntegerArgumentDefinition ? { + [_ in getName]: T[P]["choices"] extends readonly { name: string; value: number }[] // @ts-ignore + ? T[P]["choices"][number]["value"] + : number; + } + // BOOLEAN + : T[P] extends BooleanOptionalArgumentDefinition ? { [_ in getName]?: boolean } + : T[P] extends BooleanArgumentDefinition ? { [_ in getName]: boolean } + // USER + : T[P] extends UserOptionalArgumentDefinition ? { + [_ in getName]?: { + user: User; + member: Member; + }; + } + : T[P] extends UserArgumentDefinition ? { + [_ in getName]: { + user: User; + member: Member; + }; + } + // CHANNEL + : T[P] extends ChannelOptionalArgumentDefinition ? { [_ in getName]?: Channel } + : T[P] extends ChannelArgumentDefinition ? { [_ in getName]: Channel } + // ROLE + : T[P] extends RoleOptionalArgumentDefinition ? { [_ in getName]?: Role } + : T[P] extends RoleArgumentDefinition ? { [_ in getName]: Role } + // MENTIONABLE + : T[P] extends MentionableOptionalArgumentDefinition ? { + [_ in getName]?: + | Role + | { + user: User; + member: Member; + }; + } + : T[P] extends MentionableArgumentDefinition ? { + [_ in getName]: + | Role + | { + user: User; + member: Member; + }; + } + // SUBCOMMAND + : T[P] extends SubcommandArgumentDefinition ? { + [_ in getName]?: T[P]["options"] extends readonly ArgumentDefinition[] // @ts-ignore somehow this check does not work + ? ConvertArgumentDefinitionsToArgs + : {}; + } + // SUBCOMMANDGROUP + : T[P] extends SubcommandGroupArgumentDefinition ? { + [_ in getName]?: ConvertArgumentDefinitionsToArgs; + } + : never; }[number] > >; @@ -244,7 +245,7 @@ export interface Command { /** The options for the command, used for both slash and message commands. */ // options?: ApplicationCommandOption[]; options?: T; - execute: (bot: Bot, data: Interaction, args: ConvertArgumentDefinitionsToArgs) => unknown; + execute: (bot: Bot, data: InteractionWithCustomProps, args: ConvertArgumentDefinitionsToArgs) => unknown; subcommands?: Record, "subcommands"> & { group?: string }>; /** Whether the command should have a cooldown */ cooldown?: { @@ -272,8 +273,8 @@ export interface Command { acknowledge?: boolean; permissionLevels?: - | (keyof typeof PermissionLevelHandlers)[] - | ((data: Interaction, command: Command) => boolean | Promise); + | (keyof typeof PermissionLevelHandlers)[] + | ((data: Interaction, command: Command) => boolean | Promise); botServerPermissions?: PermissionStrings[]; botChannelPermissions?: PermissionStrings[]; userServerPermissions?: PermissionStrings[]; diff --git a/template/bigbot/src/bot/utils/slash/updateCommands.ts b/template/bigbot/src/bot/utils/slash/updateCommands.ts index 9e59c3976..6a157f602 100644 --- a/template/bigbot/src/bot/utils/slash/updateCommands.ts +++ b/template/bigbot/src/bot/utils/slash/updateCommands.ts @@ -1,11 +1,12 @@ import { ApplicationCommandOption, ApplicationCommandTypes, Bot } from "discordeno"; -import { DEV_SERVER_ID } from "../../../configs.js"; import { prisma } from "../../../prisma.js"; import { bot } from "../../bot.js"; import COMMANDS from "../../commands/mod.js"; import { serverLanguages, translate } from "../../languages/translate.js"; import { ArgumentDefinition } from "./createCommand.js"; +const DEV_SERVER_ID = process.env.DEV_SERVER_ID as string; + export async function updateDevCommands(bot: Bot) { const cmds = Object.entries(COMMANDS) // ONLY DEV COMMANDS diff --git a/template/bigbot/src/configs.ts b/template/bigbot/src/configs.ts index c646b8035..d96ac073f 100644 --- a/template/bigbot/src/configs.ts +++ b/template/bigbot/src/configs.ts @@ -1,54 +1,12 @@ import { getBotIdFromToken, Intents } from "discordeno"; - -// General Configurations -/** Whether or not this process is a local development version. Change to false for the main production bot. */ -// SETUP-DD-TEMP: Change this to false in your server for production bot. Keep true in local testing. -export const DEVELOPMENT = true; - -/** The server id where you develop/test the bot. */ -// SETUP-DD-TEMP: Change the id to a server where you develop the bot privately. -export const DEV_SERVER_ID: string = ""; - -/** The discord bot token, without the BOT prefix. */ -// SETUP-DD-TEMP: Add the bot token here. -export const DISCORD_TOKEN = ""; +import dotenv from 'dotenv'; +dotenv.config() /** The bot id, derived from the bot token. */ -export const BOT_ID = getBotIdFromToken(DISCORD_TOKEN); - -// Bot Configurations -/** The secret passcode that the bot code (event handler) is listening for. This is used to prevent someone else from trying to send malicious messages to your bot. */ -// SETUP-DD-TEMP: Add a secret passcode here. -export const EVENT_HANDLER_AUTHORIZATION = ""; - -/** The port where the event handler is listening for events. */ -// SETUP-DD-TEMP: Set the desired port where events will be sent to be processed. -export const EVENT_HANDLER_PORT = 8081; - -/** The url where the bot code(event handler) will run. This is where the gateway will send its messages to. */ -// SETUP-DD-TEMP: Set the bot's url here. -export const EVENT_HANDLER_URL = `http://localhost:${EVENT_HANDLER_PORT}`; - -/** The full webhook url where the bot can send errors to alert you that the bot is missing translations. */ -// SETUP-DD-TEMP: Set a full discord webhook url here. -export const MISSING_TRANSLATION_WEBHOOK = ""; - -/** The full webhook url where the bot can send errors to alert you that the bot is throwing errors. */ -// SETUP-DD-TEMP: Set a full discord webhook url here. -export const BUGS_ERRORS_REPORT_WEBHOOK = ""; - -// Rest Proxy Configurations -/** The authorization code that the REST proxy will check for to make sure the requests are coming from you. */ -// SETUP-DD-TEMP: Add a secret passcode here. -export const REST_AUTHORIZATION = ""; - -/** The port that will run the REST proxy. */ -// SETUP-DD-TEMP: Choose the port number here that will be used for the REST proxy. -export const REST_PORT = 8000; - -/** The url where requests will be sent to from the bot. */ -// SETUP-DD-TEMP: Provide the url where you will host your REST proxy. If it is on the same server as others, you can use localhost but if it is on a separate server you should change this entirely. -export const REST_URL = `http://localhost:${REST_PORT}`; +export const BOT_ID = getBotIdFromToken(process.env.DISCORD_TOKEN as string); +export const EVENT_HANDLER_URL = `http://${process.env.EVENT_HANDLER_HOST}:${process.env.EVENT_HANDLER_PORT}`; +export const REST_URL = `http://${process.env.REST_HOST}:${process.env.REST_PORT}`; +export const GATEWAY_URL = `http://${process.env.GATEWAY_HOST}:${process.env.GATEWAY_PORT}`; // Gateway Proxy Configurations /** The gateway intents you would like to use. */ @@ -69,40 +27,3 @@ export const INTENTS: Intents = Intents.GuildVoiceStates | Intents.GuildWebhooks | Intents.Guilds; - -/** The amount of shards to start. Useful with multiple servers where each server is handling a portion of your bot. */ -// SETUP-DD-TEMP: To start all bots, leave it as undefined. Specify he number of shards this process should handle. -export const TOTAL_SHARDS: number | undefined = undefined; - -/** The amount of shards to start per worker. */ -// SETUP-DD-TEMP: Choose how many shards to start per worker. If you are not sure just stick to 16. -export const SHARDS_PER_WORKER: number = 16; - -/** The total amount of workers to start. Generally this should be equal to the number of cores your server has. */ -// SETUP-DD-TEMP: Choose how many workers to start up. If you are not sure, check how many cores your server has. -export const TOTAL_WORKERS: number = 4; - -/** The secret passcode that the gateway is listening for. This is used to prevent someone else from trying to send malicious messages to your bot. */ -// SETUP-DD-TEMP: Add a secret passcode here. -export const GATEWAY_AUTHORIZATION = ""; - -/** The host where the gateway will run. Must follow https://nodejs.org/api/net.html#serverlistenoptions-callback. */ -// SETUP-DD-TEMP: Set the gateways's host here. -export const GATEWAY_HOST = "localhost"; - -/** The port where the gateway will run. This is where the bot will send its messages to the gateway. */ -// SETUP-DD-TEMP: Set the gateways's port here. -export const GATEWAY_PORT: number = 8080; - -/** The url where the gateway will run. This is where the bot will send its messages to the gateway. */ -// SETUP-DD-TEMP: Set the gateways's url here. -export const GATEWAY_URL = `${GATEWAY_HOST}:${GATEWAY_PORT}`; - -// Database Configurations - -/** These INFLUX configs are only if you wish to enable analytics. */ -// SETUP-DD-TEMP: This is optional. If you want to build analytics, add influxdb here. -export const INFLUX_BUCKET = ""; -export const INFLUX_ORG = ""; -export const INFLUX_TOKEN = ""; -export const INFLUX_URL = ""; diff --git a/template/bigbot/src/gateway/index.ts b/template/bigbot/src/gateway/index.ts index 7cf1932e4..956aba051 100644 --- a/template/bigbot/src/gateway/index.ts +++ b/template/bigbot/src/gateway/index.ts @@ -3,21 +3,21 @@ import { createLogger } from "discordeno/logger"; import fastify from "fastify"; import { nanoid } from "nanoid"; import { Worker } from "worker_threads"; -import { - DISCORD_TOKEN, - EVENT_HANDLER_AUTHORIZATION, - EVENT_HANDLER_URL, - GATEWAY_AUTHORIZATION, - GATEWAY_HOST, - GATEWAY_PORT, - INTENTS, - REST_AUTHORIZATION, - REST_URL, - SHARDS_PER_WORKER, - TOTAL_SHARDS, - TOTAL_WORKERS, -} from "../configs.js"; -import { WorkerCreateData, WorkerGetShardInfo, WorkerMessage, WorkerShardInfo, WorkerShardPayload } from "./worker.js"; +import { EVENT_HANDLER_URL, INTENTS, REST_URL } from "../configs.js"; +import { WorkerCreateData, WorkerGetShardInfo, WorkerMessage, WorkerShardInfo, WorkerShardPayload } from "./worker"; + +import dotenv from "dotenv"; +dotenv.config() + +const DISCORD_TOKEN = process.env.DISCORD_TOKEN as string +const EVENT_HANDLER_AUTHORIZATION = process.env.EVENT_HANDLER_AUTHORIZATION as string +const GATEWAY_AUTHORIZATION = process.env.GATEWAY_AUTHORIZATION as string +const GATEWAY_HOST = process.env.GATEWAY_HOST as string +const GATEWAY_PORT = Number(process.env.GATEWAY_PORT as string) +const REST_AUTHORIZATION = process.env.REST_AUTHORIZATION as string +const SHARDS_PER_WORKER = Number(process.env.SHARDS_PER_WORKER as string) +const TOTAL_SHARDS = process.env.TOTAL_SHARDS ? Number(process.env.TOTAL_SHARDS) : undefined +const TOTAL_WORKERS = Number(process.env.TOTAL_WORKERS as string) async function main() { const log = createLogger({ name: "[MANAGER]" }); @@ -45,7 +45,7 @@ async function main() { shardsPerWorker: SHARDS_PER_WORKER, totalWorkers: TOTAL_WORKERS, - handleDiscordPayload: () => {}, + handleDiscordPayload: () => { }, tellWorkerToIdentify: async (_gateway, workerId, shardId, _bucketId) => { log.info("TELL TO IDENTIFY", { workerId, shardId, _bucketId }); @@ -81,7 +81,7 @@ async function main() { workerId, }; - const worker = new Worker("./worker.js", { + const worker = new Worker("./dist/gateway/worker.js", { workerData, }); diff --git a/template/bigbot/src/gateway/worker.ts b/template/bigbot/src/gateway/worker.ts index a65f0cf74..ab362f3f8 100644 --- a/template/bigbot/src/gateway/worker.ts +++ b/template/bigbot/src/gateway/worker.ts @@ -6,11 +6,12 @@ import { GatewayEventNames, Shard, ShardSocketRequest, - ShardState, + ShardState } from "discordeno"; import { createLogger } from "discordeno/logger"; +import fetch from "node-fetch"; import { parentPort, workerData } from "worker_threads"; -import { ManagerMessage } from "./index.js"; +import { ManagerMessage } from "./index"; if (!parentPort) { throw new Error("Parent port is null"); diff --git a/template/bigbot/src/rest/index.ts b/template/bigbot/src/rest/index.ts index ef2e8f44f..661055c81 100644 --- a/template/bigbot/src/rest/index.ts +++ b/template/bigbot/src/rest/index.ts @@ -1,9 +1,15 @@ import { Point } from "@influxdata/influxdb-client"; import { BASE_URL, createRestManager } from "discordeno"; import express, { Request, Response } from "express"; +import { Influx } from "../analytics"; +import { REST_URL } from '../configs'; -import { Influx } from "../analytics.js"; -import { DISCORD_TOKEN, REST_AUTHORIZATION, REST_PORT, REST_URL } from "../configs.js"; +import dotenv from "dotenv"; +dotenv.config() + +const DISCORD_TOKEN = process.env.DISCORD_TOKEN as string +const REST_AUTHORIZATION = process.env.REST_AUTHORIZATION as string +const REST_PORT = process.env.REST_PORT as string const rest = createRestManager({ token: DISCORD_TOKEN, @@ -55,6 +61,7 @@ if (Influx) { }, 30000); } +//@ts-ignore rest.convertRestError = (errorStack, data) => { if (!data) return { message: errorStack.message }; return { ...data, message: errorStack.message }; diff --git a/template/bigbot/tsconfig.json b/template/bigbot/tsconfig.json index 3f343f71c..58aaaa9b2 100644 --- a/template/bigbot/tsconfig.json +++ b/template/bigbot/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { "target": "es2020", - "module": "CommonJS", + "module": "es2020", "experimentalDecorators": true, "emitDecoratorMetadata": true, "outDir": "./dist", @@ -10,7 +10,6 @@ "importHelpers": true, "allowUnusedLabels": false, "noImplicitOverride": true, - "noPropertyAccessFromIndexSignature": true, "noUnusedLocals": true, "noUnusedParameters": true, "noUncheckedIndexedAccess": true, @@ -20,7 +19,15 @@ "useUnknownInCatchVariables": false, "allowUnreachableCode": false, "skipLibCheck": true, - "moduleResolution": "node" + "moduleResolution": "node", }, - "include": ["./src/**/*", ".env"] -} + "include": [ + "./src/**/*", + ".env" + ], + "ts-node": { + "esm": true, + "experimentalSpecifierResolution": "node", + "swc": true + } +} \ No newline at end of file