From 97e46f6447358cae36025062f5c0e1df3720f312 Mon Sep 17 00:00:00 2001 From: Cynthia Foxwell Date: Sun, 14 Mar 2021 19:41:40 -0600 Subject: [PATCH] Start of rewrite --- .eslintignore | 14 + .eslintrc.js | 31 ++ .gitignore | 6 + .prettierrc | 5 + README.md | 2 + package.json | 30 + pnpm-lock.yaml | 1001 ++++++++++++++++++++++++++++++++++ src/index.js | 66 +++ src/lib/command.js | 39 ++ src/lib/commandDispatcher.js | 94 ++++ src/lib/misc.js | 25 + src/modules/general.js | 135 +++++ 12 files changed, 1448 insertions(+) create mode 100644 .eslintignore create mode 100644 .eslintrc.js create mode 100644 .gitignore create mode 100644 .prettierrc create mode 100644 README.md create mode 100644 package.json create mode 100644 pnpm-lock.yaml create mode 100644 src/index.js create mode 100644 src/lib/command.js create mode 100644 src/lib/commandDispatcher.js create mode 100644 src/lib/misc.js create mode 100644 src/modules/general.js diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000..9cff508 --- /dev/null +++ b/.eslintignore @@ -0,0 +1,14 @@ +pnpm-debug.log +dist +.cache +.tern-port +config.json +package-lock.json +README.html +*~ +\#*\# +node_modules +yarn-error.log +npm-error.log +/.vscode +/.idea diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000..7a87e3a --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,31 @@ +const OFF = 0; +// const WARN = 1; +const ERROR = 2; + +module.exports = { + extends: ["eslint:recommended"], + parserOptions: { + ecmaVersion: 2020, + }, + env: { + es6: true, + node: true, + }, + rules: { + indent: OFF, + semi: ERROR, + quotes: [ERROR, "double", {avoidEscape: true, allowTemplateLiterals: true}], + "no-empty": ERROR, + "array-callback-return": ERROR, + "consistent-return": ERROR, + eqeqeq: OFF, + "prefer-const": ERROR, + "no-unused-vars": [ERROR, {args: "none", varsIgnorePattern: "^_"}], + "no-console": OFF, + "no-debugger": OFF, + "require-atomic-updates": OFF, + }, + globals: { + hf: true, + }, +}; diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..102c959 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +node_modules/ + +config.json +config.prod.json +config.testing.json +apikeys.json \ No newline at end of file diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..15520fe --- /dev/null +++ b/.prettierrc @@ -0,0 +1,5 @@ +{ + "semi": true, + "bracketSpacing": false, + "endOfLine": "lf" +} diff --git a/README.md b/README.md new file mode 100644 index 0000000..4292a4e --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +# HiddenPhox +**This is the rewrite branch. For the main branch go [here](https://gitlab.com/Cynosphere/HiddenPhox/-/tree/master)** \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..c3e3cc1 --- /dev/null +++ b/package.json @@ -0,0 +1,30 @@ +{ + "name": "hiddenphox", + "version": "10.0.0", + "description": "Discord bot", + "main": "src/index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "git+https://gitlab.com/Cynosphere/HiddenPhox.git" + }, + "author": "Cynosphere", + "license": "MIT", + "bugs": { + "url": "https://gitlab.com/Cynosphere/HiddenPhox/issues" + }, + "homepage": "https://gitlab.com/Cynosphere/HiddenPhox#readme", + "dependencies": { + "colorcolor": "^1.1.1", + "eris": "github:abalabahaha/eris#dev", + "murmurhash": "^2.0.0", + "node-fetch": "^2.6.1", + "npmlog": "^4.1.2" + }, + "devDependencies": { + "eslint": "^7.22.0", + "prettier": "^2.2.1" + } +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml new file mode 100644 index 0000000..bcddfae --- /dev/null +++ b/pnpm-lock.yaml @@ -0,0 +1,1001 @@ +dependencies: + colorcolor: 1.1.1 + eris: github.com/abalabahaha/eris/db7da3891a89748e3f7b46efc8fc224df0a17c9a + murmurhash: 2.0.0 + node-fetch: 2.6.1 + npmlog: 4.1.2 +devDependencies: + eslint: 7.22.0 + prettier: 2.2.1 +lockfileVersion: 5.2 +packages: + /@babel/code-frame/7.12.11: + dependencies: + '@babel/highlight': 7.13.10 + dev: true + resolution: + integrity: sha512-Zt1yodBx1UcyiePMSkWnU4hPqhwq7hGi2nFL1LeA3EUl+q2LQx16MISgJ0+z7dnmgvP9QtIleuETGOiOH1RcIw== + /@babel/helper-validator-identifier/7.12.11: + dev: true + resolution: + integrity: sha512-np/lG3uARFybkoHokJUmf1QfEvRVCPbmQeUQpKow5cQ3xWrV9i3rUHodKDJPQfTVX61qKi+UdYk8kik84n7XOw== + /@babel/highlight/7.13.10: + dependencies: + '@babel/helper-validator-identifier': 7.12.11 + chalk: 2.4.2 + js-tokens: 4.0.0 + dev: true + resolution: + integrity: sha512-5aPpe5XQPzflQrFwL1/QoeHkP2MsA4JCntcXHRhEsdsfPVkvPi2w7Qix4iV7t5S/oC9OodGrggd8aco1g3SZFg== + /@eslint/eslintrc/0.4.0: + dependencies: + ajv: 6.12.6 + debug: 4.3.1 + espree: 7.3.1 + globals: 12.4.0 + ignore: 4.0.6 + import-fresh: 3.3.0 + js-yaml: 3.14.1 + minimatch: 3.0.4 + strip-json-comments: 3.1.1 + dev: true + engines: + node: ^10.12.0 || >=12.0.0 + resolution: + integrity: sha512-2ZPCc+uNbjV5ERJr+aKSPRwZgKd2z11x0EgLvb1PURmUrn9QNRXFqje0Ldq454PfAVyaJYyrDvvIKSFP4NnBog== + /acorn-jsx/5.3.1_acorn@7.4.1: + dependencies: + acorn: 7.4.1 + dev: true + peerDependencies: + acorn: ^6.0.0 || ^7.0.0 || ^8.0.0 + resolution: + integrity: sha512-K0Ptm/47OKfQRpNQ2J/oIN/3QYiK6FwW+eJbILhsdxh2WTLdl+30o8aGdTbm5JbffpFFAg/g+zi1E+jvJha5ng== + /acorn/7.4.1: + dev: true + engines: + node: '>=0.4.0' + hasBin: true + resolution: + integrity: sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A== + /ajv/6.12.6: + dependencies: + fast-deep-equal: 3.1.3 + fast-json-stable-stringify: 2.1.0 + json-schema-traverse: 0.4.1 + uri-js: 4.4.1 + dev: true + resolution: + integrity: sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g== + /ajv/7.2.1: + dependencies: + fast-deep-equal: 3.1.3 + json-schema-traverse: 1.0.0 + require-from-string: 2.0.2 + uri-js: 4.4.1 + dev: true + resolution: + integrity: sha512-+nu0HDv7kNSOua9apAVc979qd932rrZeb3WOvoiD31A/p1mIE5/9bN2027pE2rOPYEdS3UHzsvof4hY+lM9/WQ== + /ansi-colors/4.1.1: + dev: true + engines: + node: '>=6' + resolution: + integrity: sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA== + /ansi-regex/2.1.1: + dev: false + engines: + node: '>=0.10.0' + resolution: + integrity: sha1-w7M6te42DYbg5ijwRorn7yfWVN8= + /ansi-regex/5.0.0: + dev: true + engines: + node: '>=8' + resolution: + integrity: sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg== + /ansi-styles/3.2.1: + dependencies: + color-convert: 1.9.3 + dev: true + engines: + node: '>=4' + resolution: + integrity: sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA== + /ansi-styles/4.3.0: + dependencies: + color-convert: 2.0.1 + dev: true + engines: + node: '>=8' + resolution: + integrity: sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg== + /aproba/1.2.0: + dev: false + resolution: + integrity: sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw== + /are-we-there-yet/1.1.5: + dependencies: + delegates: 1.0.0 + readable-stream: 2.3.7 + dev: false + resolution: + integrity: sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w== + /argparse/1.0.10: + dependencies: + sprintf-js: 1.0.3 + dev: true + resolution: + integrity: sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg== + /astral-regex/2.0.0: + dev: true + engines: + node: '>=8' + resolution: + integrity: sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ== + /balanced-match/1.0.0: + dev: true + resolution: + integrity: sha1-ibTRmasr7kneFk6gK4nORi1xt2c= + /brace-expansion/1.1.11: + dependencies: + balanced-match: 1.0.0 + concat-map: 0.0.1 + dev: true + resolution: + integrity: sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA== + /callsites/3.1.0: + dev: true + engines: + node: '>=6' + resolution: + integrity: sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ== + /chalk/2.4.2: + dependencies: + ansi-styles: 3.2.1 + escape-string-regexp: 1.0.5 + supports-color: 5.5.0 + dev: true + engines: + node: '>=4' + resolution: + integrity: sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== + /chalk/4.1.0: + dependencies: + ansi-styles: 4.3.0 + supports-color: 7.2.0 + dev: true + engines: + node: '>=10' + resolution: + integrity: sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A== + /code-point-at/1.1.0: + dev: false + engines: + node: '>=0.10.0' + resolution: + integrity: sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c= + /color-convert/1.9.3: + dependencies: + color-name: 1.1.3 + dev: true + resolution: + integrity: sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg== + /color-convert/2.0.1: + dependencies: + color-name: 1.1.4 + dev: true + engines: + node: '>=7.0.0' + resolution: + integrity: sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ== + /color-name/1.1.3: + dev: true + resolution: + integrity: sha1-p9BVi9icQveV3UIyj3QIMcpTvCU= + /color-name/1.1.4: + resolution: + integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== + /colorcolor/1.1.1: + dependencies: + color-name: 1.1.4 + dev: false + resolution: + integrity: sha1-X34sRbCj2A1JKOCN9I6V/ck0RMU= + /concat-map/0.0.1: + dev: true + resolution: + integrity: sha1-2Klr13/Wjfd5OnMDajug1UBdR3s= + /console-control-strings/1.1.0: + dev: false + resolution: + integrity: sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4= + /core-util-is/1.0.2: + dev: false + resolution: + integrity: sha1-tf1UIgqivFq1eqtxQMlAdUUDwac= + /cross-spawn/7.0.3: + dependencies: + path-key: 3.1.1 + shebang-command: 2.0.0 + which: 2.0.2 + dev: true + engines: + node: '>= 8' + resolution: + integrity: sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w== + /debug/4.3.1: + dependencies: + ms: 2.1.2 + dev: true + engines: + node: '>=6.0' + peerDependencies: + supports-color: '*' + peerDependenciesMeta: + supports-color: + optional: true + resolution: + integrity: sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ== + /deep-is/0.1.3: + dev: true + resolution: + integrity: sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ= + /delegates/1.0.0: + dev: false + resolution: + integrity: sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o= + /doctrine/3.0.0: + dependencies: + esutils: 2.0.3 + dev: true + engines: + node: '>=6.0.0' + resolution: + integrity: sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w== + /emoji-regex/8.0.0: + dev: true + resolution: + integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== + /enquirer/2.3.6: + dependencies: + ansi-colors: 4.1.1 + dev: true + engines: + node: '>=8.6' + resolution: + integrity: sha512-yjNnPr315/FjS4zIsUxYguYUPP2e1NK4d7E7ZOLiyYCcbFBiTMyID+2wvm2w6+pZ/odMA7cRkjhsPbltwBOrLg== + /escape-string-regexp/1.0.5: + dev: true + engines: + node: '>=0.8.0' + resolution: + integrity: sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= + /eslint-scope/5.1.1: + dependencies: + esrecurse: 4.3.0 + estraverse: 4.3.0 + dev: true + engines: + node: '>=8.0.0' + resolution: + integrity: sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw== + /eslint-utils/2.1.0: + dependencies: + eslint-visitor-keys: 1.3.0 + dev: true + engines: + node: '>=6' + resolution: + integrity: sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg== + /eslint-visitor-keys/1.3.0: + dev: true + engines: + node: '>=4' + resolution: + integrity: sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ== + /eslint-visitor-keys/2.0.0: + dev: true + engines: + node: '>=10' + resolution: + integrity: sha512-QudtT6av5WXels9WjIM7qz1XD1cWGvX4gGXvp/zBn9nXG02D0utdU3Em2m/QjTnrsk6bBjmCygl3rmj118msQQ== + /eslint/7.22.0: + dependencies: + '@babel/code-frame': 7.12.11 + '@eslint/eslintrc': 0.4.0 + ajv: 6.12.6 + chalk: 4.1.0 + cross-spawn: 7.0.3 + debug: 4.3.1 + doctrine: 3.0.0 + enquirer: 2.3.6 + eslint-scope: 5.1.1 + eslint-utils: 2.1.0 + eslint-visitor-keys: 2.0.0 + espree: 7.3.1 + esquery: 1.4.0 + esutils: 2.0.3 + file-entry-cache: 6.0.1 + functional-red-black-tree: 1.0.1 + glob-parent: 5.1.2 + globals: 13.6.0 + ignore: 4.0.6 + import-fresh: 3.3.0 + imurmurhash: 0.1.4 + is-glob: 4.0.1 + js-yaml: 3.14.1 + json-stable-stringify-without-jsonify: 1.0.1 + levn: 0.4.1 + lodash: 4.17.21 + minimatch: 3.0.4 + natural-compare: 1.4.0 + optionator: 0.9.1 + progress: 2.0.3 + regexpp: 3.1.0 + semver: 7.3.4 + strip-ansi: 6.0.0 + strip-json-comments: 3.1.1 + table: 6.0.7 + text-table: 0.2.0 + v8-compile-cache: 2.3.0 + dev: true + engines: + node: ^10.12.0 || >=12.0.0 + hasBin: true + resolution: + integrity: sha512-3VawOtjSJUQiiqac8MQc+w457iGLfuNGLFn8JmF051tTKbh5/x/0vlcEj8OgDCaw7Ysa2Jn8paGshV7x2abKXg== + /espree/7.3.1: + dependencies: + acorn: 7.4.1 + acorn-jsx: 5.3.1_acorn@7.4.1 + eslint-visitor-keys: 1.3.0 + dev: true + engines: + node: ^10.12.0 || >=12.0.0 + resolution: + integrity: sha512-v3JCNCE64umkFpmkFGqzVKsOT0tN1Zr+ueqLZfpV1Ob8e+CEgPWa+OxCoGH3tnhimMKIaBm4m/vaRpJ/krRz2g== + /esprima/4.0.1: + dev: true + engines: + node: '>=4' + hasBin: true + resolution: + integrity: sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== + /esquery/1.4.0: + dependencies: + estraverse: 5.2.0 + dev: true + engines: + node: '>=0.10' + resolution: + integrity: sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w== + /esrecurse/4.3.0: + dependencies: + estraverse: 5.2.0 + dev: true + engines: + node: '>=4.0' + resolution: + integrity: sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag== + /estraverse/4.3.0: + dev: true + engines: + node: '>=4.0' + resolution: + integrity: sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw== + /estraverse/5.2.0: + dev: true + engines: + node: '>=4.0' + resolution: + integrity: sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ== + /esutils/2.0.3: + dev: true + engines: + node: '>=0.10.0' + resolution: + integrity: sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g== + /fast-deep-equal/3.1.3: + dev: true + resolution: + integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== + /fast-json-stable-stringify/2.1.0: + dev: true + resolution: + integrity: sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw== + /fast-levenshtein/2.0.6: + dev: true + resolution: + integrity: sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc= + /file-entry-cache/6.0.1: + dependencies: + flat-cache: 3.0.4 + dev: true + engines: + node: ^10.12.0 || >=12.0.0 + resolution: + integrity: sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg== + /flat-cache/3.0.4: + dependencies: + flatted: 3.1.1 + rimraf: 3.0.2 + dev: true + engines: + node: ^10.12.0 || >=12.0.0 + resolution: + integrity: sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg== + /flatted/3.1.1: + dev: true + resolution: + integrity: sha512-zAoAQiudy+r5SvnSw3KJy5os/oRJYHzrzja/tBDqrZtNhUw8bt6y8OBzMWcjWr+8liV8Eb6yOhw8WZ7VFZ5ZzA== + /fs.realpath/1.0.0: + dev: true + resolution: + integrity: sha1-FQStJSMVjKpA20onh8sBQRmU6k8= + /functional-red-black-tree/1.0.1: + dev: true + resolution: + integrity: sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc= + /gauge/2.7.4: + dependencies: + aproba: 1.2.0 + console-control-strings: 1.1.0 + has-unicode: 2.0.1 + object-assign: 4.1.1 + signal-exit: 3.0.3 + string-width: 1.0.2 + strip-ansi: 3.0.1 + wide-align: 1.1.3 + dev: false + resolution: + integrity: sha1-LANAXHU4w51+s3sxcCLjJfsBi/c= + /glob-parent/5.1.2: + dependencies: + is-glob: 4.0.1 + dev: true + engines: + node: '>= 6' + resolution: + integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow== + /glob/7.1.6: + dependencies: + fs.realpath: 1.0.0 + inflight: 1.0.6 + inherits: 2.0.4 + minimatch: 3.0.4 + once: 1.4.0 + path-is-absolute: 1.0.1 + dev: true + resolution: + integrity: sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA== + /globals/12.4.0: + dependencies: + type-fest: 0.8.1 + dev: true + engines: + node: '>=8' + resolution: + integrity: sha512-BWICuzzDvDoH54NHKCseDanAhE3CeDorgDL5MT6LMXXj2WCnd9UC2szdk4AWLfjdgNBCXLUanXYcpBBKOSWGwg== + /globals/13.6.0: + dependencies: + type-fest: 0.20.2 + dev: true + engines: + node: '>=8' + resolution: + integrity: sha512-YFKCX0SiPg7l5oKYCJ2zZGxcXprVXHcSnVuvzrT3oSENQonVLqM5pf9fN5dLGZGyCjhw8TN8Btwe/jKnZ0pjvQ== + /has-flag/3.0.0: + dev: true + engines: + node: '>=4' + resolution: + integrity: sha1-tdRU3CGZriJWmfNGfloH87lVuv0= + /has-flag/4.0.0: + dev: true + engines: + node: '>=8' + resolution: + integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== + /has-unicode/2.0.1: + dev: false + resolution: + integrity: sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk= + /ignore/4.0.6: + dev: true + engines: + node: '>= 4' + resolution: + integrity: sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg== + /import-fresh/3.3.0: + dependencies: + parent-module: 1.0.1 + resolve-from: 4.0.0 + dev: true + engines: + node: '>=6' + resolution: + integrity: sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw== + /imurmurhash/0.1.4: + dev: true + engines: + node: '>=0.8.19' + resolution: + integrity: sha1-khi5srkoojixPcT7a21XbyMUU+o= + /inflight/1.0.6: + dependencies: + once: 1.4.0 + wrappy: 1.0.2 + dev: true + resolution: + integrity: sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk= + /inherits/2.0.4: + resolution: + integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== + /is-extglob/2.1.1: + dev: true + engines: + node: '>=0.10.0' + resolution: + integrity: sha1-qIwCU1eR8C7TfHahueqXc8gz+MI= + /is-fullwidth-code-point/1.0.0: + dependencies: + number-is-nan: 1.0.1 + dev: false + engines: + node: '>=0.10.0' + resolution: + integrity: sha1-754xOG8DGn8NZDr4L95QxFfvAMs= + /is-fullwidth-code-point/3.0.0: + dev: true + engines: + node: '>=8' + resolution: + integrity: sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg== + /is-glob/4.0.1: + dependencies: + is-extglob: 2.1.1 + dev: true + engines: + node: '>=0.10.0' + resolution: + integrity: sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg== + /isarray/1.0.0: + dev: false + resolution: + integrity: sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE= + /isexe/2.0.0: + dev: true + resolution: + integrity: sha1-6PvzdNxVb/iUehDcsFctYz8s+hA= + /js-tokens/4.0.0: + dev: true + resolution: + integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== + /js-yaml/3.14.1: + dependencies: + argparse: 1.0.10 + esprima: 4.0.1 + dev: true + hasBin: true + resolution: + integrity: sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g== + /json-schema-traverse/0.4.1: + dev: true + resolution: + integrity: sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg== + /json-schema-traverse/1.0.0: + dev: true + resolution: + integrity: sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug== + /json-stable-stringify-without-jsonify/1.0.1: + dev: true + resolution: + integrity: sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE= + /levn/0.4.1: + dependencies: + prelude-ls: 1.2.1 + type-check: 0.4.0 + dev: true + engines: + node: '>= 0.8.0' + resolution: + integrity: sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ== + /lodash/4.17.21: + dev: true + resolution: + integrity: sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== + /lru-cache/6.0.0: + dependencies: + yallist: 4.0.0 + dev: true + engines: + node: '>=10' + resolution: + integrity: sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA== + /minimatch/3.0.4: + dependencies: + brace-expansion: 1.1.11 + dev: true + resolution: + integrity: sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA== + /ms/2.1.2: + dev: true + resolution: + integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== + /murmurhash/2.0.0: + dev: false + resolution: + integrity: sha512-Uo7ZHw+PLe2Q8/qbPIVYxAaoi+TYGZwu1a8ryeeASRXJLRSaLCblAGfjh02eu4+/9aUJBpkHXZv42AXmzOW2kw== + /natural-compare/1.4.0: + dev: true + resolution: + integrity: sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc= + /node-fetch/2.6.1: + dev: false + engines: + node: 4.x || >=6.0.0 + resolution: + integrity: sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw== + /npmlog/4.1.2: + dependencies: + are-we-there-yet: 1.1.5 + console-control-strings: 1.1.0 + gauge: 2.7.4 + set-blocking: 2.0.0 + dev: false + resolution: + integrity: sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg== + /number-is-nan/1.0.1: + dev: false + engines: + node: '>=0.10.0' + resolution: + integrity: sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0= + /object-assign/4.1.1: + dev: false + engines: + node: '>=0.10.0' + resolution: + integrity: sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM= + /once/1.4.0: + dependencies: + wrappy: 1.0.2 + dev: true + resolution: + integrity: sha1-WDsap3WWHUsROsF9nFC6753Xa9E= + /optionator/0.9.1: + dependencies: + deep-is: 0.1.3 + fast-levenshtein: 2.0.6 + levn: 0.4.1 + prelude-ls: 1.2.1 + type-check: 0.4.0 + word-wrap: 1.2.3 + dev: true + engines: + node: '>= 0.8.0' + resolution: + integrity: sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw== + /opusscript/0.0.7: + dev: false + optional: true + resolution: + integrity: sha512-DcBadTdYTUuH9zQtepsLjQn4Ll6rs3dmeFvN+SD0ThPnxRBRm/WC1zXWPg+wgAJimB784gdZvUMA57gDP7FdVg== + /parent-module/1.0.1: + dependencies: + callsites: 3.1.0 + dev: true + engines: + node: '>=6' + resolution: + integrity: sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g== + /path-is-absolute/1.0.1: + dev: true + engines: + node: '>=0.10.0' + resolution: + integrity: sha1-F0uSaHNVNP+8es5r9TpanhtcX18= + /path-key/3.1.1: + dev: true + engines: + node: '>=8' + resolution: + integrity: sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q== + /prelude-ls/1.2.1: + dev: true + engines: + node: '>= 0.8.0' + resolution: + integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g== + /prettier/2.2.1: + dev: true + engines: + node: '>=10.13.0' + hasBin: true + resolution: + integrity: sha512-PqyhM2yCjg/oKkFPtTGUojv7gnZAoG80ttl45O6x2Ug/rMJw4wcc9k6aaf2hibP7BGVCCM33gZoGjyvt9mm16Q== + /process-nextick-args/2.0.1: + dev: false + resolution: + integrity: sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag== + /progress/2.0.3: + dev: true + engines: + node: '>=0.4.0' + resolution: + integrity: sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA== + /punycode/2.1.1: + dev: true + engines: + node: '>=6' + resolution: + integrity: sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A== + /readable-stream/2.3.7: + dependencies: + core-util-is: 1.0.2 + inherits: 2.0.4 + isarray: 1.0.0 + process-nextick-args: 2.0.1 + safe-buffer: 5.1.2 + string_decoder: 1.1.1 + util-deprecate: 1.0.2 + dev: false + resolution: + integrity: sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw== + /regexpp/3.1.0: + dev: true + engines: + node: '>=8' + resolution: + integrity: sha512-ZOIzd8yVsQQA7j8GCSlPGXwg5PfmA1mrq0JP4nGhh54LaKN3xdai/vHUDu74pKwV8OxseMS65u2NImosQcSD0Q== + /require-from-string/2.0.2: + dev: true + engines: + node: '>=0.10.0' + resolution: + integrity: sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw== + /resolve-from/4.0.0: + dev: true + engines: + node: '>=4' + resolution: + integrity: sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g== + /rimraf/3.0.2: + dependencies: + glob: 7.1.6 + dev: true + hasBin: true + resolution: + integrity: sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA== + /safe-buffer/5.1.2: + dev: false + resolution: + integrity: sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== + /semver/7.3.4: + dependencies: + lru-cache: 6.0.0 + dev: true + engines: + node: '>=10' + hasBin: true + resolution: + integrity: sha512-tCfb2WLjqFAtXn4KEdxIhalnRtoKFN7nAwj0B3ZXCbQloV2tq5eDbcTmT68JJD3nRJq24/XgxtQKFIpQdtvmVw== + /set-blocking/2.0.0: + dev: false + resolution: + integrity: sha1-BF+XgtARrppoA93TgrJDkrPYkPc= + /shebang-command/2.0.0: + dependencies: + shebang-regex: 3.0.0 + dev: true + engines: + node: '>=8' + resolution: + integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA== + /shebang-regex/3.0.0: + dev: true + engines: + node: '>=8' + resolution: + integrity: sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== + /signal-exit/3.0.3: + dev: false + resolution: + integrity: sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA== + /slice-ansi/4.0.0: + dependencies: + ansi-styles: 4.3.0 + astral-regex: 2.0.0 + is-fullwidth-code-point: 3.0.0 + dev: true + engines: + node: '>=10' + resolution: + integrity: sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ== + /sprintf-js/1.0.3: + dev: true + resolution: + integrity: sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw= + /string-width/1.0.2: + dependencies: + code-point-at: 1.1.0 + is-fullwidth-code-point: 1.0.0 + strip-ansi: 3.0.1 + dev: false + engines: + node: '>=0.10.0' + resolution: + integrity: sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M= + /string-width/4.2.2: + dependencies: + emoji-regex: 8.0.0 + is-fullwidth-code-point: 3.0.0 + strip-ansi: 6.0.0 + dev: true + engines: + node: '>=8' + resolution: + integrity: sha512-XBJbT3N4JhVumXE0eoLU9DCjcaF92KLNqTmFCnG1pf8duUxFGwtP6AD6nkjw9a3IdiRtL3E2w3JDiE/xi3vOeA== + /string_decoder/1.1.1: + dependencies: + safe-buffer: 5.1.2 + dev: false + resolution: + integrity: sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg== + /strip-ansi/3.0.1: + dependencies: + ansi-regex: 2.1.1 + dev: false + engines: + node: '>=0.10.0' + resolution: + integrity: sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8= + /strip-ansi/6.0.0: + dependencies: + ansi-regex: 5.0.0 + dev: true + engines: + node: '>=8' + resolution: + integrity: sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w== + /strip-json-comments/3.1.1: + dev: true + engines: + node: '>=8' + resolution: + integrity: sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== + /supports-color/5.5.0: + dependencies: + has-flag: 3.0.0 + dev: true + engines: + node: '>=4' + resolution: + integrity: sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow== + /supports-color/7.2.0: + dependencies: + has-flag: 4.0.0 + dev: true + engines: + node: '>=8' + resolution: + integrity: sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw== + /table/6.0.7: + dependencies: + ajv: 7.2.1 + lodash: 4.17.21 + slice-ansi: 4.0.0 + string-width: 4.2.2 + dev: true + engines: + node: '>=10.0.0' + resolution: + integrity: sha512-rxZevLGTUzWna/qBLObOe16kB2RTnnbhciwgPbMMlazz1yZGVEgnZK762xyVdVznhqxrfCeBMmMkgOOaPwjH7g== + /text-table/0.2.0: + dev: true + resolution: + integrity: sha1-f17oI66AUgfACvLfSoTsP8+lcLQ= + /tweetnacl/1.0.3: + dev: false + optional: true + resolution: + integrity: sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw== + /type-check/0.4.0: + dependencies: + prelude-ls: 1.2.1 + dev: true + engines: + node: '>= 0.8.0' + resolution: + integrity: sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew== + /type-fest/0.20.2: + dev: true + engines: + node: '>=10' + resolution: + integrity: sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ== + /type-fest/0.8.1: + dev: true + engines: + node: '>=8' + resolution: + integrity: sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA== + /uri-js/4.4.1: + dependencies: + punycode: 2.1.1 + dev: true + resolution: + integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg== + /util-deprecate/1.0.2: + dev: false + resolution: + integrity: sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8= + /v8-compile-cache/2.3.0: + dev: true + resolution: + integrity: sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA== + /which/2.0.2: + dependencies: + isexe: 2.0.0 + dev: true + engines: + node: '>= 8' + hasBin: true + resolution: + integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA== + /wide-align/1.1.3: + dependencies: + string-width: 1.0.2 + dev: false + resolution: + integrity: sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA== + /word-wrap/1.2.3: + dev: true + engines: + node: '>=0.10.0' + resolution: + integrity: sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ== + /wrappy/1.0.2: + dev: true + resolution: + integrity: sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= + /ws/7.4.4: + dev: false + engines: + node: '>=8.3.0' + peerDependencies: + bufferutil: ^4.0.1 + utf-8-validate: ^5.0.2 + peerDependenciesMeta: + bufferutil: + optional: true + utf-8-validate: + optional: true + resolution: + integrity: sha512-Qm8k8ojNQIMx7S+Zp8u/uHOx7Qazv3Yv4q68MiWWWOJhiwG5W3x7iqmRtJo8xxrciZUY4vRxUTJCKuRnF28ZZw== + /yallist/4.0.0: + dev: true + resolution: + integrity: sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== + github.com/abalabahaha/eris/db7da3891a89748e3f7b46efc8fc224df0a17c9a: + dependencies: + ws: 7.4.4 + dev: false + engines: + node: '>=8.0.0' + name: eris + optionalDependencies: + opusscript: 0.0.7 + tweetnacl: 1.0.3 + resolution: + tarball: https://codeload.github.com/abalabahaha/eris/tar.gz/db7da3891a89748e3f7b46efc8fc224df0a17c9a + version: 0.14.0 +specifiers: + colorcolor: ^1.1.1 + eris: github:abalabahaha/eris#dev + eslint: ^7.22.0 + murmurhash: ^2.0.0 + node-fetch: ^2.6.1 + npmlog: ^4.1.2 + prettier: ^2.2.1 diff --git a/src/index.js b/src/index.js new file mode 100644 index 0000000..c85f42c --- /dev/null +++ b/src/index.js @@ -0,0 +1,66 @@ +const Eris = require("eris"); +const logger = require("npmlog"); +const fs = require("fs"); +const {resolve} = require("path"); + +const config = require("../config.json"); +const Command = require("./lib/command.js"); +const CommandDispatcher = require("./lib/commandDispatcher.js"); + +const bot = new Eris(config.token, { + defaultImageFormat: "png", + defaultImageSize: 1024, +}); + +const commands = new Eris.Collection(); + +function registerCommand(cmdObj) { + if (cmdObj instanceof Command) { + commands.set(cmdObj.name, cmdObj); + const aliases = cmdObj.getAliases(); + logger.info( + "hf:cmd", + "Registered command '%s'%s", + cmdObj.name, + aliases.length > 0 ? ` (aliases: ${aliases.join(", ")})` : "" + ); + } +} + +global.hf = { + bot, + config, + commands, + registerCommand, +}; + +for (const file of fs.readdirSync(resolve(__dirname, "modules"))) { + require(resolve(__dirname, "modules", file)); + logger.info("hf:modules", "Loaded module: '%s'", file); +} + +bot.on("messageCreate", CommandDispatcher); +bot.on("messageUpdate", (msg) => { + const oneDay = Date.now() - 86400000; + if (msg.timestamp > oneDay && !msg.hasRan) { + CommandDispatcher(msg); + } +}); + +bot.on("ready", async () => { + logger.info("hf:main", "Connected to Discord."); + logger.info( + "hf:main", + "Logged in as: %s#%s (%s)", + bot.user.username, + bot.user.discriminator, + bot.user.id + ); + + const channel = await bot.getDMChannel(config.owner_id); + if (channel) { + channel.createMessage(":white_check_mark: Loaded HiddenPhox."); + } +}); + +bot.connect(); diff --git a/src/lib/command.js b/src/lib/command.js new file mode 100644 index 0000000..d671ba3 --- /dev/null +++ b/src/lib/command.js @@ -0,0 +1,39 @@ +const {Permissions} = require("eris/lib/Constants"); + +class Command { + constructor(name) { + this.name = name; + this.aliases = []; + this.permissions = {}; + this.helpText = "No description provided."; + this.category = "unsorted"; + } + + addAlias(alias) { + this.aliases.push(alias); + } + getAliases() { + return this.aliases; + } + hasAlias(alias) { + return this.aliases.includes(alias); + } + + addPermission(permission) { + if (Permissions[permission]) { + this.permissions[permission] = true; + } + } + removePermission(permission) { + delete this.permissions[permission]; + } + getPermissions() { + return this.permissions; + } + + callback() { + return "Callback not overwritten."; + } +} + +module.exports = Command; diff --git a/src/lib/commandDispatcher.js b/src/lib/commandDispatcher.js new file mode 100644 index 0000000..9805243 --- /dev/null +++ b/src/lib/commandDispatcher.js @@ -0,0 +1,94 @@ +const logger = require("npmlog"); + +function parseArguments(str) { + return str.match(/\\?.|^$/g).reduce( + (p, c) => { + if (c === '"') { + p.quote ^= 1; + } else if (!p.quote && c === " ") { + p.a.push(""); + } else { + p.a[p.a.length - 1] += c.replace(/\\(.)/, "$1"); + } + + return p; + }, + {a: [""]} + ).a; +} + +function runCommand(msg, cmd, line, args) { + let cmdObj = hf.commands.get(cmd); + if (!cmdObj) { + for (const c of hf.commands.values()) { + if (c.hasAlias(cmd)) { + cmdObj = c; + break; + } + } + } + if (!cmdObj) return null; + + if (cmdObj.ownerOnly && msg.author.id != hf.config.owner_id) { + return "No\n\nSent from my iPhone."; + } + + if (cmdObj.elevatedOnly && !hf.config.elevated.includes(msg.author.id)) { + return "No\n\nSent from my iPhone."; + } + + try { + return cmdObj.callback(msg, line, ...args); + } catch (err) { + logger.error("hf:cmd:" + cmd, err); + return ":warning: An internal error occurred."; + } +} + +function CommandDispatcher(msg) { + let str = msg.content; + let inCommand = false; + + const prefix1 = hf.config.prefix; + const prefix2 = `<@${hf.bot.user.id}> `; + const prefix3 = `<@!${hf.bot.user.id}> `; + + if (str.startsWith(prefix1)) { + str = str.substring(prefix1.length); + inCommand = true; + } else if (str.startsWith(prefix2)) { + str = str.substring(prefix2.length); + inCommand = true; + } else if (str.startsWith(prefix3)) { + str = str.substring(prefix3.length); + inCommand = true; + } + + if (inCommand) { + let line = str.split(" "); + let [cmd] = line.splice(0, 1); + cmd = cmd.toLowerCase(); + line = line.join(" "); + + const args = parseArguments(line); + + const response = runCommand(msg, cmd, line, args); + if (response) { + msg.channel.createMessage( + Object.assign( + typeof response === "string" ? {content: response} : response, + { + allowedMentions: { + repliedUser: false, + }, + messageReferenceID: msg.id, + } + ), + response.file + ); + } + msg.hasRan = true; + } +} + +module.exports = CommandDispatcher; diff --git a/src/lib/misc.js b/src/lib/misc.js new file mode 100644 index 0000000..ef79c0b --- /dev/null +++ b/src/lib/misc.js @@ -0,0 +1,25 @@ +const {v3} = require("murmurhash"); +const colorcolor = require("colorcolor"); + +function pastelize(id) { + const hue = v3(id) % 360; + const hex = colorcolor(`hsl(${hue},75%,60%)`, "hex"); + return parseInt(hex.substring(1), 16); +} + +function getTopColor(msg, id, fallback = 0x7289da) { + if (!msg.channel.guild) return fallback; + + const roles = msg.channel.guild.members + .get(id) + .roles.map((role) => msg.channel.guild.roles.get(role)) + .filter((role) => role.color); + roles.sort((a, b) => b.position - a.position); + + return roles[0]?.color || fallback; +} + +module.exports = { + pastelize, + getTopColor, +}; diff --git a/src/modules/general.js b/src/modules/general.js new file mode 100644 index 0000000..c1b149e --- /dev/null +++ b/src/modules/general.js @@ -0,0 +1,135 @@ +const Command = require("../lib/command.js"); +const CATEGORY = "general"; +const {pastelize, getTopColor} = require("../lib/misc.js"); + +const help = new Command("help"); +help.category = CATEGORY; +help.helpText = "Lists all commands"; +help.usage = "[command] or [--category]"; +help.callback = function (msg, line) { + const color = getTopColor(msg, hf.bot.user.id, pastelize(hf.bot.user.id)); + const sorted = {}; + + for (const cmd of hf.commands.values()) { + const cat = cmd.category.toLowerCase(); + if (!sorted[cat]) { + sorted[cat] = []; + } + sorted[cat].push(cmd); + } + + if (line == "") { + const embed = { + title: "HiddenPhox Help", + color, + fields: [], + }; + + for (const cat in sorted) { + embed.fields.push({ + name: cat.toUpperCase().charAt(0) + cat.toLowerCase().substring(1), + value: `${sorted[cat].length} Commands\n\`${ + hf.config.prefix + }help --${cat.toLowerCase()}\``, + inline: true, + }); + } + + return {embed}; + } else if (line.startsWith("--")) { + const cat = line.replace("--", "").toLowerCase().trim(); + + if (sorted[cat]) { + const embed = { + title: `HiddenPhox Help: Category > ${ + cat.toUpperCase().charAt(0) + cat.toLowerCase().substring(1) + }`, + color, + fields: [], + }; + + for (const cmd of sorted[cat]) { + embed.fields.push({ + name: hf.config.prefix + cmd.name, + value: cmd.helpText, + inline: true, + }); + } + + return {embed}; + } else { + return "Category not found."; + } + } else { + let cmd = hf.commands.get(line.toLowerCase().trim()); + if (!cmd) { + for (const c of hf.commands.values()) { + if (c.hasAlias(line.toLowerCase().trim())) { + cmd = c; + break; + } + } + } + + if (cmd) { + const aliases = cmd.getAliases(); + + const embed = { + title: `HiddenPhox Help: Command > \`${hf.config.prefix}${cmd.name}\``, + color, + description: cmd.helpText, + fields: [ + { + name: "Category", + value: + cmd.category.toUpperCase().charAt(0) + + cmd.category.toLowerCase().substring(1), + inline: true, + }, + ], + }; + if (aliases.length > 0) { + embed.fields.push({ + name: "Aliases", + value: aliases.join(", "), + inline: true, + }); + } + if (cmd.usage) { + embed.fields.push({ + name: "Usage", + value: `${hf.config.prefix}${cmd.name} ${cmd.usage}`, + inline: true, + }); + } + + if (cmd.description) { + embed.fields.push({ + name: "Full Description", + value: cmd.description, + }); + } + + return {embed}; + } else { + return "Command not found."; + } + } +}; +hf.registerCommand(help); + +const ping = new Command("ping"); +ping.category = CATEGORY; +ping.helpText = "Pong"; +ping.description = "Measures response times to Discord."; +ping.addAlias("p"); +ping.callback = async function (msg) { + const newMsg = await msg.channel.createMessage("Pong."); + const rtt = Math.floor(newMsg.timestamp - msg.timestamp); + const gateway = hf.bot.shards.get( + hf.bot.guildShardMap[hf.bot.channelGuildMap[msg.channel.id]] || 0 + ).latency; + + newMsg.edit(`Pong. RTT: \`${rtt}ms\`, Gateway: \`${gateway}ms\``); +}; +hf.registerCommand(ping);