commit f9a7991a8fa0d45619b9364355d55121658e45b3 Author: Lea Date: Fri Mar 17 16:57:11 2023 +0100 init commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d3a8807 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +dist/ +node_modules +.env +db.json diff --git a/README.md b/README.md new file mode 100644 index 0000000..f40df33 --- /dev/null +++ b/README.md @@ -0,0 +1,5 @@ +TOKEN=bot token +SERVER=server id +ROLE=probation role id +LOGS=log channel id +DB_FILE=path to db.json diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..d22f668 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,605 @@ +{ + "name": "kibby", + "version": "1.0.0", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "name": "kibby", + "version": "1.0.0", + "license": "ISC", + "dependencies": { + "dotenv": "^16.0.3", + "revolt.js": "^6.0.20" + }, + "devDependencies": { + "@types/node": "^18.15.3", + "typescript": "^5.0.2" + } + }, + "node_modules/@insertish/exponential-backoff": { + "version": "3.1.0-patch.2", + "resolved": "https://registry.npmjs.org/@insertish/exponential-backoff/-/exponential-backoff-3.1.0-patch.2.tgz", + "integrity": "sha512-0lsMVexkZ7dHpQlPrTZDRsm42hZ4/CzKxP1hbAEJH8IaEwrIEhhTKJuFxPuLOi2TwPImuocncjYHpGpwVNOemQ==", + "license": "Apache-2.0" + }, + "node_modules/@insertish/isomorphic-ws": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@insertish/isomorphic-ws/-/isomorphic-ws-4.0.1.tgz", + "integrity": "sha512-kFD/p8T4Hkqr992QrdkbW/cQ/W/q2d9MPCobwzBv2PwTKLkCD9RaYDy6m17qRnSLQQ5PU0kHCG8kaOwAqzj1vQ==", + "license": "MIT", + "peerDependencies": { + "ws": "*" + } + }, + "node_modules/@insertish/oapi": { + "version": "0.1.18", + "resolved": "https://registry.npmjs.org/@insertish/oapi/-/oapi-0.1.18.tgz", + "integrity": "sha512-LZLUk3WmzUjCM0quensexvQx/Kk1MpFBtCLJRnRrPOiaFT37JpOmWUFlrdu0sPS6B9wi2edEBeLcsnIiq85WMA==", + "license": "MIT", + "dependencies": { + "typescript": "^4.6.2" + }, + "bin": { + "oapilib": "cli.js" + }, + "optionalDependencies": { + "axios": "^0.26.1", + "openapi-typescript": "^5.2.0" + } + }, + "node_modules/@insertish/oapi/node_modules/typescript": { + "version": "4.9.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", + "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + }, + "node_modules/@types/node": { + "version": "18.15.3", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.15.3.tgz", + "integrity": "sha512-p6ua9zBxz5otCmbpb5D3U4B5Nanw6Pk3PPyX05xnxbB/fRv71N7CPmORg7uAD5P70T0xmx1pzAx/FUfa5X+3cw==", + "dev": true + }, + "node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "license": "Python-2.0", + "optional": true + }, + "node_modules/axios": { + "version": "0.26.1", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.26.1.tgz", + "integrity": "sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA==", + "license": "MIT", + "dependencies": { + "follow-redirects": "^1.14.8" + } + }, + "node_modules/busboy": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/busboy/-/busboy-1.6.0.tgz", + "integrity": "sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==", + "optional": true, + "dependencies": { + "streamsearch": "^1.1.0" + }, + "engines": { + "node": ">=10.16.0" + } + }, + "node_modules/dotenv": { + "version": "16.0.3", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.3.tgz", + "integrity": "sha512-7GO6HghkA5fYG9TYnNxi14/7K9f5occMlp3zXAuSxn7CKCxt9xbNWG7yF8hTCSUchlfWSe3uLmlPfigevRItzQ==", + "license": "BSD-2-Clause", + "engines": { + "node": ">=12" + } + }, + "node_modules/eventemitter3": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", + "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==", + "license": "MIT" + }, + "node_modules/follow-redirects": { + "version": "1.15.2", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz", + "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "license": "MIT", + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, + "node_modules/globalyzer": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/globalyzer/-/globalyzer-0.1.0.tgz", + "integrity": "sha512-40oNTM9UfG6aBmuKxk/giHn5nQ8RVz/SS4Ir6zgzOv9/qC3kKZ9v4etGTcJbEl/NyVQH7FGU7d+X1egr57Md2Q==", + "license": "MIT", + "optional": true + }, + "node_modules/globrex": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/globrex/-/globrex-0.1.2.tgz", + "integrity": "sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg==", + "license": "MIT", + "optional": true + }, + "node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "license": "MIT", + "optional": true, + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/lodash.defaultsdeep": { + "version": "4.6.1", + "resolved": "https://registry.npmjs.org/lodash.defaultsdeep/-/lodash.defaultsdeep-4.6.1.tgz", + "integrity": "sha512-3j8wdDzYuWO3lM3Reg03MuQR957t287Rpcxp1njpEa8oDrikb+FwGdW3n+FELh/A6qib6yPit0j/pv9G/yeAqA==", + "license": "MIT" + }, + "node_modules/lodash.flatten": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/lodash.flatten/-/lodash.flatten-4.4.0.tgz", + "integrity": "sha512-C5N2Z3DgnnKr0LOpv/hKCgKdb7ZZwafIrsesve6lmzvZIRZRGaZ/l6Q8+2W7NaT+ZwO3fFlSCzCzrDCFdJfZ4g==", + "license": "MIT" + }, + "node_modules/lodash.isequal": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.isequal/-/lodash.isequal-4.5.0.tgz", + "integrity": "sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ==", + "license": "MIT" + }, + "node_modules/long": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/long/-/long-5.2.1.tgz", + "integrity": "sha512-GKSNGeNAtw8IryjjkhZxuKB3JzlcLTwjtiQCHKvqQet81I93kXslhDQruGI/QsddO83mcDToBVy7GqGS/zYf/A==", + "license": "Apache-2.0" + }, + "node_modules/mime": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-3.0.0.tgz", + "integrity": "sha512-jSCU7/VB1loIWBZe14aEYHU/+1UMEHoaO7qxCOVJOw9GgH72VAWppxNcjU+x9a2k3GSIBXNKxXQFqRvvZ7vr3A==", + "license": "MIT", + "optional": true, + "bin": { + "mime": "cli.js" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/mobx": { + "version": "6.8.0", + "resolved": "https://registry.npmjs.org/mobx/-/mobx-6.8.0.tgz", + "integrity": "sha512-+o/DrHa4zykFMSKfS8Z+CPSEg5LW9tSNGTuN8o6MF1GKxlfkSHSeJn5UtgxvPkGgaouplnrLXCF+duAsmm6FHQ==", + "license": "MIT", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/mobx" + } + }, + "node_modules/openapi-typescript": { + "version": "5.4.1", + "resolved": "https://registry.npmjs.org/openapi-typescript/-/openapi-typescript-5.4.1.tgz", + "integrity": "sha512-AGB2QiZPz4rE7zIwV3dRHtoUC/CWHhUjuzGXvtmMQN2AFV8xCTLKcZUHLcdPQmt/83i22nRE7+TxXOXkK+gf4Q==", + "license": "MIT", + "optional": true, + "dependencies": { + "js-yaml": "^4.1.0", + "mime": "^3.0.0", + "prettier": "^2.6.2", + "tiny-glob": "^0.2.9", + "undici": "^5.4.0", + "yargs-parser": "^21.0.1" + }, + "bin": { + "openapi-typescript": "bin/cli.js" + }, + "engines": { + "node": ">= 14.0.0" + } + }, + "node_modules/prettier": { + "version": "2.8.4", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.4.tgz", + "integrity": "sha512-vIS4Rlc2FNh0BySk3Wkd6xmwxB0FpOndW5fisM5H8hsZSxU2VWVB5CWIkIjWvrHjIhxk2g3bfMKM87zNTrZddw==", + "license": "MIT", + "optional": true, + "bin": { + "prettier": "bin-prettier.js" + }, + "engines": { + "node": ">=10.13.0" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, + "node_modules/revolt-api": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/revolt-api/-/revolt-api-0.5.7.tgz", + "integrity": "sha512-4c+TssIwjbnMW3Myg0VGyDdQV3BcoxxlF7hQaa7FeZTXj6qHy31RphGWIPfo+aLKC0AQl0oI+hxeOX1fTVPPqw==", + "license": "MIT", + "dependencies": { + "@insertish/oapi": "0.1.18", + "axios": "^0.26.1", + "lodash.defaultsdeep": "^4.6.1" + } + }, + "node_modules/revolt.js": { + "version": "6.0.20", + "resolved": "https://registry.npmjs.org/revolt.js/-/revolt.js-6.0.20.tgz", + "integrity": "sha512-iG0FmEmpHTWCQhlVd/jKXapCeoSyWCjPpmyjuQNGZYc1MqsgslK/dM2AbMRguANGRu8+z5/VljWgGNQh/+8zLA==", + "license": "MIT", + "dependencies": { + "@insertish/exponential-backoff": "3.1.0-patch.2", + "@insertish/isomorphic-ws": "^4.0.1", + "axios": "^0.21.4", + "eventemitter3": "^4.0.7", + "lodash.defaultsdeep": "^4.6.1", + "lodash.flatten": "^4.4.0", + "lodash.isequal": "^4.5.0", + "long": "^5.2.0", + "mobx": "^6.3.2", + "revolt-api": "0.5.7", + "ulid": "^2.3.0", + "ws": "^8.2.2" + } + }, + "node_modules/revolt.js/node_modules/axios": { + "version": "0.21.4", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.4.tgz", + "integrity": "sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==", + "license": "MIT", + "dependencies": { + "follow-redirects": "^1.14.0" + } + }, + "node_modules/streamsearch": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-1.1.0.tgz", + "integrity": "sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==", + "optional": true, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/tiny-glob": { + "version": "0.2.9", + "resolved": "https://registry.npmjs.org/tiny-glob/-/tiny-glob-0.2.9.tgz", + "integrity": "sha512-g/55ssRPUjShh+xkfx9UPDXqhckHEsHr4Vd9zX55oSdGZc/MD0m3sferOkwWtp98bv+kcVfEHtRJgBVJzelrzg==", + "license": "MIT", + "optional": true, + "dependencies": { + "globalyzer": "0.1.0", + "globrex": "^0.1.2" + } + }, + "node_modules/typescript": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.2.tgz", + "integrity": "sha512-wVORMBGO/FAs/++blGNeAVdbNKtIh1rbBL2EyQ1+J9lClJ93KiiKe8PmFIVdXhHcyv44SL9oglmfeSsndo0jRw==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=12.20" + } + }, + "node_modules/ulid": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/ulid/-/ulid-2.3.0.tgz", + "integrity": "sha512-keqHubrlpvT6G2wH0OEfSW4mquYRcbe/J8NMmveoQOjUqmo+hXtO+ORCpWhdbZ7k72UtY61BL7haGxW6enBnjw==", + "license": "MIT", + "bin": { + "ulid": "bin/cli.js" + } + }, + "node_modules/undici": { + "version": "5.21.0", + "resolved": "https://registry.npmjs.org/undici/-/undici-5.21.0.tgz", + "integrity": "sha512-HOjK8l6a57b2ZGXOcUsI5NLfoTrfmbOl90ixJDl0AEFG4wgHNDQxtZy15/ZQp7HhjkpaGlp/eneMgtsu1dIlUA==", + "license": "MIT", + "optional": true, + "dependencies": { + "busboy": "^1.6.0" + }, + "engines": { + "node": ">=12.18" + } + }, + "node_modules/ws": { + "version": "8.13.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz", + "integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==", + "license": "MIT", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "license": "ISC", + "optional": true, + "engines": { + "node": ">=12" + } + } + }, + "dependencies": { + "@insertish/exponential-backoff": { + "version": "3.1.0-patch.2", + "resolved": "https://registry.npmjs.org/@insertish/exponential-backoff/-/exponential-backoff-3.1.0-patch.2.tgz", + "integrity": "sha512-0lsMVexkZ7dHpQlPrTZDRsm42hZ4/CzKxP1hbAEJH8IaEwrIEhhTKJuFxPuLOi2TwPImuocncjYHpGpwVNOemQ==" + }, + "@insertish/isomorphic-ws": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@insertish/isomorphic-ws/-/isomorphic-ws-4.0.1.tgz", + "integrity": "sha512-kFD/p8T4Hkqr992QrdkbW/cQ/W/q2d9MPCobwzBv2PwTKLkCD9RaYDy6m17qRnSLQQ5PU0kHCG8kaOwAqzj1vQ==", + "requires": {} + }, + "@insertish/oapi": { + "version": "0.1.18", + "resolved": "https://registry.npmjs.org/@insertish/oapi/-/oapi-0.1.18.tgz", + "integrity": "sha512-LZLUk3WmzUjCM0quensexvQx/Kk1MpFBtCLJRnRrPOiaFT37JpOmWUFlrdu0sPS6B9wi2edEBeLcsnIiq85WMA==", + "requires": { + "axios": "^0.26.1", + "openapi-typescript": "^5.2.0", + "typescript": "^4.6.2" + }, + "dependencies": { + "typescript": { + "version": "4.9.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", + "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==" + } + } + }, + "@types/node": { + "version": "18.15.3", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.15.3.tgz", + "integrity": "sha512-p6ua9zBxz5otCmbpb5D3U4B5Nanw6Pk3PPyX05xnxbB/fRv71N7CPmORg7uAD5P70T0xmx1pzAx/FUfa5X+3cw==", + "dev": true + }, + "argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "optional": true + }, + "axios": { + "version": "0.26.1", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.26.1.tgz", + "integrity": "sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA==", + "requires": { + "follow-redirects": "^1.14.8" + } + }, + "busboy": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/busboy/-/busboy-1.6.0.tgz", + "integrity": "sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==", + "optional": true, + "requires": { + "streamsearch": "^1.1.0" + } + }, + "dotenv": { + "version": "16.0.3", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.3.tgz", + "integrity": "sha512-7GO6HghkA5fYG9TYnNxi14/7K9f5occMlp3zXAuSxn7CKCxt9xbNWG7yF8hTCSUchlfWSe3uLmlPfigevRItzQ==" + }, + "eventemitter3": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", + "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==" + }, + "follow-redirects": { + "version": "1.15.2", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz", + "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==" + }, + "globalyzer": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/globalyzer/-/globalyzer-0.1.0.tgz", + "integrity": "sha512-40oNTM9UfG6aBmuKxk/giHn5nQ8RVz/SS4Ir6zgzOv9/qC3kKZ9v4etGTcJbEl/NyVQH7FGU7d+X1egr57Md2Q==", + "optional": true + }, + "globrex": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/globrex/-/globrex-0.1.2.tgz", + "integrity": "sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg==", + "optional": true + }, + "js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "optional": true, + "requires": { + "argparse": "^2.0.1" + } + }, + "lodash.defaultsdeep": { + "version": "4.6.1", + "resolved": "https://registry.npmjs.org/lodash.defaultsdeep/-/lodash.defaultsdeep-4.6.1.tgz", + "integrity": "sha512-3j8wdDzYuWO3lM3Reg03MuQR957t287Rpcxp1njpEa8oDrikb+FwGdW3n+FELh/A6qib6yPit0j/pv9G/yeAqA==" + }, + "lodash.flatten": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/lodash.flatten/-/lodash.flatten-4.4.0.tgz", + "integrity": "sha512-C5N2Z3DgnnKr0LOpv/hKCgKdb7ZZwafIrsesve6lmzvZIRZRGaZ/l6Q8+2W7NaT+ZwO3fFlSCzCzrDCFdJfZ4g==" + }, + "lodash.isequal": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.isequal/-/lodash.isequal-4.5.0.tgz", + "integrity": "sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ==" + }, + "long": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/long/-/long-5.2.1.tgz", + "integrity": "sha512-GKSNGeNAtw8IryjjkhZxuKB3JzlcLTwjtiQCHKvqQet81I93kXslhDQruGI/QsddO83mcDToBVy7GqGS/zYf/A==" + }, + "mime": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-3.0.0.tgz", + "integrity": "sha512-jSCU7/VB1loIWBZe14aEYHU/+1UMEHoaO7qxCOVJOw9GgH72VAWppxNcjU+x9a2k3GSIBXNKxXQFqRvvZ7vr3A==", + "optional": true + }, + "mobx": { + "version": "6.8.0", + "resolved": "https://registry.npmjs.org/mobx/-/mobx-6.8.0.tgz", + "integrity": "sha512-+o/DrHa4zykFMSKfS8Z+CPSEg5LW9tSNGTuN8o6MF1GKxlfkSHSeJn5UtgxvPkGgaouplnrLXCF+duAsmm6FHQ==" + }, + "openapi-typescript": { + "version": "5.4.1", + "resolved": "https://registry.npmjs.org/openapi-typescript/-/openapi-typescript-5.4.1.tgz", + "integrity": "sha512-AGB2QiZPz4rE7zIwV3dRHtoUC/CWHhUjuzGXvtmMQN2AFV8xCTLKcZUHLcdPQmt/83i22nRE7+TxXOXkK+gf4Q==", + "optional": true, + "requires": { + "js-yaml": "^4.1.0", + "mime": "^3.0.0", + "prettier": "^2.6.2", + "tiny-glob": "^0.2.9", + "undici": "^5.4.0", + "yargs-parser": "^21.0.1" + } + }, + "prettier": { + "version": "2.8.4", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.4.tgz", + "integrity": "sha512-vIS4Rlc2FNh0BySk3Wkd6xmwxB0FpOndW5fisM5H8hsZSxU2VWVB5CWIkIjWvrHjIhxk2g3bfMKM87zNTrZddw==", + "optional": true + }, + "revolt-api": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/revolt-api/-/revolt-api-0.5.7.tgz", + "integrity": "sha512-4c+TssIwjbnMW3Myg0VGyDdQV3BcoxxlF7hQaa7FeZTXj6qHy31RphGWIPfo+aLKC0AQl0oI+hxeOX1fTVPPqw==", + "requires": { + "@insertish/oapi": "0.1.18", + "axios": "^0.26.1", + "lodash.defaultsdeep": "^4.6.1" + } + }, + "revolt.js": { + "version": "6.0.20", + "resolved": "https://registry.npmjs.org/revolt.js/-/revolt.js-6.0.20.tgz", + "integrity": "sha512-iG0FmEmpHTWCQhlVd/jKXapCeoSyWCjPpmyjuQNGZYc1MqsgslK/dM2AbMRguANGRu8+z5/VljWgGNQh/+8zLA==", + "requires": { + "@insertish/exponential-backoff": "3.1.0-patch.2", + "@insertish/isomorphic-ws": "^4.0.1", + "axios": "^0.21.4", + "eventemitter3": "^4.0.7", + "lodash.defaultsdeep": "^4.6.1", + "lodash.flatten": "^4.4.0", + "lodash.isequal": "^4.5.0", + "long": "^5.2.0", + "mobx": "^6.3.2", + "revolt-api": "0.5.7", + "ulid": "^2.3.0", + "ws": "^8.2.2" + }, + "dependencies": { + "axios": { + "version": "0.21.4", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.4.tgz", + "integrity": "sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==", + "requires": { + "follow-redirects": "^1.14.0" + } + } + } + }, + "streamsearch": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-1.1.0.tgz", + "integrity": "sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==", + "optional": true + }, + "tiny-glob": { + "version": "0.2.9", + "resolved": "https://registry.npmjs.org/tiny-glob/-/tiny-glob-0.2.9.tgz", + "integrity": "sha512-g/55ssRPUjShh+xkfx9UPDXqhckHEsHr4Vd9zX55oSdGZc/MD0m3sferOkwWtp98bv+kcVfEHtRJgBVJzelrzg==", + "optional": true, + "requires": { + "globalyzer": "0.1.0", + "globrex": "^0.1.2" + } + }, + "typescript": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.2.tgz", + "integrity": "sha512-wVORMBGO/FAs/++blGNeAVdbNKtIh1rbBL2EyQ1+J9lClJ93KiiKe8PmFIVdXhHcyv44SL9oglmfeSsndo0jRw==", + "dev": true + }, + "ulid": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/ulid/-/ulid-2.3.0.tgz", + "integrity": "sha512-keqHubrlpvT6G2wH0OEfSW4mquYRcbe/J8NMmveoQOjUqmo+hXtO+ORCpWhdbZ7k72UtY61BL7haGxW6enBnjw==" + }, + "undici": { + "version": "5.21.0", + "resolved": "https://registry.npmjs.org/undici/-/undici-5.21.0.tgz", + "integrity": "sha512-HOjK8l6a57b2ZGXOcUsI5NLfoTrfmbOl90ixJDl0AEFG4wgHNDQxtZy15/ZQp7HhjkpaGlp/eneMgtsu1dIlUA==", + "optional": true, + "requires": { + "busboy": "^1.6.0" + } + }, + "ws": { + "version": "8.13.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz", + "integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==", + "requires": {} + }, + "yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "optional": true + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..8b0d6e4 --- /dev/null +++ b/package.json @@ -0,0 +1,27 @@ +{ + "name": "kibby", + "version": "1.0.0", + "description": "", + "type": "module", + "module": "node16", + "exports": "./index.js", + "scripts": { + "build": "rm -rf dist && tsc", + "start": "node --experimental-specifier-resolution=node dist/index", + "dev": "yarn build && yarn start" + }, + "keywords": [], + "author": "", + "license": "ISC", + "dependencies": { + "dotenv": "^16.0.3", + "lowdb": "^3.0.0", + "revolt-api": "^0.5.16", + "revolt.js": "^6.0.20", + "ulid": "^2.3.0" + }, + "devDependencies": { + "@types/node": "^18.15.3", + "typescript": "^5.0.2" + } +} diff --git a/src/index.ts b/src/index.ts new file mode 100644 index 0000000..89bf0fe --- /dev/null +++ b/src/index.ts @@ -0,0 +1,397 @@ +import { Channel, Client, Member, Message, User } from "revolt.js"; +import { config } from 'dotenv'; +import { SendableEmbed } from 'revolt-api'; +import { Low, JSONFile } from 'lowdb'; +import { decodeTime } from 'ulid'; + +config(); + +type Db = { + probation: string[]; +} + +const DB_FILE = process.env.DB_FILE || './db.json'; +const RE_USER_MENTION = /^<@[0-9A-HJ-KM-NP-TV-Z]{26}>$/i; +const PUBLIC_COMMANDS = ['suicide', 'status', 'help']; +const COMMANDS = { + 'approve': 'Release users from probation', + 'unapprove': 'Send users to probation', + 'status': 'Edit the bot\'s status', + 'suicide': 'This will make you commit suicide', +} + +if (!process.env.TOKEN) throw "$TOKEN not set"; +if (!process.env.SERVER) throw "$SERVER not set"; +if (!process.env.ROLE) throw "$ROLE not set"; +if (!process.env.LOGS) throw "$LOGS not set"; + +const db = new Low(new JSONFile(DB_FILE)); +const client = new Client({ }); +client.loginBot(process.env.TOKEN); + +db.read().then(() => { + db.data ||= { probation: [] }; + db.write(); +}); + +client.once('ready', async () => { + console.log('Ready'); + const server = await client.servers.get(process.env.SERVER!); + await server?.fetchMembers(); + console.log('Got server members'); +}); + +function embed(content: string, title?: string, type?: 'INFO'|'SUCCESS'|'WARN'|'ERROR'): SendableEmbed { + const colors = { + 'SUCCESS': 'var(--success)', + 'INFO': 'var(--status-streaming)', + 'WARN': 'var(--warning)', + 'ERROR': 'var(--error)', + } + + return { + colour: colors[type || 'INFO'], + description: content, + title: title, + } +} + +async function fetchMessage(id: string, channel: Channel): Promise { + if (client.messages.get(id)) return client.messages.get(id)!; + return await channel.fetchMessage(id); +} + +async function extractUsers(message: Message, args: string[]): Promise { + const users: User[] = []; + if (!args.length) { + if (!message.reply_ids) { + await message.reply({ + embeds: [embed('You need to either reply to a message or provide an user ID.', 'No users provided', 'WARN')] + }); + return; + } + + let messages = await Promise.all(message.reply_ids?.map(id => fetchMessage(id, message.channel!))); + for (const m of messages) if (m.author) users.push(m.author); + } else { + const parsed = await Promise.allSettled(args.map(u => parseUser(u))); + const failed = parsed.filter(p => p.status == "rejected" || !p.value); + + if (failed.length) { + await message.reply({ embeds: [ + embed( + `One or more of the provided users could not be found:\n- ${ + failed.map(p => args[parsed.indexOf(p)]).join('\n- ') + }`, + "Failed to parse users", + "WARN", + ) + ] }) + return; + } + + parsed.forEach(p => p.status == "fulfilled" && users.push(p.value!)); + } + + return users; +} + +const getDmChannel = async (user: string | { _id: string } | User) => { + if (typeof user == "string") + user = client.users.get(user) || (await client.users.fetch(user)); + if (!(user instanceof User)) + user = + client.users.get(user._id) || (await client.users.fetch(user._id)); + + return ( + Array.from(client.channels).find( + (c) => + c[1].channel_type == "DirectMessage" && + c[1].recipient?._id == (user as User)._id + )?.[1] || (await (user as User).openDM()) + ); +}; + +/** + * Parses user input and returns an user object. + * Supports: `userID`, `<@userID>` (mention), `username`, `@username` (if user is cached). + * @param text + * @returns null if not found, otherwise user object + */ +async function parseUser(text: string): Promise { + if (!text) return null; + + let uid: string | null = null; + if (RE_USER_MENTION.test(text)) { + uid = text.replace(/<@|>/g, "").toUpperCase(); + } else if (/^[0-9A-HJ-KM-NP-TV-Z]{26}$/gi.test(text)) { + uid = text.toUpperCase(); + } else { + if (text.startsWith("@")) text = text.substring(1); + + // Why is there no .find() or .filter() + let user: User | null = null; + client.users.forEach((u) => { + if (u.username?.toLowerCase() == text.toLowerCase()) { + user = u; + } + }); + + if (user) return user; + } + + try { + if (uid) return (await client.users.fetch(uid)) || null; + else return null; + } catch (e) { + return null; + } +} + +// Get all cached members of a server. Whoever put STRINGIFIED JSON as map keys is now on my hit list. +const getMembers = (id: string) => + Array.from(client.members.entries()) + .filter((item) => item[0].includes(`"${id}"`)) + .map((entry) => entry[1]); + +// Call db.write() afterwards +const setProbation = async (member: Member, probation: boolean) => { + const logs = client.channels.get(process.env.LOGS!); + + if (probation) { + if (!member?.roles?.includes(process.env.ROLE!)) { + await member?.edit({ roles: [...(member.roles || []), process.env.ROLE!] }); + } + if (!db.data?.probation.includes(member!._id.user)) db.data?.probation.push(member!._id.user); + + await logs?.sendMessage({ + content: `$%log action=probation_add user=${member._id.user}%$`, + embeds: [ + embed( + `User @${member.user?.username} (<@${member._id.user}> ${member._id.user}) has been put on probation. Press ↩️ to undo.`, + 'Probation added', + 'INFO', + ), + ], + interactions: { + restrict_reactions: true, + reactions: [ '↩️' ] + }, + }); + } else { + if (member?.roles?.includes(process.env.ROLE!)) { + await member?.edit({ roles: member.roles.filter(r => r != process.env.ROLE) }); + } + if (db.data?.probation.includes(member!._id.user)) db.data.probation = db.data.probation.filter(id => id != member?._id.user); + + await logs?.sendMessage({ + content: `$%log action=probation_remove user=${member._id.user}%$`, + embeds: [ + embed( + `User @${member.user?.username} (<@${member._id.user}> ${member._id.user}) has been removed from probation. Press ↩️ to undo.`, + 'Probation removed', + 'INFO', + ), + ], + interactions: { + restrict_reactions: true, + reactions: [ '↩️' ] + }, + }); + } +} + +client.on('message', async (message) => { + try { + if (!message.content || typeof message.content != 'string') return; + const args = message.content.replace(/ +/g, ' ').split(' '); + if (args.shift()?.toLowerCase() != '/kibby') return; + + const privileged = message.member?.hasPermission(message.channel?.server!, 'ManageMessages'); + if (!PUBLIC_COMMANDS.includes(args[0]?.toLowerCase()) && !privileged) { + console.log('User has no permission'); + return; + } + + console.log('Got command: ' + args.join(' ')); + if (message.channel?.server_id != process.env.SERVER) return console.log('Command received in wrong server'); + + switch(args.shift()?.toLowerCase()) { + case 'approve': { + const users = await extractUsers(message, args); + if (!users?.length) return console.log('No users received'); + + const members = getMembers(message.channel!.server_id); + for (const user of users) { + const member = members.find(m => m._id.user == user._id); + await setProbation(member!, false); + } + + await db.write(); + + await message.reply({ embeds: [ + embed(`Selected user${users.length != 1 ? 's have' : ' has'} been approved.`, undefined, "SUCCESS"), + ] }); + break; + } + + case 'unapprove': + case 'probation': { + const users = await extractUsers(message, args); + if (!users?.length) return console.log('No users received'); + + const members = getMembers(message.channel!.server_id); + for (const user of users) { + const member = members.find(m => m._id.user == user._id); + await setProbation(member!, true); + } + + await db.write(); + + await message.reply({ embeds: [ + embed(`Selected user${users.length != 1 ? 's have' : ' has'} been sent to probation.`, undefined, "SUCCESS"), + ] }); + break; + } + + case 'status': { + let status = args.join(' '); + if (!status.length) { + await client.users.edit({ + remove: ['StatusText'] + }); + await message.reply({ embeds: [ + embed('Status cleared!', undefined, 'SUCCESS'), + ] }); + } + else { + await client.users.edit({ + status: { + ...client.user?.status, + text: status, + }, + }); + await message.reply({ embeds: [ + embed('Status set!', undefined, 'SUCCESS'), + ] }); + } + break; + } + + case 'suicide': { + const target = message.member; + const roles = target?.roles?.filter(r => r != process.env.ROLE); + if (!target || roles?.length || !target.kickable) { + await message.reply({ embeds: [embed(`Don't give in to the voices, champ!`)] }); + return; + } + + const channel = await getDmChannel(target._id.user); + await channel.sendMessage('https://rvlt.gg/M8CxaQRK :01G7KWY7NS7KNG5BQ9N064YK23:'); + await target.kick(); + await message.reply('[](https://autumn.revolt.chat/attachments/KosQrwl31AMxA0nLtwL1DFIvvZiPE2pYtr7DwAGJNF/928247511842431016.gif)'); + + break; + } + + case 'help': { + const commands = Object.entries(COMMANDS).filter(c => privileged || PUBLIC_COMMANDS.includes(c[0])); + + return await message.reply({ embeds: [ + embed("Kibby is this server's personal maid!"), + embed(`### Commands\n${commands.map(c => `- **/kibby ${c[0]}:** ${c[1]}`).join('\n')}`), + ] }); + } + + default: break; + } + } catch(e) { + console.error(e); + message.reply({ embeds: [ + embed(`\`\`\`js\n${e}\n\`\`\``, 'Aw, balls! Something broke!', 'ERROR'), + ] })?.catch(e => console.error(e)) + } +}); + +client.on('member/join', async (member) => { + const GAMER_WORDS = /nigg{er,a}|hitt?ler|trann(y|ie)|troon|faggot/i; + const CHILD_WORDS = /roblox|fran(ç|c)ais/i; + + console.log('User joined'); + try { + if (db.data?.probation.includes(member._id.user)) { + console.log('User on probation joined back'); + await setProbation(member, true); + } else { + const profile = await member.user?.fetchProfile(); + + // Age in hours + const age = (Date.now() - decodeTime(member._id.user)) / 1000 / 60 / 60; + console.log('Account age in hours: ' + age) + + if (GAMER_WORDS.test(profile?.content ?? '') || GAMER_WORDS.test(member.user?.username ?? '')) { + await setProbation(member, true); + } + else if (CHILD_WORDS.test(profile?.content ?? '') || CHILD_WORDS.test(member.user?.username ?? '')) { + if (age < 48) await setProbation(member, true); + } + else if (!profile?.background && !member.user?.avatar) { + if (age < 24) await setProbation(member, true); + } + else { + if (age < 1) await setProbation(member, true); + } + } + } catch(e) { + console.error(e); + } +}); + +client.on('packet', async (packet) => { + if (packet.type != 'MessageReact') return; + if (packet.emoji_id != '↩️') return; + try { + const channel = client.channels.get(packet.channel_id); + const message = client.messages.get(packet.id) || await channel!.fetchMessage(packet.id); + if (!message || message.author_id != client.user?._id) return console.log('Ignoring react: Author mismatch'); + + const members = getMembers(channel!.server_id!); + const member = members.find(m => m._id.user == packet.user_id); + if (!member) return console.log('Ignoring react: Could not find reacting user'); + const privileged = member.hasPermission(channel!.server!, 'ManageMessages'); + if (!privileged) return console.log('Ignoring react: User is unprivileged'); + + let info = message.content?.match(/^\$%log action=\S+ user=[A-Z0-9]+%\$$/)?.[0]; + if (!info) return console.log('Ignoring react: Could not extract message metadata'); + + let action = info.match(/action=\S+/)?.[0].substring(7), + user = info.match(/user=[A-Z0-9]+/)?.[0].substring(5); + + const target = members.find(m => m._id.user == user); + if (!target) return await channel?.sendMessage({ embeds: [ + embed(`Failed to find user \`${user}\`.`, 'Message interaction failed', 'ERROR'), + ] }); + + switch(action) { + case 'probation_add': {// Log message was for added probation, clicking button will remove it + await setProbation(target, false); + const embed = message.embeds?.[0] as SendableEmbed; + embed.description = embed.description?.replace(' Press ↩️ to undo.', ''); + embed.colour = 'var(--status-invisible)'; + await message.edit({ content: '#', embeds: [ embed ] }); + break; + } + case 'probation_remove': { + await setProbation(target, true); + const embed = message.embeds?.[0] as SendableEmbed; + embed.description = embed.description?.replace(' Press ↩️ to undo.', ''); + embed.colour = 'var(--status-invisible)'; + await message.edit({ content: '#', embeds: [ embed ] }); + break; + } + } + if (!target) return; + } catch(e) { + console.error(e); + } +}); diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..63e23f2 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,100 @@ +{ + "compilerOptions": { + /* Visit https://aka.ms/tsconfig.json to read more about this file */ + + /* Projects */ + // "incremental": true, /* Enable incremental compilation */ + // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */ + // "tsBuildInfoFile": "./", /* Specify the folder for .tsbuildinfo incremental compilation files. */ + // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects */ + // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */ + // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ + + /* Language and Environment */ + "target": "ESNext", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ + // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ + // "jsx": "preserve", /* Specify what JSX code is generated. */ + // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */ + // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ + // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h' */ + // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ + // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using `jsx: react-jsx*`.` */ + // "reactNamespace": "", /* Specify the object invoked for `createElement`. This only applies when targeting `react` JSX emit. */ + // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ + // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ + + /* Modules */ + "module": "ESNext", /* Specify what module code is generated. */ + "rootDir": "./src", /* Specify the root folder within your source files. */ + "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */ + // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ + // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ + // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ + // "typeRoots": [], /* Specify multiple folders that act like `./node_modules/@types`. */ + // "types": [], /* Specify type package names to be included without being referenced in a source file. */ + // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ + // "resolveJsonModule": true, /* Enable importing .json files */ + // "noResolve": true, /* Disallow `import`s, `require`s or ``s from expanding the number of files TypeScript should add to a project. */ + + /* JavaScript Support */ + // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. */ + // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ + // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from `node_modules`. Only applicable with `allowJs`. */ + + /* Emit */ + "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ + // "declarationMap": true, /* Create sourcemaps for d.ts files. */ + // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ + "sourceMap": true, /* Create source map files for emitted JavaScript files. */ + // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If `declaration` is true, also designates a file that bundles all .d.ts output. */ + "outDir": "./dist", /* Specify an output folder for all emitted files. */ + // "removeComments": true, /* Disable emitting comments. */ + // "noEmit": true, /* Disable emitting files from a compilation. */ + // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ + // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types */ + // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ + // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */ + // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ + // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */ + // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */ + // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ + // "newLine": "crlf", /* Set the newline character for emitting files. */ + // "stripInternal": true, /* Disable emitting declarations that have `@internal` in their JSDoc comments. */ + // "noEmitHelpers": true, /* Disable generating custom helper functions like `__extends` in compiled output. */ + // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */ + // "preserveConstEnums": true, /* Disable erasing `const enum` declarations in generated code. */ + // "declarationDir": "./", /* Specify the output directory for generated declaration files. */ + + /* Interop Constraints */ + // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */ + // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ + "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. */ + // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */ + "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ + + /* Type Checking */ + "strict": true, /* Enable all strict type-checking options. */ + // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied `any` type.. */ + // "strictNullChecks": true, /* When type checking, take into account `null` and `undefined`. */ + // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ + // "strictBindCallApply": true, /* Check that the arguments for `bind`, `call`, and `apply` methods match the original function. */ + "strictPropertyInitialization": false, /* Check for class properties that are declared but not set in the constructor. */ + // "noImplicitThis": true, /* Enable error reporting when `this` is given the type `any`. */ + // "useUnknownInCatchVariables": true, /* Type catch clause variables as 'unknown' instead of 'any'. */ + // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */ + // "noUnusedLocals": true, /* Enable error reporting when a local variables aren't read. */ + // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read */ + // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */ + // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */ + // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */ + // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */ + // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */ + // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type */ + // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */ + // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */ + + /* Completeness */ + // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ + "skipLibCheck": true /* Skip type checking all .d.ts files. */ + } +} diff --git a/yarn.lock b/yarn.lock new file mode 100644 index 0000000..8dde6ca --- /dev/null +++ b/yarn.lock @@ -0,0 +1,226 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +"@insertish/exponential-backoff@3.1.0-patch.2": + version "3.1.0-patch.2" + resolved "https://registry.npmjs.org/@insertish/exponential-backoff/-/exponential-backoff-3.1.0-patch.2.tgz" + integrity sha512-0lsMVexkZ7dHpQlPrTZDRsm42hZ4/CzKxP1hbAEJH8IaEwrIEhhTKJuFxPuLOi2TwPImuocncjYHpGpwVNOemQ== + +"@insertish/isomorphic-ws@^4.0.1": + version "4.0.1" + resolved "https://registry.npmjs.org/@insertish/isomorphic-ws/-/isomorphic-ws-4.0.1.tgz" + integrity sha512-kFD/p8T4Hkqr992QrdkbW/cQ/W/q2d9MPCobwzBv2PwTKLkCD9RaYDy6m17qRnSLQQ5PU0kHCG8kaOwAqzj1vQ== + +"@insertish/oapi@0.1.18": + version "0.1.18" + resolved "https://registry.npmjs.org/@insertish/oapi/-/oapi-0.1.18.tgz" + integrity sha512-LZLUk3WmzUjCM0quensexvQx/Kk1MpFBtCLJRnRrPOiaFT37JpOmWUFlrdu0sPS6B9wi2edEBeLcsnIiq85WMA== + dependencies: + typescript "^4.6.2" + optionalDependencies: + axios "^0.26.1" + openapi-typescript "^5.2.0" + +"@types/node@^18.15.3": + version "18.15.3" + resolved "https://registry.npmjs.org/@types/node/-/node-18.15.3.tgz" + integrity sha512-p6ua9zBxz5otCmbpb5D3U4B5Nanw6Pk3PPyX05xnxbB/fRv71N7CPmORg7uAD5P70T0xmx1pzAx/FUfa5X+3cw== + +argparse@^2.0.1: + version "2.0.1" + resolved "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz" + integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q== + +axios@^0.21.4: + version "0.21.4" + resolved "https://registry.npmjs.org/axios/-/axios-0.21.4.tgz" + integrity sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg== + dependencies: + follow-redirects "^1.14.0" + +axios@^0.26.1: + version "0.26.1" + resolved "https://registry.npmjs.org/axios/-/axios-0.26.1.tgz" + integrity sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA== + dependencies: + follow-redirects "^1.14.8" + +busboy@^1.6.0: + version "1.6.0" + resolved "https://registry.npmjs.org/busboy/-/busboy-1.6.0.tgz" + integrity sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA== + dependencies: + streamsearch "^1.1.0" + +dotenv@^16.0.3: + version "16.0.3" + resolved "https://registry.npmjs.org/dotenv/-/dotenv-16.0.3.tgz" + integrity sha512-7GO6HghkA5fYG9TYnNxi14/7K9f5occMlp3zXAuSxn7CKCxt9xbNWG7yF8hTCSUchlfWSe3uLmlPfigevRItzQ== + +eventemitter3@^4.0.7: + version "4.0.7" + resolved "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz" + integrity sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw== + +follow-redirects@^1.14.0, follow-redirects@^1.14.8: + version "1.15.2" + resolved "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz" + integrity sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA== + +globalyzer@0.1.0: + version "0.1.0" + resolved "https://registry.npmjs.org/globalyzer/-/globalyzer-0.1.0.tgz" + integrity sha512-40oNTM9UfG6aBmuKxk/giHn5nQ8RVz/SS4Ir6zgzOv9/qC3kKZ9v4etGTcJbEl/NyVQH7FGU7d+X1egr57Md2Q== + +globrex@^0.1.2: + version "0.1.2" + resolved "https://registry.npmjs.org/globrex/-/globrex-0.1.2.tgz" + integrity sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg== + +js-yaml@^4.1.0: + version "4.1.0" + resolved "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz" + integrity sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA== + dependencies: + argparse "^2.0.1" + +lodash.defaultsdeep@^4.6.1: + version "4.6.1" + resolved "https://registry.npmjs.org/lodash.defaultsdeep/-/lodash.defaultsdeep-4.6.1.tgz" + integrity sha512-3j8wdDzYuWO3lM3Reg03MuQR957t287Rpcxp1njpEa8oDrikb+FwGdW3n+FELh/A6qib6yPit0j/pv9G/yeAqA== + +lodash.flatten@^4.4.0: + version "4.4.0" + resolved "https://registry.npmjs.org/lodash.flatten/-/lodash.flatten-4.4.0.tgz" + integrity sha512-C5N2Z3DgnnKr0LOpv/hKCgKdb7ZZwafIrsesve6lmzvZIRZRGaZ/l6Q8+2W7NaT+ZwO3fFlSCzCzrDCFdJfZ4g== + +lodash.isequal@^4.5.0: + version "4.5.0" + resolved "https://registry.npmjs.org/lodash.isequal/-/lodash.isequal-4.5.0.tgz" + integrity sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ== + +long@^5.2.0: + version "5.2.1" + resolved "https://registry.npmjs.org/long/-/long-5.2.1.tgz" + integrity sha512-GKSNGeNAtw8IryjjkhZxuKB3JzlcLTwjtiQCHKvqQet81I93kXslhDQruGI/QsddO83mcDToBVy7GqGS/zYf/A== + +lowdb@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/lowdb/-/lowdb-3.0.0.tgz#c10ab4e7eb86f1cbe255e35e60ffb0c6f42049e0" + integrity sha512-9KZRulmIcU8fZuWiaM0d5e2/nPnrFyXkeXVpqT+MJS+vgbgOf1EbtvgQmba8HwUFgDl1oeZR6XqEJnkJmQdKmg== + dependencies: + steno "^2.1.0" + +mime@^3.0.0: + version "3.0.0" + resolved "https://registry.npmjs.org/mime/-/mime-3.0.0.tgz" + integrity sha512-jSCU7/VB1loIWBZe14aEYHU/+1UMEHoaO7qxCOVJOw9GgH72VAWppxNcjU+x9a2k3GSIBXNKxXQFqRvvZ7vr3A== + +mobx@^6.3.2: + version "6.8.0" + resolved "https://registry.npmjs.org/mobx/-/mobx-6.8.0.tgz" + integrity sha512-+o/DrHa4zykFMSKfS8Z+CPSEg5LW9tSNGTuN8o6MF1GKxlfkSHSeJn5UtgxvPkGgaouplnrLXCF+duAsmm6FHQ== + +openapi-typescript@^5.2.0: + version "5.4.1" + resolved "https://registry.npmjs.org/openapi-typescript/-/openapi-typescript-5.4.1.tgz" + integrity sha512-AGB2QiZPz4rE7zIwV3dRHtoUC/CWHhUjuzGXvtmMQN2AFV8xCTLKcZUHLcdPQmt/83i22nRE7+TxXOXkK+gf4Q== + dependencies: + js-yaml "^4.1.0" + mime "^3.0.0" + prettier "^2.6.2" + tiny-glob "^0.2.9" + undici "^5.4.0" + yargs-parser "^21.0.1" + +prettier@^2.6.2: + version "2.8.4" + resolved "https://registry.npmjs.org/prettier/-/prettier-2.8.4.tgz" + integrity sha512-vIS4Rlc2FNh0BySk3Wkd6xmwxB0FpOndW5fisM5H8hsZSxU2VWVB5CWIkIjWvrHjIhxk2g3bfMKM87zNTrZddw== + +revolt-api@0.5.7: + version "0.5.7" + resolved "https://registry.npmjs.org/revolt-api/-/revolt-api-0.5.7.tgz" + integrity sha512-4c+TssIwjbnMW3Myg0VGyDdQV3BcoxxlF7hQaa7FeZTXj6qHy31RphGWIPfo+aLKC0AQl0oI+hxeOX1fTVPPqw== + dependencies: + "@insertish/oapi" "0.1.18" + axios "^0.26.1" + lodash.defaultsdeep "^4.6.1" + +revolt-api@^0.5.16: + version "0.5.16" + resolved "https://registry.yarnpkg.com/revolt-api/-/revolt-api-0.5.16.tgz#71e9abfd01620a80ff84d50c1ff1fda39e1d597f" + integrity sha512-LrEU6WuazwZIwWHPQr7kpFQpzxBDg6chTKuvAuLIyzmILUDdDp6ALlA/AvlqBR1YcvT8rjbgcV0hHEIC8pkM2A== + dependencies: + "@insertish/oapi" "0.1.18" + axios "^0.26.1" + lodash.defaultsdeep "^4.6.1" + +revolt.js@^6.0.20: + version "6.0.20" + resolved "https://registry.npmjs.org/revolt.js/-/revolt.js-6.0.20.tgz" + integrity sha512-iG0FmEmpHTWCQhlVd/jKXapCeoSyWCjPpmyjuQNGZYc1MqsgslK/dM2AbMRguANGRu8+z5/VljWgGNQh/+8zLA== + dependencies: + "@insertish/exponential-backoff" "3.1.0-patch.2" + "@insertish/isomorphic-ws" "^4.0.1" + axios "^0.21.4" + eventemitter3 "^4.0.7" + lodash.defaultsdeep "^4.6.1" + lodash.flatten "^4.4.0" + lodash.isequal "^4.5.0" + long "^5.2.0" + mobx "^6.3.2" + revolt-api "0.5.7" + ulid "^2.3.0" + ws "^8.2.2" + +steno@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/steno/-/steno-2.1.0.tgz#05a9c378ce42ed04f642cda6fcb41787a10e4e33" + integrity sha512-mauOsiaqTNGFkWqIfwcm3y/fq+qKKaIWf1vf3ocOuTdco9XoHCO2AGF1gFYXuZFSWuP38Q8LBHBGJv2KnJSXyA== + +streamsearch@^1.1.0: + version "1.1.0" + resolved "https://registry.npmjs.org/streamsearch/-/streamsearch-1.1.0.tgz" + integrity sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg== + +tiny-glob@^0.2.9: + version "0.2.9" + resolved "https://registry.npmjs.org/tiny-glob/-/tiny-glob-0.2.9.tgz" + integrity sha512-g/55ssRPUjShh+xkfx9UPDXqhckHEsHr4Vd9zX55oSdGZc/MD0m3sferOkwWtp98bv+kcVfEHtRJgBVJzelrzg== + dependencies: + globalyzer "0.1.0" + globrex "^0.1.2" + +typescript@^4.6.2: + version "4.9.5" + resolved "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz" + integrity sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g== + +typescript@^5.0.2: + version "5.0.2" + resolved "https://registry.npmjs.org/typescript/-/typescript-5.0.2.tgz" + integrity sha512-wVORMBGO/FAs/++blGNeAVdbNKtIh1rbBL2EyQ1+J9lClJ93KiiKe8PmFIVdXhHcyv44SL9oglmfeSsndo0jRw== + +ulid@^2.3.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/ulid/-/ulid-2.3.0.tgz#93063522771a9774121a84d126ecd3eb9804071f" + integrity sha512-keqHubrlpvT6G2wH0OEfSW4mquYRcbe/J8NMmveoQOjUqmo+hXtO+ORCpWhdbZ7k72UtY61BL7haGxW6enBnjw== + +undici@^5.4.0: + version "5.21.0" + resolved "https://registry.npmjs.org/undici/-/undici-5.21.0.tgz" + integrity sha512-HOjK8l6a57b2ZGXOcUsI5NLfoTrfmbOl90ixJDl0AEFG4wgHNDQxtZy15/ZQp7HhjkpaGlp/eneMgtsu1dIlUA== + dependencies: + busboy "^1.6.0" + +ws@^8.2.2: + version "8.13.0" + resolved "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz" + integrity sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA== + +yargs-parser@^21.0.1: + version "21.1.1" + resolved "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz" + integrity sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==