diff --git a/.env.sample b/.env.sample index c40eeaa..bf3df0f 100644 --- a/.env.sample +++ b/.env.sample @@ -2,9 +2,6 @@ BOT_TOKEN = #used for adding bot/application to server CLIENT_ID = -# invite link: -# https://discord.com/api/oauth2/authorize?CLIENT_ID=&permissions=0&scope=bot%20applications.commands -SERVER_ID = # Mongo configuration MONGO_URI= MONGO_PORT= diff --git a/CHANGELOG.md b/CHANGELOG.md index a50bca0..4042907 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,33 @@ # Changelog +## [1.9.3](https://github.com/BingusBoingus-Developer-Team/BingusBoingus/compare/v1.9.2...v1.9.3) (2024-09-11) + + +### Bug Fixes + +* comment on workaround fix to rework later ([b27a4eb](https://github.com/BingusBoingus-Developer-Team/BingusBoingus/commit/b27a4eb25b165e72e8aece70955299d2a69191a2)) + +## [1.9.2](https://github.com/BingusBoingus-Developer-Team/BingusBoingus/compare/v1.9.1...v1.9.2) (2024-07-31) + + +### Bug Fixes + +* correct messageEvent.ts regex ([8a97383](https://github.com/BingusBoingus-Developer-Team/BingusBoingus/commit/8a9738354105e2c4bb616db3fa2dacd7ab636381)) + +## [1.9.1](https://github.com/BingusBoingus-Developer-Team/BingusBoingus/compare/v1.9.0...v1.9.1) (2024-07-23) + + +### Bug Fixes + +* hotfix caching error ([9842f19](https://github.com/BingusBoingus-Developer-Team/BingusBoingus/commit/9842f19b69ba60cb092a208b21841efe63fdb446)) + +## [1.9.0](https://github.com/BingusBoingus-Developer-Team/BingusBoingus/compare/v1.8.3...v1.9.0) (2024-07-23) + + +### Features + +* role decorator for specifying command access levels ([ac17653](https://github.com/BingusBoingus-Developer-Team/BingusBoingus/commit/ac1765396f6c2d64566ba36e939a986ce8e28b42)) + ## [1.8.3](https://github.com/BingusBoingus-Developer-Team/BingusBoingus/compare/v1.8.2...v1.8.3) (2024-05-09) diff --git a/package-lock.json b/package-lock.json index 184bf9e..7605d6e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,20 +1,20 @@ { "name": "bingusboingus", - "version": "1.8.3", + "version": "1.9.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "bingusboingus", - "version": "1.8.3", + "version": "1.9.3", "license": "MIT", "dependencies": { - "@nestjs/cli": "^10.3.2", + "@nestjs/cli": "^10.4.5", "@nestjs/common": "^10.2.10", "@nestjs/config": "^3.1.1", "@nestjs/core": "^10.2.6", "@nestjs/mongoose": "^10.0.2", - "@nestjs/platform-express": "^10.2.6", + "@nestjs/platform-express": "^10.4.5", "@nestjs/swagger": "^7.3.1", "@nestjs/testing": "^10.2.6", "@types/jest": "^29.5.5", @@ -23,7 +23,7 @@ "discord-interactions": "^3.4.0", "discord.js": "^14.15.2", "dotenv": "^16.3.1", - "express": "^4.19.2", + "express": "^4.21.1", "jest": "^29.7.0", "joi": "^17.10.2", "mongoose": "^8.0.1", @@ -102,14 +102,14 @@ } }, "node_modules/@angular-devkit/schematics-cli": { - "version": "17.1.2", - "resolved": "https://registry.npmjs.org/@angular-devkit/schematics-cli/-/schematics-cli-17.1.2.tgz", - "integrity": "sha512-bvXykYzSST05qFdlgIzUguNOb3z0hCa8HaTwtqdmQo9aFPf+P+/AC56I64t1iTchMjQtf3JrBQhYM25gUdcGbg==", + "version": "17.3.8", + "resolved": "https://registry.npmjs.org/@angular-devkit/schematics-cli/-/schematics-cli-17.3.8.tgz", + "integrity": "sha512-TjmiwWJarX7oqvNiRAroQ5/LeKUatxBOCNEuKXO/PV8e7pn/Hr/BqfFm+UcYrQoFdZplmtNAfqmbqgVziKvCpA==", "dependencies": { - "@angular-devkit/core": "17.1.2", - "@angular-devkit/schematics": "17.1.2", + "@angular-devkit/core": "17.3.8", + "@angular-devkit/schematics": "17.3.8", "ansi-colors": "4.1.3", - "inquirer": "9.2.12", + "inquirer": "9.2.15", "symbol-observable": "4.0.0", "yargs-parser": "21.1.1" }, @@ -122,6 +122,49 @@ "yarn": ">= 1.13.0" } }, + "node_modules/@angular-devkit/schematics-cli/node_modules/@angular-devkit/core": { + "version": "17.3.8", + "resolved": "https://registry.npmjs.org/@angular-devkit/core/-/core-17.3.8.tgz", + "integrity": "sha512-Q8q0voCGudbdCgJ7lXdnyaxKHbNQBARH68zPQV72WT8NWy+Gw/tys870i6L58NWbBaCJEUcIj/kb6KoakSRu+Q==", + "dependencies": { + "ajv": "8.12.0", + "ajv-formats": "2.1.1", + "jsonc-parser": "3.2.1", + "picomatch": "4.0.1", + "rxjs": "7.8.1", + "source-map": "0.7.4" + }, + "engines": { + "node": "^18.13.0 || >=20.9.0", + "npm": "^6.11.0 || ^7.5.6 || >=8.0.0", + "yarn": ">= 1.13.0" + }, + "peerDependencies": { + "chokidar": "^3.5.2" + }, + "peerDependenciesMeta": { + "chokidar": { + "optional": true + } + } + }, + "node_modules/@angular-devkit/schematics-cli/node_modules/@angular-devkit/schematics": { + "version": "17.3.8", + "resolved": "https://registry.npmjs.org/@angular-devkit/schematics/-/schematics-17.3.8.tgz", + "integrity": "sha512-QRVEYpIfgkprNHc916JlPuNbLzOgrm9DZalHasnLUz4P6g7pR21olb8YCyM2OTJjombNhya9ZpckcADU5Qyvlg==", + "dependencies": { + "@angular-devkit/core": "17.3.8", + "jsonc-parser": "3.2.1", + "magic-string": "0.30.8", + "ora": "5.4.1", + "rxjs": "7.8.1" + }, + "engines": { + "node": "^18.13.0 || >=20.9.0", + "npm": "^6.11.0 || ^7.5.6 || >=8.0.0", + "yarn": ">= 1.13.0" + } + }, "node_modules/@angular-devkit/schematics-cli/node_modules/chalk": { "version": "5.3.0", "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.3.0.tgz", @@ -141,44 +184,18 @@ "node": ">= 12" } }, - "node_modules/@angular-devkit/schematics-cli/node_modules/escape-string-regexp": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-5.0.0.tgz", - "integrity": "sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@angular-devkit/schematics-cli/node_modules/figures": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/figures/-/figures-5.0.0.tgz", - "integrity": "sha512-ej8ksPF4x6e5wvK9yevct0UCXh8TTFlWGVLlgjZuoBH1HwjIfKE/IdL5mq89sFA7zELi1VhKpmtDnrs7zWyeyg==", - "dependencies": { - "escape-string-regexp": "^5.0.0", - "is-unicode-supported": "^1.2.0" - }, - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/@angular-devkit/schematics-cli/node_modules/inquirer": { - "version": "9.2.12", - "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-9.2.12.tgz", - "integrity": "sha512-mg3Fh9g2zfuVWJn6lhST0O7x4n03k7G8Tx5nvikJkbq8/CK47WDVm+UznF0G6s5Zi0KcyUisr6DU8T67N5U+1Q==", + "version": "9.2.15", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-9.2.15.tgz", + "integrity": "sha512-vI2w4zl/mDluHt9YEQ/543VTCwPKWiHzKtm9dM2V0NdFcqEexDAjUHzO1oA60HRNaVifGXXM1tRRNluLVHa0Kg==", "dependencies": { - "@ljharb/through": "^2.3.11", + "@ljharb/through": "^2.3.12", "ansi-escapes": "^4.3.2", "chalk": "^5.3.0", "cli-cursor": "^3.1.0", "cli-width": "^4.1.0", "external-editor": "^3.1.0", - "figures": "^5.0.0", + "figures": "^3.2.0", "lodash": "^4.17.21", "mute-stream": "1.0.0", "ora": "^5.4.1", @@ -189,18 +206,23 @@ "wrap-ansi": "^6.2.0" }, "engines": { - "node": ">=14.18.0" + "node": ">=18" } }, - "node_modules/@angular-devkit/schematics-cli/node_modules/is-unicode-supported": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-1.3.0.tgz", - "integrity": "sha512-43r2mRvz+8JRIKnWJ+3j8JtjRKZ6GmjzfaE/qiBJnikNnYv/6bagRJ1kUhNk8R5EX/GkobD+r+sfxCPJsiKBLQ==", + "node_modules/@angular-devkit/schematics-cli/node_modules/jsonc-parser": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.2.1.tgz", + "integrity": "sha512-AilxAyFOAcK5wA1+LeaySVBrHsGQvUFCDWXKpZjzaL0PqW+xfBOttn8GNtWKFWqneyMZj41MWF9Kl6iPWLwgOA==" + }, + "node_modules/@angular-devkit/schematics-cli/node_modules/magic-string": { + "version": "0.30.8", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.8.tgz", + "integrity": "sha512-ISQTe55T2ao7XtlAStud6qwYPZjE4GK1S/BeVPus4jrq6JuOnQ00YKQC581RWhR122W7msZV263KzVeLoqidyQ==", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.4.15" + }, "engines": { "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/@angular-devkit/schematics-cli/node_modules/mute-stream": { @@ -211,6 +233,17 @@ "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, + "node_modules/@angular-devkit/schematics-cli/node_modules/picomatch": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.1.tgz", + "integrity": "sha512-xUXwsxNjwTQ8K3GnT4pCJm+xq3RUPQbmkYJTP5aFIfNIvbcc/4MUxgBaaRSZJ6yGJZiGSyYlM6MzwTsRk8SYCg==", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, "node_modules/@angular-devkit/schematics-cli/node_modules/run-async": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/run-async/-/run-async-3.0.0.tgz", @@ -1694,31 +1727,28 @@ } }, "node_modules/@nestjs/cli": { - "version": "10.3.2", - "resolved": "https://registry.npmjs.org/@nestjs/cli/-/cli-10.3.2.tgz", - "integrity": "sha512-aWmD1GLluWrbuC4a1Iz/XBk5p74Uj6nIVZj6Ov03JbTfgtWqGFLtXuMetvzMiHxfrHehx/myt2iKAPRhKdZvTg==", + "version": "10.4.5", + "resolved": "https://registry.npmjs.org/@nestjs/cli/-/cli-10.4.5.tgz", + "integrity": "sha512-FP7Rh13u8aJbHe+zZ7hM0CC4785g9Pw4lz4r2TTgRtf0zTxSWMkJaPEwyjX8SK9oWK2GsYxl+fKpwVZNbmnj9A==", "dependencies": { - "@angular-devkit/core": "17.1.2", - "@angular-devkit/schematics": "17.1.2", - "@angular-devkit/schematics-cli": "17.1.2", + "@angular-devkit/core": "17.3.8", + "@angular-devkit/schematics": "17.3.8", + "@angular-devkit/schematics-cli": "17.3.8", "@nestjs/schematics": "^10.0.1", "chalk": "4.1.2", "chokidar": "3.6.0", - "cli-table3": "0.6.3", + "cli-table3": "0.6.5", "commander": "4.1.1", "fork-ts-checker-webpack-plugin": "9.0.2", - "glob": "10.3.10", + "glob": "10.4.2", "inquirer": "8.2.6", "node-emoji": "1.11.0", "ora": "5.4.1", - "rimraf": "4.4.1", - "shelljs": "0.8.5", - "source-map-support": "0.5.21", "tree-kill": "1.2.2", "tsconfig-paths": "4.2.0", "tsconfig-paths-webpack-plugin": "4.1.0", "typescript": "5.3.3", - "webpack": "5.90.1", + "webpack": "5.94.0", "webpack-node-externals": "3.0.0" }, "bin": { @@ -1728,7 +1758,7 @@ "node": ">= 16.14" }, "peerDependencies": { - "@swc/cli": "^0.1.62 || ^0.3.0", + "@swc/cli": "^0.1.62 || ^0.3.0 || ^0.4.0", "@swc/core": "^1.3.62" }, "peerDependenciesMeta": { @@ -1740,68 +1770,74 @@ } } }, - "node_modules/@nestjs/cli/node_modules/brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "dependencies": { - "balanced-match": "^1.0.0" - } - }, - "node_modules/@nestjs/cli/node_modules/minimatch": { - "version": "8.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-8.0.4.tgz", - "integrity": "sha512-W0Wvr9HyFXZRGIDgCicunpQ299OKXs9RgZfaukz4qAW/pJhcpUfupc9c+OObPOFueNy8VSrZgEmDtk6Kh4WzDA==", + "node_modules/@nestjs/cli/node_modules/@angular-devkit/core": { + "version": "17.3.8", + "resolved": "https://registry.npmjs.org/@angular-devkit/core/-/core-17.3.8.tgz", + "integrity": "sha512-Q8q0voCGudbdCgJ7lXdnyaxKHbNQBARH68zPQV72WT8NWy+Gw/tys870i6L58NWbBaCJEUcIj/kb6KoakSRu+Q==", "dependencies": { - "brace-expansion": "^2.0.1" + "ajv": "8.12.0", + "ajv-formats": "2.1.1", + "jsonc-parser": "3.2.1", + "picomatch": "4.0.1", + "rxjs": "7.8.1", + "source-map": "0.7.4" }, "engines": { - "node": ">=16 || 14 >=14.17" + "node": "^18.13.0 || >=20.9.0", + "npm": "^6.11.0 || ^7.5.6 || >=8.0.0", + "yarn": ">= 1.13.0" }, - "funding": { - "url": "https://github.com/sponsors/isaacs" + "peerDependencies": { + "chokidar": "^3.5.2" + }, + "peerDependenciesMeta": { + "chokidar": { + "optional": true + } } }, - "node_modules/@nestjs/cli/node_modules/minipass": { - "version": "4.2.8", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-4.2.8.tgz", - "integrity": "sha512-fNzuVyifolSLFL4NzpF+wEF4qrgqaaKX0haXPQEdQ7NKAN+WecoKMHV09YcuL/DHxrUsYQOK3MiuDf7Ip2OXfQ==", + "node_modules/@nestjs/cli/node_modules/@angular-devkit/schematics": { + "version": "17.3.8", + "resolved": "https://registry.npmjs.org/@angular-devkit/schematics/-/schematics-17.3.8.tgz", + "integrity": "sha512-QRVEYpIfgkprNHc916JlPuNbLzOgrm9DZalHasnLUz4P6g7pR21olb8YCyM2OTJjombNhya9ZpckcADU5Qyvlg==", + "dependencies": { + "@angular-devkit/core": "17.3.8", + "jsonc-parser": "3.2.1", + "magic-string": "0.30.8", + "ora": "5.4.1", + "rxjs": "7.8.1" + }, "engines": { - "node": ">=8" + "node": "^18.13.0 || >=20.9.0", + "npm": "^6.11.0 || ^7.5.6 || >=8.0.0", + "yarn": ">= 1.13.0" } }, - "node_modules/@nestjs/cli/node_modules/rimraf": { - "version": "4.4.1", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-4.4.1.tgz", - "integrity": "sha512-Gk8NlF062+T9CqNGn6h4tls3k6T1+/nXdOcSZVikNVtlRdYpA7wRJJMoXmuvOnLW844rPjdQ7JgXCYM6PPC/og==", + "node_modules/@nestjs/cli/node_modules/jsonc-parser": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.2.1.tgz", + "integrity": "sha512-AilxAyFOAcK5wA1+LeaySVBrHsGQvUFCDWXKpZjzaL0PqW+xfBOttn8GNtWKFWqneyMZj41MWF9Kl6iPWLwgOA==" + }, + "node_modules/@nestjs/cli/node_modules/magic-string": { + "version": "0.30.8", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.8.tgz", + "integrity": "sha512-ISQTe55T2ao7XtlAStud6qwYPZjE4GK1S/BeVPus4jrq6JuOnQ00YKQC581RWhR122W7msZV263KzVeLoqidyQ==", "dependencies": { - "glob": "^9.2.0" - }, - "bin": { - "rimraf": "dist/cjs/src/bin.js" + "@jridgewell/sourcemap-codec": "^1.4.15" }, "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" + "node": ">=12" } }, - "node_modules/@nestjs/cli/node_modules/rimraf/node_modules/glob": { - "version": "9.3.5", - "resolved": "https://registry.npmjs.org/glob/-/glob-9.3.5.tgz", - "integrity": "sha512-e1LleDykUz2Iu+MTYdkSsuWX8lvAjAcs0Xef0lNIu0S2wOAzuTxCJtcd9S3cijlwYF18EsU3rzb8jPVobxDh9Q==", - "dependencies": { - "fs.realpath": "^1.0.0", - "minimatch": "^8.0.2", - "minipass": "^4.2.4", - "path-scurry": "^1.6.1" - }, + "node_modules/@nestjs/cli/node_modules/picomatch": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.1.tgz", + "integrity": "sha512-xUXwsxNjwTQ8K3GnT4pCJm+xq3RUPQbmkYJTP5aFIfNIvbcc/4MUxgBaaRSZJ6yGJZiGSyYlM6MzwTsRk8SYCg==", "engines": { - "node": ">=16 || 14 >=14.17" + "node": ">=12" }, "funding": { - "url": "https://github.com/sponsors/isaacs" + "url": "https://github.com/sponsors/jonschlinkert" } }, "node_modules/@nestjs/cli/node_modules/typescript": { @@ -1927,15 +1963,15 @@ } }, "node_modules/@nestjs/platform-express": { - "version": "10.3.8", - "resolved": "https://registry.npmjs.org/@nestjs/platform-express/-/platform-express-10.3.8.tgz", - "integrity": "sha512-sifLoxgEJvAgbim1UuW6wyScMfkS9SVQRH+lN33N/9ZvZSjO6NSDLOe+wxqsnZkia+QrjFC0qy0ITRAsggfqbg==", + "version": "10.4.5", + "resolved": "https://registry.npmjs.org/@nestjs/platform-express/-/platform-express-10.4.5.tgz", + "integrity": "sha512-a629r8R8KC4skhdieQ0aIWH5vDBUFntWnWKFyDXQrll6/CllSchfWm87mWF39seaW6bXYtQtAEZY66JrngdrGA==", "dependencies": { - "body-parser": "1.20.2", + "body-parser": "1.20.3", "cors": "2.8.5", - "express": "4.19.2", + "express": "4.21.1", "multer": "1.4.4-lts.1", - "tslib": "2.6.2" + "tslib": "2.7.0" }, "funding": { "type": "opencollective", @@ -1946,6 +1982,11 @@ "@nestjs/core": "^10.0.0" } }, + "node_modules/@nestjs/platform-express/node_modules/tslib": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.7.0.tgz", + "integrity": "sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA==" + }, "node_modules/@nestjs/schematics": { "version": "10.1.1", "resolved": "https://registry.npmjs.org/@nestjs/schematics/-/schematics-10.1.1.tgz", @@ -2301,24 +2342,6 @@ "@types/node": "*" } }, - "node_modules/@types/eslint": { - "version": "8.56.10", - "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.56.10.tgz", - "integrity": "sha512-Shavhk87gCtY2fhXDctcfS3e6FdxWkCx1iUZ9eEUbh7rTqlZT0/IzOkCOVt0fCjcFuZ9FPYfuezTBImfHCDBGQ==", - "dependencies": { - "@types/estree": "*", - "@types/json-schema": "*" - } - }, - "node_modules/@types/eslint-scope": { - "version": "3.7.7", - "resolved": "https://registry.npmjs.org/@types/eslint-scope/-/eslint-scope-3.7.7.tgz", - "integrity": "sha512-MzMFlSLBqNF2gcHWO0G1vP/YQyfvrxZ0bF+u7mzUdZ1/xK4A4sru+nraZz5i3iEIk1l1uyicaDVTB4QbbEkAYg==", - "dependencies": { - "@types/eslint": "*", - "@types/estree": "*" - } - }, "node_modules/@types/estree": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz", @@ -3015,10 +3038,10 @@ "node": ">=0.4.0" } }, - "node_modules/acorn-import-assertions": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/acorn-import-assertions/-/acorn-import-assertions-1.9.0.tgz", - "integrity": "sha512-cmMwop9x+8KFhxvKrKfPYmN6/pKTYYHBqLa0DfvVZcKMJWNyWLnaqND7dx/qn66R7ewM1UX5XMaDVP5wlVTaVA==", + "node_modules/acorn-import-attributes": { + "version": "1.9.5", + "resolved": "https://registry.npmjs.org/acorn-import-attributes/-/acorn-import-attributes-1.9.5.tgz", + "integrity": "sha512-n02Vykv5uA3eHGM/Z2dQrcD56kL8TyDb2p1+0P83PClMnC/nc+anbQRhIOWnSq4Ke/KvDPrY3C9hDtC/A3eHnQ==", "peerDependencies": { "acorn": "^8" } @@ -3340,9 +3363,9 @@ } }, "node_modules/body-parser": { - "version": "1.20.2", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.2.tgz", - "integrity": "sha512-ml9pReCu3M61kGlqoTm2umSXTlRTuGTx0bfYj+uIUKKYycG5NtSbeetV3faSU6R7ajOPw0g/J1PvK4qNy7s5bA==", + "version": "1.20.3", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.3.tgz", + "integrity": "sha512-7rAxByjUMqQ3/bHJy7D6OGXvx/MMc4IqBn/X0fcM1QUcAItpZrBEYhWGem+tzXH90c+G01ypMcYJBO9Y30203g==", "dependencies": { "bytes": "3.1.2", "content-type": "~1.0.5", @@ -3352,7 +3375,7 @@ "http-errors": "2.0.0", "iconv-lite": "0.4.24", "on-finished": "2.4.1", - "qs": "6.11.0", + "qs": "6.13.0", "raw-body": "2.5.2", "type-is": "~1.6.18", "unpipe": "1.0.0" @@ -3703,9 +3726,9 @@ } }, "node_modules/cli-table3": { - "version": "0.6.3", - "resolved": "https://registry.npmjs.org/cli-table3/-/cli-table3-0.6.3.tgz", - "integrity": "sha512-w5Jac5SykAeZJKntOxJCrm63Eg5/4dhMWIcuTbo9rpE+brgaSZo0RuNJZeOyMgsUdhDeojvgyQLmjI+K50ZGyg==", + "version": "0.6.5", + "resolved": "https://registry.npmjs.org/cli-table3/-/cli-table3-0.6.5.tgz", + "integrity": "sha512-+W/5efTR7y5HRD7gACw9yQjqMVvEMLBHmboM/kPWam+H+Hmyrgjh6YncVKK122YZkXrLudzTuAukUw9FnMf7IQ==", "dependencies": { "string-width": "^4.2.0" }, @@ -3874,9 +3897,9 @@ "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==" }, "node_modules/cookie": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.6.0.tgz", - "integrity": "sha512-U71cyTamuh1CRNCfpGY6to28lxvNwPG4Guz/EVjgf3Jmzv0vlDp1atT9eS5dDjMYHucpHbWns6Lwf3BKz6svdw==", + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.1.tgz", + "integrity": "sha512-6DnInpx7SJ2AK3+CTUE/ZM0vWTUboZCegxhC2xiIydHR9jNuTAASBrfEpHhiGOZw/nX51bHt6YQl8jsGo4y/0w==", "engines": { "node": ">= 0.6" } @@ -4226,9 +4249,9 @@ "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" }, "node_modules/encodeurl": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", - "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz", + "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==", "engines": { "node": ">= 0.8" } @@ -4242,9 +4265,9 @@ } }, "node_modules/enhanced-resolve": { - "version": "5.16.1", - "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.16.1.tgz", - "integrity": "sha512-4U5pNsuDl0EhuZpq46M5xPslstkviJuhrdobaRDBk2Jy2KO37FDAJl4lb2KlNabxT0m4MTK2UHNrsAcphE8nyw==", + "version": "5.17.1", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.17.1.tgz", + "integrity": "sha512-LMHl3dXhTcfv8gM4kEzIUeTQ+7fpdA0l2tUf34BddXPkz2A5xJ5L/Pchd5BL6rdccM9QGvu0sWZzK1Z1t4wwyg==", "dependencies": { "graceful-fs": "^4.2.4", "tapable": "^2.2.0" @@ -4622,36 +4645,36 @@ } }, "node_modules/express": { - "version": "4.19.2", - "resolved": "https://registry.npmjs.org/express/-/express-4.19.2.tgz", - "integrity": "sha512-5T6nhjsT+EOMzuck8JjBHARTHfMht0POzlA60WV2pMD3gyXw2LZnZ+ueGdNxG+0calOJcWKbpFcuzLZ91YWq9Q==", + "version": "4.21.1", + "resolved": "https://registry.npmjs.org/express/-/express-4.21.1.tgz", + "integrity": "sha512-YSFlK1Ee0/GC8QaO91tHcDxJiE/X4FbpAyQWkxAvG6AXCuR65YzK8ua6D9hvi/TzUfZMpc+BwuM1IPw8fmQBiQ==", "dependencies": { "accepts": "~1.3.8", "array-flatten": "1.1.1", - "body-parser": "1.20.2", + "body-parser": "1.20.3", "content-disposition": "0.5.4", "content-type": "~1.0.4", - "cookie": "0.6.0", + "cookie": "0.7.1", "cookie-signature": "1.0.6", "debug": "2.6.9", "depd": "2.0.0", - "encodeurl": "~1.0.2", + "encodeurl": "~2.0.0", "escape-html": "~1.0.3", "etag": "~1.8.1", - "finalhandler": "1.2.0", + "finalhandler": "1.3.1", "fresh": "0.5.2", "http-errors": "2.0.0", - "merge-descriptors": "1.0.1", + "merge-descriptors": "1.0.3", "methods": "~1.1.2", "on-finished": "2.4.1", "parseurl": "~1.3.3", - "path-to-regexp": "0.1.7", + "path-to-regexp": "0.1.10", "proxy-addr": "~2.0.7", - "qs": "6.11.0", + "qs": "6.13.0", "range-parser": "~1.2.1", "safe-buffer": "5.2.1", - "send": "0.18.0", - "serve-static": "1.15.0", + "send": "0.19.0", + "serve-static": "1.16.2", "setprototypeof": "1.2.0", "statuses": "2.0.1", "type-is": "~1.6.18", @@ -4663,9 +4686,9 @@ } }, "node_modules/express/node_modules/path-to-regexp": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", - "integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==" + "version": "0.1.10", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.10.tgz", + "integrity": "sha512-7lf7qcQidTku0Gu3YDPc8DJ1q7OOucfa/BSsIwjuh56VU7katFvuM8hULfkwB3Fns/rsVF7PwPKVw1sl5KQS9w==" }, "node_modules/external-editor": { "version": "3.1.0", @@ -4864,12 +4887,12 @@ } }, "node_modules/finalhandler": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz", - "integrity": "sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg==", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.3.1.tgz", + "integrity": "sha512-6BN9trH7bp3qvnrRyzsBz+g3lZxTNZTbVO2EV1CS0WIcDbawYVdYvGflME/9QP0h0pYlCDBCTjYa9nZzMDpyxQ==", "dependencies": { "debug": "2.6.9", - "encodeurl": "~1.0.2", + "encodeurl": "~2.0.0", "escape-html": "~1.0.3", "on-finished": "2.4.1", "parseurl": "~1.3.3", @@ -5118,21 +5141,22 @@ } }, "node_modules/glob": { - "version": "10.3.10", - "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.10.tgz", - "integrity": "sha512-fa46+tv1Ak0UPK1TOy/pZrIybNNt4HCv7SDzwyfiOZkvZLEbjsZkJBPtDHVshZjbecAoAGSC20MjLDG/qr679g==", + "version": "10.4.2", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.4.2.tgz", + "integrity": "sha512-GwMlUF6PkPo3Gk21UxkCohOv0PLcIXVtKyLlpEI28R/cO/4eNOdmLk3CMW1wROV/WR/EsZOWAfBbBOqYvs88/w==", "dependencies": { "foreground-child": "^3.1.0", - "jackspeak": "^2.3.5", - "minimatch": "^9.0.1", - "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0", - "path-scurry": "^1.10.1" + "jackspeak": "^3.1.2", + "minimatch": "^9.0.4", + "minipass": "^7.1.2", + "package-json-from-dist": "^1.0.0", + "path-scurry": "^1.11.1" }, "bin": { "glob": "dist/esm/bin.mjs" }, "engines": { - "node": ">=16 || 14 >=14.17" + "node": ">=16 || 14 >=14.18" }, "funding": { "url": "https://github.com/sponsors/isaacs" @@ -5484,14 +5508,6 @@ "node": ">=12.0.0" } }, - "node_modules/interpret": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.4.0.tgz", - "integrity": "sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==", - "engines": { - "node": ">= 0.10" - } - }, "node_modules/ipaddr.js": { "version": "1.9.1", "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", @@ -5718,15 +5734,12 @@ } }, "node_modules/jackspeak": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-2.3.6.tgz", - "integrity": "sha512-N3yCS/NegsOBokc8GAdM8UcmfsKiSS8cipheD/nivzr700H+nsMOxJjQnvwOcRYVuFkdH0wGUvW2WbXGmrZGbQ==", + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-3.4.3.tgz", + "integrity": "sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==", "dependencies": { "@isaacs/cliui": "^8.0.2" }, - "engines": { - "node": ">=14" - }, "funding": { "url": "https://github.com/sponsors/isaacs" }, @@ -6617,9 +6630,12 @@ "integrity": "sha512-ZS4Bp4r/Zoeq6+NLJpP+0Zzm0pR8whtGPf1XExKLJBAczGMnSi3It14OiNCStjQjM6NU1okjQGSxgEZN8eBYKg==" }, "node_modules/merge-descriptors": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", - "integrity": "sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w==" + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.3.tgz", + "integrity": "sha512-gaNvAS7TZ897/rVaZ0nMtAyxNyi/pdbjbAwUpFQpN70GqnVfOiXpeUUMKRBmzXaSQ8DdTX4/0ms62r2K+hE6mQ==", + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } }, "node_modules/merge-stream": { "version": "2.0.0", @@ -6644,11 +6660,11 @@ } }, "node_modules/micromatch": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", - "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", + "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", "dependencies": { - "braces": "^3.0.2", + "braces": "^3.0.3", "picomatch": "^2.3.1" }, "engines": { @@ -6732,9 +6748,9 @@ } }, "node_modules/minipass": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.0.tgz", - "integrity": "sha512-oGZRv2OT1lO2UF1zUcwdTb3wqUwI0kBGTgt/T7OdSj6M6N5m3o5uPf0AIW6lVxGGoiWUR7e2AwTE+xiwK8WQig==", + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz", + "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==", "engines": { "node": ">=16 || 14 >=14.17" } @@ -7061,9 +7077,12 @@ } }, "node_modules/object-inspect": { - "version": "1.13.1", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.1.tgz", - "integrity": "sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==", + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.2.tgz", + "integrity": "sha512-IRZSRuzJiynemAXPYtPe5BoI/RESNYR7TYm50MC5Mqbd3Jmw5y790sErYw3V6SryFJD64b74qQQs9wn5Bg/k3g==", + "engines": { + "node": ">= 0.4" + }, "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -7193,6 +7212,11 @@ "node": ">=6" } }, + "node_modules/package-json-from-dist": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.0.tgz", + "integrity": "sha512-dATvCeZN/8wQsGywez1mzHtTlP22H8OEfPrVMLNr4/eGa+ijtLn/6M5f0dY8UKNrC2O9UCU6SSoG3qRKnt7STw==" + }, "node_modules/parent-module": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", @@ -7259,27 +7283,24 @@ "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==" }, "node_modules/path-scurry": { - "version": "1.10.2", - "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.10.2.tgz", - "integrity": "sha512-7xTavNy5RQXnsjANvVvMkEjvloOinkAjv/Z6Ildz9v2RinZ4SBKTWFOVRbaF8p0vpHnyjV/UwNDdKuUv6M5qcA==", + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.11.1.tgz", + "integrity": "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==", "dependencies": { "lru-cache": "^10.2.0", "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" }, "engines": { - "node": ">=16 || 14 >=14.17" + "node": ">=16 || 14 >=14.18" }, "funding": { "url": "https://github.com/sponsors/isaacs" } }, "node_modules/path-scurry/node_modules/lru-cache": { - "version": "10.2.2", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.2.2.tgz", - "integrity": "sha512-9hp3Vp2/hFQUiIwKo8XCeFVnrg8Pk3TYNPIR7tJADKi5YfcF7vEaK7avFHTlSy3kOKYaJQaalfEo6YuXdceBOQ==", - "engines": { - "node": "14 || >=16.14" - } + "version": "10.4.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz", + "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==" }, "node_modules/path-to-regexp": { "version": "3.2.0", @@ -7500,11 +7521,11 @@ ] }, "node_modules/qs": { - "version": "6.11.0", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz", - "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==", + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.13.0.tgz", + "integrity": "sha512-+38qI9SOr8tfZ4QmJNplMUxqjbe7LKvvZgWdExBOmd+egZTtjLB67Gu0HRX3u/XOq7UU2Nx6nsjvS16Z9uwfpg==", "dependencies": { - "side-channel": "^1.0.4" + "side-channel": "^1.0.6" }, "engines": { "node": ">=0.6" @@ -7620,17 +7641,6 @@ "url": "https://github.com/sponsors/jonschlinkert" } }, - "node_modules/rechoir": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", - "integrity": "sha512-HFM8rkZ+i3zrV+4LQjwQ0W+ez98pApMGM3HUrN04j3CqzPOzl9nmP15Y8YXNm8QHGv/eacOVEjqhmWpkRV0NAw==", - "dependencies": { - "resolve": "^1.1.6" - }, - "engines": { - "node": ">= 0.10" - } - }, "node_modules/reflect-metadata": { "version": "0.2.2", "resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.2.2.tgz", @@ -7892,9 +7902,9 @@ } }, "node_modules/send": { - "version": "0.18.0", - "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz", - "integrity": "sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==", + "version": "0.19.0", + "resolved": "https://registry.npmjs.org/send/-/send-0.19.0.tgz", + "integrity": "sha512-dW41u5VfLXu8SJh5bwRmyYUbAoSB3c9uQh6L8h/KtsFREPWpbX1lrljJo186Jc4nmci/sGUZ9a0a0J2zgfq2hw==", "dependencies": { "debug": "2.6.9", "depd": "2.0.0", @@ -7914,6 +7924,14 @@ "node": ">= 0.8.0" } }, + "node_modules/send/node_modules/encodeurl": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", + "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==", + "engines": { + "node": ">= 0.8" + } + }, "node_modules/send/node_modules/ms": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", @@ -7928,14 +7946,14 @@ } }, "node_modules/serve-static": { - "version": "1.15.0", - "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.15.0.tgz", - "integrity": "sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g==", + "version": "1.16.2", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.16.2.tgz", + "integrity": "sha512-VqpjJZKadQB/PEbEwvFdO43Ax5dFBZ2UECszz8bQ7pi7wt//PWe1P6MN7eCnjsatYtBT6EuiClbjSWP2WrIoTw==", "dependencies": { - "encodeurl": "~1.0.2", + "encodeurl": "~2.0.0", "escape-html": "~1.0.3", "parseurl": "~1.3.3", - "send": "0.18.0" + "send": "0.19.0" }, "engines": { "node": ">= 0.8.0" @@ -7981,41 +7999,6 @@ "node": ">=8" } }, - "node_modules/shelljs": { - "version": "0.8.5", - "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.5.tgz", - "integrity": "sha512-TiwcRcrkhHvbrZbnRcFYMLl30Dfov3HKqzp5tO5b4pt6G/SezKcYhmDg15zXVBswHmctSAQKznqNW2LO5tTDow==", - "dependencies": { - "glob": "^7.0.0", - "interpret": "^1.0.0", - "rechoir": "^0.6.2" - }, - "bin": { - "shjs": "bin/shjs" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/shelljs/node_modules/glob": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", - "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/side-channel": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.6.tgz", @@ -8879,25 +8862,24 @@ } }, "node_modules/webpack": { - "version": "5.90.1", - "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.90.1.tgz", - "integrity": "sha512-SstPdlAC5IvgFnhiRok8hqJo/+ArAbNv7rhU4fnWGHNVfN59HSQFaxZDSAL3IFG2YmqxuRs+IU33milSxbPlog==", + "version": "5.94.0", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.94.0.tgz", + "integrity": "sha512-KcsGn50VT+06JH/iunZJedYGUJS5FGjow8wb9c0v5n1Om8O1g4L6LjtfxwlXIATopoQu+vOXXa7gYisWxCoPyg==", "dependencies": { - "@types/eslint-scope": "^3.7.3", "@types/estree": "^1.0.5", - "@webassemblyjs/ast": "^1.11.5", - "@webassemblyjs/wasm-edit": "^1.11.5", - "@webassemblyjs/wasm-parser": "^1.11.5", + "@webassemblyjs/ast": "^1.12.1", + "@webassemblyjs/wasm-edit": "^1.12.1", + "@webassemblyjs/wasm-parser": "^1.12.1", "acorn": "^8.7.1", - "acorn-import-assertions": "^1.9.0", + "acorn-import-attributes": "^1.9.5", "browserslist": "^4.21.10", "chrome-trace-event": "^1.0.2", - "enhanced-resolve": "^5.15.0", + "enhanced-resolve": "^5.17.1", "es-module-lexer": "^1.2.1", "eslint-scope": "5.1.1", "events": "^3.2.0", "glob-to-regexp": "^0.4.1", - "graceful-fs": "^4.2.9", + "graceful-fs": "^4.2.11", "json-parse-even-better-errors": "^2.3.1", "loader-runner": "^4.2.0", "mime-types": "^2.1.27", @@ -8905,7 +8887,7 @@ "schema-utils": "^3.2.0", "tapable": "^2.1.1", "terser-webpack-plugin": "^5.3.10", - "watchpack": "^2.4.0", + "watchpack": "^2.4.1", "webpack-sources": "^3.2.3" }, "bin": { diff --git a/package.json b/package.json index 0f3adcc..1b25ad0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bingusboingus", - "version": "1.8.3", + "version": "1.9.3", "description": "Hey look it's Bingus.... or Boingus?? OR BOTH??", "main": "src/main.ts", "scripts": { @@ -28,12 +28,12 @@ }, "homepage": "https://github.com/Blvckleg/BingusBoingus/#readme", "dependencies": { - "@nestjs/cli": "^10.3.2", + "@nestjs/cli": "^10.4.5", "@nestjs/common": "^10.2.10", "@nestjs/config": "^3.1.1", "@nestjs/core": "^10.2.6", "@nestjs/mongoose": "^10.0.2", - "@nestjs/platform-express": "^10.2.6", + "@nestjs/platform-express": "^10.4.5", "@nestjs/swagger": "^7.3.1", "@nestjs/testing": "^10.2.6", "@types/jest": "^29.5.5", @@ -42,7 +42,7 @@ "discord-interactions": "^3.4.0", "discord.js": "^14.15.2", "dotenv": "^16.3.1", - "express": "^4.19.2", + "express": "^4.21.1", "jest": "^29.7.0", "joi": "^17.10.2", "mongoose": "^8.0.1", diff --git a/src/deployment/deploy.service.ts b/src/deployment/deploy.service.ts index c3775e1..9988b22 100644 --- a/src/deployment/deploy.service.ts +++ b/src/deployment/deploy.service.ts @@ -1,4 +1,8 @@ -import { REST, RESTPostAPIChatInputApplicationCommandsJSONBody, Routes } from 'discord.js'; +import { + REST, + RESTPostAPIChatInputApplicationCommandsJSONBody, + Routes, +} from 'discord.js'; import { Injectable } from '@nestjs/common'; import { CommandService } from '../modules/command/command.service'; import { AppConfigService } from '../config/config.service'; @@ -18,18 +22,25 @@ export class DeployServcice { return commands.map((command) => command.data.toJSON()); } - async deployCommands(commands: RESTPostAPIChatInputApplicationCommandsJSONBody[]) { + async deployCommands( + commands: RESTPostAPIChatInputApplicationCommandsJSONBody[], + ) { // Construct and prepare an instance of the REST module const rest = new REST().setToken(this.configService.botToken); // and deploy your commands! try { - console.log(`Started refreshing ${commands.length} application (/) commands.`); + console.log( + `Started refreshing ${commands.length} application (/) commands.`, + ); // The put method is used to fully refresh all commands in the guild with the current set - const data = await rest.put(Routes.applicationGuildCommands(process.env.CLIENT_ID ?? '', process.env.SERVER_ID ?? ''), { - body: commands, - }); + const data = await rest.put( + Routes.applicationCommands(process.env.CLIENT_ID ?? ''), + { + body: commands, + }, + ); let log = ''; if (Array.isArray(data)) log = data.length + ' '; diff --git a/src/modules/command/command.module.ts b/src/modules/command/command.module.ts index 0ae4977..bab0dc2 100644 --- a/src/modules/command/command.module.ts +++ b/src/modules/command/command.module.ts @@ -18,6 +18,8 @@ import { SomeoneOnceSaidModule } from '../models/someone-once-said/module/someon import { PollModule } from '../models/poll/module/poll.module'; import { VersionModule } from '../models/version/module/version.module'; import { BirthdayEntryModule } from '../models/birthday/module/birthday-entry.module'; +import ConfigureServerChannelCommand from './commands/server-config'; +import { ServerConfigModule } from '../models/config/module/server-config.module'; @Module({ providers: [ @@ -34,10 +36,17 @@ import { BirthdayEntryModule } from '../models/birthday/module/birthday-entry.mo PollCommand, VersionCommand, AddBirthdayEntryCommand, + ConfigureServerChannelCommand, DeactivateBirthdayEntryShoutoutCommand, ActivateBirthdayEntryShoutoutCommand, ], - imports: [SomeoneOnceSaidModule, PollModule, VersionModule, BirthdayEntryModule], + imports: [ + SomeoneOnceSaidModule, + PollModule, + VersionModule, + BirthdayEntryModule, + ServerConfigModule, + ], exports: [CommandService], }) export class CommandModule {} diff --git a/src/modules/command/command.service.ts b/src/modules/command/command.service.ts index 05e756b..2c98b60 100644 --- a/src/modules/command/command.service.ts +++ b/src/modules/command/command.service.ts @@ -14,6 +14,7 @@ import { BirthdayEntry } from '../../schemas/birthday-entry.schema'; import AddBirthdayEntryCommand from './commands/add-birthday-entry'; import DeactivateBirthdayEntryShoutoutCommand from './commands/deactivate-birthday-shoutout'; import ActivateBirthdayEntryShoutoutCommand from './commands/activate-birthday-shoutout'; +import ConfigureServerChannelCommand from './commands/server-config'; @Injectable() export class CommandService { @@ -34,6 +35,7 @@ export class CommandService { addBirthdayEntryModule: AddBirthdayEntryCommand, deactivateBirthdayEntryShoutoutModule: DeactivateBirthdayEntryShoutoutCommand, activateBirthdayEntryShoutoutModule: ActivateBirthdayEntryShoutoutCommand, + configureServerChannelIdModule: ConfigureServerChannelCommand, ) { const commands: ACommand[] = [ //pingpongModule, @@ -50,6 +52,7 @@ export class CommandService { addBirthdayEntryModule, deactivateBirthdayEntryShoutoutModule, activateBirthdayEntryShoutoutModule, + configureServerChannelIdModule, ]; commands.forEach((command) => { if (command.data.name && !!command.execute) { diff --git a/src/modules/command/commands/activate-birthday-shoutout.ts b/src/modules/command/commands/activate-birthday-shoutout.ts index 05968ad..00d48b4 100644 --- a/src/modules/command/commands/activate-birthday-shoutout.ts +++ b/src/modules/command/commands/activate-birthday-shoutout.ts @@ -27,6 +27,7 @@ export default class ActivateBirthdayEntryShoutoutCommand extends ACommand { const instance: CreateOrUpdateBirthdayEntryDto = { username: arg.user.username, secName: arg.user.displayName, + serverId: arg.guildId, active: true, }; const inactive = diff --git a/src/modules/command/commands/add-birthday-entry.ts b/src/modules/command/commands/add-birthday-entry.ts index 15483b0..5ebd1a9 100644 --- a/src/modules/command/commands/add-birthday-entry.ts +++ b/src/modules/command/commands/add-birthday-entry.ts @@ -8,10 +8,6 @@ import { ACommand } from '../command.abstract'; import { Inject } from '@nestjs/common'; import { BirthdayEntryService } from '../../models/birthday/service/birthday-entry.service'; import { CreateOrUpdateBirthdayEntryDto } from '../../models/birthday/dto/create-or-update-birthday-entry.dto'; -import { - CommandAccessLevel, - Role, -} from '../../../common/decoratos/role.decorator'; export default class AddBirthdayEntryCommand extends ACommand { constructor( @@ -56,6 +52,7 @@ export default class AddBirthdayEntryCommand extends ACommand { birthDate: dateValue, username: arg.user.username, secName: arg.user.displayName, + serverId: arg.guildId, active: true, }; const created = diff --git a/src/modules/command/commands/deactivate-birthday-shoutout.ts b/src/modules/command/commands/deactivate-birthday-shoutout.ts index 0761f13..14e4fbf 100644 --- a/src/modules/command/commands/deactivate-birthday-shoutout.ts +++ b/src/modules/command/commands/deactivate-birthday-shoutout.ts @@ -27,6 +27,7 @@ export default class DeactivateBirthdayEntryShoutoutCommand extends ACommand { const instance: CreateOrUpdateBirthdayEntryDto = { username: arg.user.username, secName: arg.user.displayName, + serverId: arg.guildId, active: false, }; const inactive = diff --git a/src/modules/command/commands/get-a-quote.ts b/src/modules/command/commands/get-a-quote.ts index cd8232a..f71522e 100644 --- a/src/modules/command/commands/get-a-quote.ts +++ b/src/modules/command/commands/get-a-quote.ts @@ -25,7 +25,9 @@ export default class GetRandomQuote extends ACommand { // @Role(CommandAccessLevel.member) async execute(arg: CommandInteraction): Promise { - const someoneOnceSaid = await this.someoneonceSaidService.getRandomQuote(); + const someoneOnceSaid = await this.someoneonceSaidService.getRandomQuote( + arg.guildId, + ); if (!someoneOnceSaid) return; const quoteEmbed = new EmbedBuilder() .setTitle( diff --git a/src/modules/command/commands/server-config.ts b/src/modules/command/commands/server-config.ts new file mode 100644 index 0000000..03167c1 --- /dev/null +++ b/src/modules/command/commands/server-config.ts @@ -0,0 +1,57 @@ +import { + CacheType, + CommandInteraction, + EmbedBuilder, + SlashCommandBuilder, +} from 'discord.js'; +import { ACommand } from '../command.abstract'; +import { Inject } from '@nestjs/common'; +import { ServerConfigService } from '../../models/config/service/server-config.service'; +import { CreateOrUpdateServerConfigDto } from '../../models/config/dto/create-or-update-server-config.dto'; + +export default class ConfigureServerChannelCommand extends ACommand { + constructor( + @Inject(ServerConfigService) + private readonly configService: ServerConfigService, + ) { + super(); + } + data = new SlashCommandBuilder() + .setName('configure') + .setDescription( + 'set the channel id where the bot will send all scheduled messages', + ) + .addStringOption((option) => + option.setName('channelid').setDescription('the Id of the text-channel'), + ); + + // @Role(CommandAccessLevel.member) + async execute(arg: CommandInteraction): Promise { + const channelId = arg.options.get('channelid'); + if (!channelId) { + await arg.reply({ + content: 'you need to provide a valid channel Id! 🤓', + ephemeral: true, + }); + return false; + } + await arg.deferReply(); + const channelIdValue = channelId.value as unknown as string; + const instance: CreateOrUpdateServerConfigDto = { + channelId: channelIdValue, + serverId: arg.guildId, + }; + const created = + await this.configService.createOrUpdateServerConfig(instance); + const quoteEmbed = new EmbedBuilder() + .setTitle('Your scheduled messages textchannel was configured! 🤓') + .setDescription('🤓') + .setFooter({ + text: 'scheduled messages activated', + }) + .setTimestamp(new Date()); + await arg.editReply({ embeds: [quoteEmbed] }); + return true; + } +} + diff --git a/src/modules/command/commands/someone-once-said.ts b/src/modules/command/commands/someone-once-said.ts index 2108abc..ba58d86 100644 --- a/src/modules/command/commands/someone-once-said.ts +++ b/src/modules/command/commands/someone-once-said.ts @@ -12,6 +12,7 @@ import { CommandAccessLevel, Role, } from '../../../common/decoratos/role.decorator'; +import { server } from 'typescript'; export default class SomeoneOnceSaidCommand extends ACommand { constructor( @@ -46,6 +47,7 @@ export default class SomeoneOnceSaidCommand extends ACommand { phrase: phraseValue, username: arg.user.username, secName: arg.user.displayName, + serverId: arg.guildId, }); const created = await this.someoneonceSaidService.create(instance); const quoteEmbed = new EmbedBuilder() diff --git a/src/modules/cron-tasks/cron.service.ts b/src/modules/cron-tasks/cron.service.ts index 02e3d54..dc7f7ea 100644 --- a/src/modules/cron-tasks/cron.service.ts +++ b/src/modules/cron-tasks/cron.service.ts @@ -1,4 +1,4 @@ -import { Client, TextChannel } from 'discord.js'; +import { TextChannel } from 'discord.js'; import BirthdayShoutoutTask from './tasks/birthday-shoutout.task'; import { Inject, Injectable } from '@nestjs/common'; import WakeUpTask from './tasks/wake-up.task'; @@ -6,6 +6,8 @@ import * as cron from 'node-cron'; import { BirthdayEntryService } from '../models/birthday/service/birthday-entry.service'; import { TaskEntry } from './interfaces/task-entry.interface'; import { DiscordService } from '../discord/discord.service'; +import { ServerConfigService } from '../models/config/service/server-config.service'; +import { ServerConfigDocument } from '../../schemas/server-config.schema'; @Injectable() export class CronService { @@ -17,6 +19,8 @@ export class CronService { private readonly birthdayService: BirthdayEntryService, @Inject(DiscordService) private readonly discordService: DiscordService, + @Inject(ServerConfigService) + private readonly serverConfigService: ServerConfigService, ) { if (CronService.instance) { throw new Error(`ERROR: An instance has already been created.`); @@ -29,28 +33,32 @@ export class CronService { return CronService.instance; } - public init() { - this.tasks = [ - { + public async init() { + const servers: ServerConfigDocument[] = + await this.serverConfigService.getAll(); + let birthdayTasks = []; + servers.forEach((server) => { + const birthdayChannel = this.discordService.client.channels.cache.find( + (channel) => channel.id === server.channelId, + ) as TextChannel; + birthdayTasks.push({ name: 'birthday-shoutout', schedule: '0 10 * * *', - task: new BirthdayShoutoutTask( - this.discordService.client.channels.cache.find( - (channel) => channel.id === '447554141724737548', - ) as TextChannel, - this.birthdayService, - ), - }, - { + task: new BirthdayShoutoutTask(birthdayChannel, this.birthdayService), + }); + }); + let wakeUpTasks = []; + servers.forEach((server) => { + const wakeUpChannel = this.discordService.client.channels.cache.find( + (channel) => channel.id === server.channelId, + ) as TextChannel; + wakeUpTasks.push({ name: 'first-of-the-month', schedule: '0 12 1 * *', - task: new WakeUpTask( - this.discordService.client.channels.cache.find( - (channel) => channel.id === '447554141724737548', - ) as TextChannel, - ), - }, - ]; + task: new WakeUpTask(wakeUpChannel), + }); + }); + this.tasks = [...birthdayTasks, ...wakeUpTasks]; this.registerTasks(); } diff --git a/src/modules/cron-tasks/task.module.ts b/src/modules/cron-tasks/task.module.ts index 98edce4..dd515ce 100644 --- a/src/modules/cron-tasks/task.module.ts +++ b/src/modules/cron-tasks/task.module.ts @@ -2,9 +2,10 @@ import { Module } from '@nestjs/common'; import { BirthdayEntryModule } from '../models/birthday/module/birthday-entry.module'; import { CronService } from './cron.service'; import { DiscordModule } from '../discord/discord.module'; +import { ServerConfigModule } from '../models/config/module/server-config.module'; @Module({ - imports: [DiscordModule, BirthdayEntryModule], + imports: [DiscordModule, BirthdayEntryModule, ServerConfigModule], providers: [CronService], exports: [CronService], }) diff --git a/src/modules/cron-tasks/tasks/birthday-shoutout.task.ts b/src/modules/cron-tasks/tasks/birthday-shoutout.task.ts index bc9a222..ed56fc8 100644 --- a/src/modules/cron-tasks/tasks/birthday-shoutout.task.ts +++ b/src/modules/cron-tasks/tasks/birthday-shoutout.task.ts @@ -1,35 +1,46 @@ -import { EmbedBuilder, TextChannel } from 'discord.js' -import { ITask } from './interfaces/task.interface' -import { BirthdayEntryService } from '../../models/birthday/service/birthday-entry.service' +import { EmbedBuilder, TextChannel } from 'discord.js'; +import { ITask } from './interfaces/task.interface'; +import { BirthdayEntryService } from '../../models/birthday/service/birthday-entry.service'; export default class BirthdayShoutoutTask implements ITask { - private channel: TextChannel + private channel: TextChannel; - constructor(channel: TextChannel, private readonly birthdayService: BirthdayEntryService) { - this.channel = channel - } - - async execute(): Promise { - const birthDayEntries = await this.birthdayService.getEntryForToday() + constructor( + channel: TextChannel, + private readonly birthdayService: BirthdayEntryService, + ) { + this.channel = channel; + } - if (!birthDayEntries || birthDayEntries.length < 1) { - return - } + async execute(): Promise { + const birthDayEntries = await this.birthdayService.getEntryForToday(); - birthDayEntries.forEach((entry) => { - const creator = this.channel.members.find((member) => member.user.username === entry.username || member.user.displayName === entry.secName) + if (!birthDayEntries || birthDayEntries.length < 1) { + return; + } - const embed = new EmbedBuilder() - .setTitle(`🚨 Birthday Alert!! 🚨`) - .setColor('Random') - .setDescription(`${entry.username ?? entry.secName} is turning **${new Date().getFullYear() - entry.birthDate.getFullYear()}** years old today! 🎉🎂🎈`) - .setFooter({ - text: creator?.user.username ?? 'bingus', - iconURL: creator?.displayAvatarURL() ?? undefined, - }) - .setTimestamp(new Date()) + birthDayEntries.forEach((entry) => { + const creator = this.channel.members.find( + (member) => + member.user.username === entry.username || + member.user.displayName === entry.secName, + ); - this.channel.send({ embeds: [embed] }) + const embed = new EmbedBuilder() + .setTitle(`🚨 Birthday Alert!! 🚨`) + .setColor('Random') + .setDescription( + `${entry.username ?? entry.secName} is turning **${ + new Date().getFullYear() - entry.birthDate.getFullYear() + }** years old today! 🎉🎂🎈`, + ) + .setFooter({ + text: creator?.user.username ?? 'bingus', + iconURL: creator?.displayAvatarURL() ?? undefined, }) - } -} \ No newline at end of file + .setTimestamp(new Date()); + + this.channel.send({ embeds: [embed] }); + }); + } +} diff --git a/src/modules/event/services/clientReady.ts b/src/modules/event/services/clientReady.ts index f79a88a..8894ef2 100644 --- a/src/modules/event/services/clientReady.ts +++ b/src/modules/event/services/clientReady.ts @@ -16,6 +16,6 @@ export class ClientReady extends AEvent { console.log('Successfully connected to Discord'); console.log(`logged in as ${args[0].user.username}`); - this.cronService.init(); + await this.cronService.init(); } } diff --git a/src/modules/models/birthday/dto/create-or-update-birthday-entry.dto.ts b/src/modules/models/birthday/dto/create-or-update-birthday-entry.dto.ts index efe2a3f..78e8048 100644 --- a/src/modules/models/birthday/dto/create-or-update-birthday-entry.dto.ts +++ b/src/modules/models/birthday/dto/create-or-update-birthday-entry.dto.ts @@ -18,6 +18,14 @@ export class CreateOrUpdateBirthdayEntryDto { @IsOptional() secName: string; + @ApiProperty({ + example: '12398182390132', + description: 'The discord serverId the interaction comes from', + type: String, + }) + @IsNotEmpty() + serverId: string; + @ApiProperty({ example: '2024-01-01T00:00:00.000Z', description: 'The birthdate of the user in ISO format', diff --git a/src/modules/models/birthday/service/birthday-entry.service.ts b/src/modules/models/birthday/service/birthday-entry.service.ts index 1a7ae60..d23940d 100644 --- a/src/modules/models/birthday/service/birthday-entry.service.ts +++ b/src/modules/models/birthday/service/birthday-entry.service.ts @@ -8,8 +8,13 @@ export class BirthdayEntryService { @InjectModel('BirthdayEntry') private readonly birthdayEntry: Model, ) {} - async createOrUpdateBirthdayEntry(birthdayEntryDto: CreateOrUpdateBirthdayEntryDto,) { - const birthdayEntry = await this.birthdayEntry.findOne({ username: birthdayEntryDto.username }); + async createOrUpdateBirthdayEntry( + birthdayEntryDto: CreateOrUpdateBirthdayEntryDto, + ) { + const birthdayEntry = await this.birthdayEntry.findOne({ + username: birthdayEntryDto.username, + serverId: birthdayEntryDto.serverId, + }); if (birthdayEntry) { return await this.updateBirthdayEntry(birthdayEntryDto); } else { @@ -26,6 +31,7 @@ export class BirthdayEntryService { secName: birthdayEntryDto?.secName, birthDate: birthdayEntryDto.birthDate, active: true, + serverId: birthdayEntryDto.serverId, createdAt: new Date(), }); } catch (e) { @@ -33,7 +39,9 @@ export class BirthdayEntryService { } } - async updateBirthdayEntry(birthdayEntryDto: CreateOrUpdateBirthdayEntryDto): Promise { + async updateBirthdayEntry( + birthdayEntryDto: CreateOrUpdateBirthdayEntryDto, + ): Promise { try { return await this.birthdayEntry.findOneAndUpdate( { username: birthdayEntryDto.username }, @@ -51,22 +59,23 @@ export class BirthdayEntryService { async getEntryForToday(): Promise { try { - const entries = await this.birthdayEntry.find({ active: true }); + const entries = await this.birthdayEntry.find({ + active: true, + }); if (!entries) { - return null + return null; } - const today = new Date() + const today = new Date(); - return entries - .filter((entry) => { - const date = new Date(entry.birthDate) - return ( - date.getFullYear() !== today.getFullYear() && - date.getMonth() === today.getMonth() && - date.getDate() === today.getDate() - ) - }) + return entries.filter((entry) => { + const date = new Date(entry.birthDate); + return ( + date.getFullYear() !== today.getFullYear() && + date.getMonth() === today.getMonth() && + date.getDate() === today.getDate() + ); + }); } catch (e) { return null; } diff --git a/src/modules/models/config/dto/create-or-update-server-config.dto.ts b/src/modules/models/config/dto/create-or-update-server-config.dto.ts new file mode 100644 index 0000000..35ac0e8 --- /dev/null +++ b/src/modules/models/config/dto/create-or-update-server-config.dto.ts @@ -0,0 +1,21 @@ +import { ApiProperty } from '@nestjs/swagger'; +import { IsNotEmpty } from 'class-validator'; + +export class CreateOrUpdateServerConfigDto { + @ApiProperty({ + example: '239123321', + description: 'The discord serverId', + type: String, + }) + @IsNotEmpty() + serverId: string; + + @ApiProperty({ + example: '321123312123', + description: 'The discord channelId for cron tasks', + type: String, + }) + @IsNotEmpty() + channelId: string; +} + diff --git a/src/modules/models/config/module/server-config.module.ts b/src/modules/models/config/module/server-config.module.ts new file mode 100644 index 0000000..0d20ecb --- /dev/null +++ b/src/modules/models/config/module/server-config.module.ts @@ -0,0 +1,22 @@ +import { Module } from '@nestjs/common'; +import { MongooseModule } from '@nestjs/mongoose'; +import { ServerConfigService } from '../service/server-config.service'; +import { + ServerConfig, + ServerConfigSchema, +} from '../../../../schemas/server-config.schema'; + +@Module({ + imports: [ + MongooseModule.forFeature([ + { + name: ServerConfig.name, + schema: ServerConfigSchema, + }, + ]), + ], + controllers: [], + providers: [ServerConfigService], + exports: [ServerConfigService], +}) +export class ServerConfigModule {} diff --git a/src/modules/models/config/service/server-config.service.ts b/src/modules/models/config/service/server-config.service.ts new file mode 100644 index 0000000..768f926 --- /dev/null +++ b/src/modules/models/config/service/server-config.service.ts @@ -0,0 +1,76 @@ +import { InjectModel } from '@nestjs/mongoose'; +import { Model } from 'mongoose'; +import { CreateOrUpdateServerConfigDto } from '../dto/create-or-update-server-config.dto'; +import { ServerConfigDocument } from '../../../../schemas/server-config.schema'; + +export class ServerConfigService { + constructor( + @InjectModel('ServerConfig') + private readonly serverConfig: Model, + ) {} + async createOrUpdateServerConfig( + serverConfigDto: CreateOrUpdateServerConfigDto, + ) { + const entry = await this.serverConfig.findOne({ + channelId: serverConfigDto.channelId, + serverId: serverConfigDto.serverId, + }); + if (entry) { + return await this.updateEntry(serverConfigDto); + } else { + return await this.create(serverConfigDto); + } + } + + async create( + birthdayEntryDto: CreateOrUpdateServerConfigDto, + ): Promise { + try { + return await this.serverConfig.create({ + channelId: birthdayEntryDto.channelId, + serverId: birthdayEntryDto.serverId, + }); + } catch (e) { + return null; + } + } + + async updateEntry( + dto: CreateOrUpdateServerConfigDto, + ): Promise { + try { + return await this.serverConfig.findOneAndUpdate( + { serverId: dto.serverId }, + { + channelId: dto.channelId, + }, + { new: true }, + ); + } catch (e) { + return null; + } + } + + async getEntryForServer(serverId: string): Promise { + try { + const entry = await this.serverConfig.findOne({ + serverId: serverId, + }); + if (!entry) { + return null; + } + + return entry; + } catch (e) { + return null; + } + } + + async getAll(): Promise { + try { + return await this.serverConfig.find(); + } catch (e) { + return null; + } + } +} diff --git a/src/modules/models/poll/dto/update-poll.dto.ts b/src/modules/models/poll/dto/update-poll.dto.ts index ade9487..095f8b7 100644 --- a/src/modules/models/poll/dto/update-poll.dto.ts +++ b/src/modules/models/poll/dto/update-poll.dto.ts @@ -1,26 +1,27 @@ -import { IsNotEmpty, IsOptional } from "class-validator"; +import { IsNotEmpty, IsOptional } from 'class-validator'; export class UpdatePollDto { - @IsNotEmpty() - msg: string; + @IsNotEmpty() + msg: string; - @IsNotEmpty() - upvotes: number; + @IsNotEmpty() + upvotes: number; - @IsNotEmpty() - downvotes: number; + @IsNotEmpty() + downvotes: number; - @IsOptional() - active: boolean; + @IsNotEmpty() + serverId: string; - @IsOptional() - ownerName: string; + @IsOptional() + active: boolean; - @IsOptional() - downMembers: string[] + @IsOptional() + ownerName: string; - @IsOptional() - upMembers: string[] + @IsOptional() + downMembers: string[]; - -} \ No newline at end of file + @IsOptional() + upMembers: string[]; +} diff --git a/src/modules/models/poll/service/db-poll.service.ts b/src/modules/models/poll/service/db-poll.service.ts index 45bd9da..2efa682 100644 --- a/src/modules/models/poll/service/db-poll.service.ts +++ b/src/modules/models/poll/service/db-poll.service.ts @@ -19,6 +19,7 @@ export class DbPollService { downvotes: pollDto.downvotes, upMembers: pollDto?.upMembers ?? [], downMembers: pollDto?.downMembers ?? [], + serverId: pollDto.serverId, active: true, createdAt: new Date(), }); @@ -28,10 +29,12 @@ export class DbPollService { } } - async update(updateDto: UpdatePollDto): Promise { + async update( + updateDto: UpdatePollDto, + ): Promise { try { return await this.pollModel.findOneAndUpdate( - { msg: updateDto.msg }, + { msg: updateDto.msg, serverId: updateDto.serverId }, { upvotes: updateDto.upvotes, downvotes: updateDto?.downvotes, @@ -46,10 +49,14 @@ export class DbPollService { } } - async get(messageId: string): Promise { + async get( + messageId: string, + serverId: string, + ): Promise { try { const test = await this.pollModel.findOne({ msg: messageId, + serverId: serverId, active: true, }); return test; diff --git a/src/modules/models/poll/service/poll.service.ts b/src/modules/models/poll/service/poll.service.ts index c8615c7..8e501cf 100644 --- a/src/modules/models/poll/service/poll.service.ts +++ b/src/modules/models/poll/service/poll.service.ts @@ -65,6 +65,7 @@ export class PollService { downMembers: [], active: true, ownerName: arg.user.username, + serverId: arg.guild.id, createdAt: new Date(), }); } @@ -79,7 +80,10 @@ export class PollService { } public async upVote(interaction: ButtonInteraction) { - const data = await this.dbPollService.get(interaction.message.id); + const data = await this.dbPollService.get( + interaction.message.id, + interaction.guild.id, + ); if (!data) return; const msg = await interaction.channel.messages.fetch(data.msg); @@ -103,7 +107,10 @@ export class PollService { } public async downVote(interaction: ButtonInteraction) { - const data = await this.dbPollService.get(interaction.message.id); + const data = await this.dbPollService.get( + interaction.message.id, + interaction.guild.id, + ); if (!data) return; const msg = await interaction.channel.messages.fetch(data.msg); @@ -127,7 +134,10 @@ export class PollService { } public async closePoll(interaction: ButtonInteraction) { - const data = await this.dbPollService.get(interaction.message.id); + const data = await this.dbPollService.get( + interaction.message.id, + interaction.guild.id, + ); if (!data) return; const msg = await interaction.channel.messages.fetch(data.msg); if (interaction.user.username == data.ownerName) { diff --git a/src/modules/models/someone-once-said/service/someone-once-said.service.spec.ts b/src/modules/models/someone-once-said/service/someone-once-said.service.spec.ts index 3bc98dd..7cbcbf9 100644 --- a/src/modules/models/someone-once-said/service/someone-once-said.service.spec.ts +++ b/src/modules/models/someone-once-said/service/someone-once-said.service.spec.ts @@ -14,6 +14,7 @@ describe('SomeoneOnceSaidService', () => { phrase: 'Test quote', username: 'testUser', secName: 'Teschter', + serverId: 'someid', createdAt: mockDate, }; const mockQuoteDocument: SomeoneOnceSaidDocument = { @@ -64,6 +65,7 @@ describe('SomeoneOnceSaidService', () => { const mockQuoteDto: SomeoneOnceSaidEntity = { phrase: 'Test quote', username: 'testUser', + serverId: 'someid', createdAt: mockDate, }; (modelMock as any).create = jest.fn((p) => new Error('Test error')); @@ -74,7 +76,6 @@ describe('SomeoneOnceSaidService', () => { }); }); - describe('getRandomQuote', () => { it('should return a random quote', async () => { (modelMock as any).findOne = jest.fn((p) => ({ @@ -85,7 +86,7 @@ describe('SomeoneOnceSaidService', () => { const countSpy = jest.spyOn(modelMock, 'countDocuments'); const findOneSpy = jest.spyOn(modelMock, 'findOne'); - const result = await service.getRandomQuote(); + const result = await service.getRandomQuote('someid'); expect(result).toStrictEqual(mockQuoteDocument); expect(countSpy).toHaveBeenCalled(); @@ -97,7 +98,7 @@ describe('SomeoneOnceSaidService', () => { (p) => new Error('Test error'), ); - const result = await service.getRandomQuote(); + const result = await service.getRandomQuote('someid'); expect(result).toBeNull(); }); diff --git a/src/modules/models/someone-once-said/service/someone-once-said.service.ts b/src/modules/models/someone-once-said/service/someone-once-said.service.ts index 8494e05..447630a 100644 --- a/src/modules/models/someone-once-said/service/someone-once-said.service.ts +++ b/src/modules/models/someone-once-said/service/someone-once-said.service.ts @@ -17,21 +17,26 @@ export class SomeoneOnceSaidService { phrase: quoteDto.phrase, username: quoteDto.username, secName: quoteDto?.secName, + serverId: quoteDto.serverId, createdAt: new Date(), }); } catch (e) { return null; } } - - async getRandomQuote(): Promise { + + async getRandomQuote( + serverId: string, + ): Promise { try { - const count = await this.someoneOnceSaid.countDocuments(); + const count = await this.someoneOnceSaid.countDocuments({ + serverId: serverId, + }); const randomIndex = Math.floor(Math.random() * count); const randomQuote = await this.someoneOnceSaid - .findOne() + .findOne({ serverId: serverId }) .skip(randomIndex) .limit(1); diff --git a/src/schemas/birthday-entry.model.ts b/src/schemas/birthday-entry.model.ts index 773ef5f..6b12618 100644 --- a/src/schemas/birthday-entry.model.ts +++ b/src/schemas/birthday-entry.model.ts @@ -1,8 +1,8 @@ export class BirthdayEntryEntity { - username: string; - secName: string; - birthDate: Date; - createdAt: Date; - active?: boolean; - } - \ No newline at end of file + username: string; + secName: string; + birthDate: Date; + serverId: string; + createdAt: Date; + active?: boolean; +} diff --git a/src/schemas/birthday-entry.schema.ts b/src/schemas/birthday-entry.schema.ts index df61799..853386f 100644 --- a/src/schemas/birthday-entry.schema.ts +++ b/src/schemas/birthday-entry.schema.ts @@ -7,13 +7,16 @@ export class BirthdayEntry { @Prop({ required: false }) secName: string; - + @Prop({ required: true }) birthDate: Date; @Prop({ required: true }) active: boolean; + @Prop({ required: true }) + serverId: string; + @Prop({ required: true }) createdAt: Date; @@ -24,5 +27,4 @@ export class BirthdayEntry { export type BirthdayEntryDocument = BirthdayEntry & Document; -export const BirthdayEntrySchema = - SchemaFactory.createForClass(BirthdayEntry); +export const BirthdayEntrySchema = SchemaFactory.createForClass(BirthdayEntry); diff --git a/src/schemas/poll-entity.model.ts b/src/schemas/poll-entity.model.ts index ebd4a96..d931b41 100644 --- a/src/schemas/poll-entity.model.ts +++ b/src/schemas/poll-entity.model.ts @@ -1,11 +1,11 @@ export class PollEntity { - msg: string; - ownerName: string; - upvotes: number; - downvotes: number; - upMembers?: string[]; - downMembers?: string[]; - active: boolean; - createdAt: Date; - } - \ No newline at end of file + msg: string; + ownerName: string; + upvotes: number; + downvotes: number; + upMembers?: string[]; + downMembers?: string[]; + active: boolean; + serverId: string; + createdAt: Date; +} diff --git a/src/schemas/poll.schema.ts b/src/schemas/poll.schema.ts index 35d77fe..262e5aa 100644 --- a/src/schemas/poll.schema.ts +++ b/src/schemas/poll.schema.ts @@ -23,6 +23,9 @@ export class Poll { @Prop({ required: true }) active: boolean; + @Prop({ required: true }) + serverId: string; + @Prop({ required: true }) createdAt: Date; @@ -33,5 +36,4 @@ export class Poll { export type PollDocument = Poll & Document; -export const PollSchema = - SchemaFactory.createForClass(Poll); +export const PollSchema = SchemaFactory.createForClass(Poll); diff --git a/src/schemas/server-config.schema.ts b/src/schemas/server-config.schema.ts new file mode 100644 index 0000000..5061fb5 --- /dev/null +++ b/src/schemas/server-config.schema.ts @@ -0,0 +1,19 @@ +import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose'; + +@Schema() +export class ServerConfig { + @Prop({ required: true }) + channelId: string; + + @Prop({ required: true, unique: true }) + serverId: string; + + constructor(data) { + Object.assign(this, data); + } +} + +export type ServerConfigDocument = ServerConfig & Document; + +export const ServerConfigSchema = SchemaFactory.createForClass(ServerConfig); + diff --git a/src/schemas/someone-once-said-entity.model.ts b/src/schemas/someone-once-said-entity.model.ts index 0eb6d1a..3689343 100644 --- a/src/schemas/someone-once-said-entity.model.ts +++ b/src/schemas/someone-once-said-entity.model.ts @@ -3,4 +3,5 @@ export class SomeoneOnceSaidEntity { username: string; secName?: string; createdAt: Date; + serverId: string; } diff --git a/src/schemas/someone-once-said.schema.ts b/src/schemas/someone-once-said.schema.ts index 1392e66..2117f2f 100644 --- a/src/schemas/someone-once-said.schema.ts +++ b/src/schemas/someone-once-said.schema.ts @@ -11,6 +11,9 @@ export class SomeoneOnceSaid { @Prop({ required: false }) secName: string; + @Prop({ required: true }) + serverId: string; + @Prop({ required: true }) createdAt: Date;