From 26741e8c6c5c65a10fb50bbfedef7e2318c819f1 Mon Sep 17 00:00:00 2001 From: Essem Date: Wed, 2 Feb 2022 11:01:33 -0600 Subject: [PATCH] Rework pagination, fix caption2 font, some logging fixes, updated packages --- api/index.js | 2 +- natives/caption2.cc | 3 +- package-lock.json | 377 +++++++++++++------------- package.json | 10 +- utils/image.js | 6 +- utils/pagination/awaitinteractions.js | 20 +- utils/pagination/pagination.js | 70 +++-- 7 files changed, 249 insertions(+), 239 deletions(-) diff --git a/api/index.js b/api/index.js index 362e270..88a39c9 100644 --- a/api/index.js +++ b/api/index.js @@ -68,7 +68,7 @@ const acceptJob = (id, sock) => { }, sock).then(() => { log(`Job ${id} has finished`); }).catch((err) => { - error(`Error on job ${id}:`, err, job.num); + error(`Error on job ${id}: ${err}`, job.num); const newJob = jobs.get(id); if (!newJob.tag) { newJob.error = err.message; diff --git a/natives/caption2.cc b/natives/caption2.cc index 84c0c38..2e7762d 100644 --- a/natives/caption2.cc +++ b/natives/caption2.cc @@ -42,7 +42,6 @@ Napi::Value CaptionTwo(const Napi::CallbackInfo &info) { caption_image.fontPointsize(width / 17); caption_image.read("pango:" + caption + ""); caption_image.extent(Geometry(width, caption_image.rows() + (width / 25)), Magick::CenterGravity); @@ -89,4 +88,4 @@ Napi::Value CaptionTwo(const Napi::CallbackInfo &info) { } catch (...) { throw Napi::Error::New(env, "Unknown error"); } -} \ No newline at end of file +} diff --git a/package-lock.json b/package-lock.json index 9d96f2e..09358b7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,17 +12,17 @@ "@top-gg/sdk": "^3.1.1", "cmake-js": "^6.3.0", "cowsay2": "^2.0.4", - "dotenv": "^10.0.0", + "dotenv": "^15.0.0", "emoji-regex": "^10.0.0", "eris": "^0.16.1", "eris-fleet": "^1.0.0", - "file-type": "^16.1.0", + "file-type": "^17.1.1", "format-duration": "^1.4.0", "jsqr": "^1.3.1", "lavacord": "^1.1.9", - "node-addon-api": "^4.2.0", + "node-addon-api": "^4.3.0", "node-emoji": "^1.10.0", - "node-fetch": "^3.1.1", + "node-fetch": "^3.2.0", "qrcode": "^1.4.4", "sharp": "^0.29.3", "winston": "^3.3.3" @@ -35,7 +35,7 @@ "@babel/eslint-plugin": "^7.13.0", "@babel/plugin-proposal-class-properties": "^7.13.0", "eslint": "^8.2.0", - "eslint-plugin-unicorn": "^38.0.1" + "eslint-plugin-unicorn": "^40.1.0" }, "engines": { "node": ">=15" @@ -67,6 +67,7 @@ "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.16.8.tgz", "integrity": "sha512-m7OkX0IdKLKPpBlJtF561YJal5y/jyI5fNfWbPxh2D/nbzzGI4qRyrD8xO2jB24u7l+5I2a43scCG2IrfjC50Q==", "dev": true, + "peer": true, "engines": { "node": ">=6.9.0" } @@ -76,6 +77,7 @@ "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.16.12.tgz", "integrity": "sha512-dK5PtG1uiN2ikk++5OzSYsitZKny4wOCD0nrO4TqnW4BVBTQ2NGS3NgilvT/TEyxTST7LNyWV/T4tXDoD3fOgg==", "dev": true, + "peer": true, "dependencies": { "@babel/code-frame": "^7.16.7", "@babel/generator": "^7.16.8", @@ -166,6 +168,7 @@ "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.16.7.tgz", "integrity": "sha512-mGojBwIWcwGD6rfqgRXVlVYmPAv7eOpIemUG3dGnDdCY4Pae70ROij3XmfrH6Fa1h1aiDylpglbZyktfzyo/hA==", "dev": true, + "peer": true, "dependencies": { "@babel/compat-data": "^7.16.4", "@babel/helper-validator-option": "^7.16.7", @@ -267,6 +270,7 @@ "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.16.7.tgz", "integrity": "sha512-LVtS6TqjJHFc+nYeITRo6VLXve70xmq7wPhWTqDJusJEgGmkAACWwMiTNrvfoQo6hEhFwAIixNkvB0jPXDL8Wg==", "dev": true, + "peer": true, "dependencies": { "@babel/types": "^7.16.7" }, @@ -279,6 +283,7 @@ "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.16.7.tgz", "integrity": "sha512-gaqtLDxJEFCeQbYp9aLAefjhkKdjKcdh6DB7jniIGU3Pz52WAmP268zK0VgPz9hUNkMSYeH976K2/Y6yPadpng==", "dev": true, + "peer": true, "dependencies": { "@babel/helper-environment-visitor": "^7.16.7", "@babel/helper-module-imports": "^7.16.7", @@ -335,6 +340,7 @@ "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.16.7.tgz", "integrity": "sha512-ZIzHVyoeLMvXMN/vok/a4LWRy8G2v205mNP0XOuf9XRLyX5/u9CnVulUtDgUTama3lT+bf/UqucuZjqiGuTS1g==", "dev": true, + "peer": true, "dependencies": { "@babel/types": "^7.16.7" }, @@ -368,6 +374,7 @@ "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.16.7.tgz", "integrity": "sha512-TRtenOuRUVo9oIQGPC5G9DgK4743cdxvtOw0weQNpZXaS16SCBi5MNjZF8vba3ETURjZpTbVn7Vvcf2eAwFozQ==", "dev": true, + "peer": true, "engines": { "node": ">=6.9.0" } @@ -377,6 +384,7 @@ "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.16.7.tgz", "integrity": "sha512-9ZDoqtfY7AuEOt3cxchfii6C7GDyyMBffktR5B2jvWv8u2+efwvpnVKXMWzNehqy68tKgAfSwfdw/lWpthS2bw==", "dev": true, + "peer": true, "dependencies": { "@babel/template": "^7.16.7", "@babel/traverse": "^7.16.7", @@ -861,6 +869,7 @@ "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.19.1.tgz", "integrity": "sha512-u2tbbG5PdKRTUoctO3NBD8FQ5HdPh1ZXPHzp1rwaa5jTc+RV9/+RlWiAIKmjRPQF+xbGM9Kklj5bZQFa2s/38A==", "dev": true, + "peer": true, "dependencies": { "caniuse-lite": "^1.0.30001286", "electron-to-chromium": "^1.4.17", @@ -983,10 +992,11 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001303", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001303.tgz", - "integrity": "sha512-/Mqc1oESndUNszJP0kx0UaQU9kEv9nNtJ7Kn8AdA0mNnH8eR1cj0kG+NbNuC1Wq/b21eA8prhKRA3bbkjONegQ==", + "version": "1.0.30001304", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001304.tgz", + "integrity": "sha512-bdsfZd6K6ap87AGqSHJP/s1V+U6Z5lyrcbBu3ovbCCf8cSYpwTtGrCBObMpJqwxfTbLW6YTIdbb1jEeTelcpYQ==", "dev": true, + "peer": true, "funding": { "type": "opencollective", "url": "https://opencollective.com/browserslist" @@ -1138,12 +1148,12 @@ } }, "node_modules/color": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/color/-/color-3.2.1.tgz", - "integrity": "sha512-aBl7dZI9ENN6fUGC7mWpMTPNHmWUSNan9tuWN6ahh5ZLNk9baLJOnSMlrQkHcrfFgz2/RigjUVAjdx36VcemKA==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/color/-/color-4.2.0.tgz", + "integrity": "sha512-hHTcrbvEnGjC7WBMk6ibQWFVDgEFTVmjrz2Q5HlU6ltwxv0JJN2Z8I7uRbWeQLF04dikxs8zgyZkazRJvSMtyQ==", "dependencies": { - "color-convert": "^1.9.3", - "color-string": "^1.6.0" + "color-convert": "^2.0.1", + "color-string": "^1.9.0" } }, "node_modules/color-convert": { @@ -1168,6 +1178,22 @@ "simple-swizzle": "^0.2.2" } }, + "node_modules/color/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, "node_modules/colors": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz", @@ -1185,6 +1211,15 @@ "text-hex": "1.0.x" } }, + "node_modules/colorspace/node_modules/color": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/color/-/color-3.2.1.tgz", + "integrity": "sha512-aBl7dZI9ENN6fUGC7mWpMTPNHmWUSNan9tuWN6ahh5ZLNk9baLJOnSMlrQkHcrfFgz2/RigjUVAjdx36VcemKA==", + "dependencies": { + "color-convert": "^1.9.3", + "color-string": "^1.6.0" + } + }, "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", @@ -1200,6 +1235,7 @@ "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.8.0.tgz", "integrity": "sha512-+OQdjP49zViI/6i7nIJpA8rAl4sV/JdPfU9nZs3VqOwGIgizICvuN2ru6fMd+4llL0tar18UYJXfZ/TWtmhUjA==", "dev": true, + "peer": true, "dependencies": { "safe-buffer": "~5.1.1" } @@ -1351,11 +1387,11 @@ } }, "node_modules/dotenv": { - "version": "10.0.0", - "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-10.0.0.tgz", - "integrity": "sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q==", + "version": "15.0.0", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-15.0.0.tgz", + "integrity": "sha512-/l1sXXm79ry34KwwS0y4oVZjB468iw/6u9g1W26dtexKcIJAnVL2pMF+hxQwzZ7LutxOwEgtym9eIxvX33CMKg==", "engines": { - "node": ">=10" + "node": ">=12" } }, "node_modules/duplexer2": { @@ -1394,10 +1430,11 @@ } }, "node_modules/electron-to-chromium": { - "version": "1.4.57", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.57.tgz", - "integrity": "sha512-FNC+P5K1n6pF+M0zIK+gFCoXcJhhzDViL3DRIGy2Fv5PohuSES1JHR7T+GlwxSxlzx4yYbsuzCZvHxcBSRCIOw==", - "dev": true + "version": "1.4.58", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.58.tgz", + "integrity": "sha512-7LXwnKyqcEaMFVXOer+2JPfFs1D+ej7yRRrfZoIH1YlLQZ81OvBNwSCBBLtExVkoMQQgOWwO0FbZVge6U/8rhQ==", + "dev": true, + "peer": true }, "node_modules/emoji-regex": { "version": "10.0.0", @@ -1469,6 +1506,7 @@ "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", "dev": true, + "peer": true, "engines": { "node": ">=6" } @@ -1535,23 +1573,22 @@ } }, "node_modules/eslint-plugin-unicorn": { - "version": "38.0.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-unicorn/-/eslint-plugin-unicorn-38.0.1.tgz", - "integrity": "sha512-eu4HCg7Bv43nk/hYZoWpLzRo668Nb7swQySn94aohn0heh9KLJ1GOFgVxJndLS8BploMGaClxgsyTNGJrP69yw==", + "version": "40.1.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-unicorn/-/eslint-plugin-unicorn-40.1.0.tgz", + "integrity": "sha512-y5doK2DF9Sr5AqKEHbHxjFllJ167nKDRU01HDcWyv4Tnmaoe9iNxMrBnaybZvWZUaE3OC5Unu0lNIevYamloig==", "dev": true, "dependencies": { - "@babel/helper-validator-identifier": "^7.14.9", - "ci-info": "^3.2.0", + "@babel/helper-validator-identifier": "^7.15.7", + "ci-info": "^3.3.0", "clean-regexp": "^1.0.0", - "eslint-template-visitor": "^2.3.2", "eslint-utils": "^3.0.0", "esquery": "^1.4.0", - "indent-string": "4", + "indent-string": "^4.0.0", "is-builtin-module": "^3.1.0", "lodash": "^4.17.21", "pluralize": "^8.0.0", "read-pkg-up": "^7.0.1", - "regexp-tree": "^0.1.23", + "regexp-tree": "^0.1.24", "safe-regex": "^2.1.1", "semver": "^7.3.5", "strip-indent": "^3.0.0" @@ -1603,22 +1640,6 @@ "node": ">=8.0.0" } }, - "node_modules/eslint-template-visitor": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/eslint-template-visitor/-/eslint-template-visitor-2.3.2.tgz", - "integrity": "sha512-3ydhqFpuV7x1M9EK52BPNj6V0Kwu0KKkcIAfpUhwHbR8ocRln/oUHgfxQupY8O1h4Qv/POHDumb/BwwNfxbtnA==", - "dev": true, - "dependencies": { - "@babel/core": "^7.12.16", - "@babel/eslint-parser": "^7.12.16", - "eslint-visitor-keys": "^2.0.0", - "esquery": "^1.3.1", - "multimap": "^1.1.0" - }, - "peerDependencies": { - "eslint": ">=7.0.0" - } - }, "node_modules/eslint-utils": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-3.0.0.tgz", @@ -1935,16 +1956,16 @@ } }, "node_modules/file-type": { - "version": "16.5.3", - "resolved": "https://registry.npmjs.org/file-type/-/file-type-16.5.3.tgz", - "integrity": "sha512-uVsl7iFhHSOY4bEONLlTK47iAHtNsFHWP5YE4xJfZ4rnX7S1Q3wce09XgqSC7E/xh8Ncv/be1lNoyprlUH/x6A==", + "version": "17.1.1", + "resolved": "https://registry.npmjs.org/file-type/-/file-type-17.1.1.tgz", + "integrity": "sha512-heRUMZHby2Qj6wZAA3YHeMlRmZNQTcb6VxctkGmM+mcM6ROQKvHpr7SS6EgdfEhH+s25LDshBjvPx/Ecm+bOVQ==", "dependencies": { - "readable-web-to-node-stream": "^3.0.0", - "strtok3": "^6.2.4", - "token-types": "^4.1.1" + "readable-web-to-node-stream": "^3.0.2", + "strtok3": "^7.0.0-alpha.7", + "token-types": "^5.0.0-alpha.2" }, "engines": { - "node": ">=10" + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" }, "funding": { "url": "https://github.com/sindresorhus/file-type?sponsor=1" @@ -2113,6 +2134,7 @@ "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", "dev": true, + "peer": true, "engines": { "node": ">=6.9.0" } @@ -2460,6 +2482,7 @@ "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.0.tgz", "integrity": "sha512-f+8cldu7X/y7RAJurMEJmdoKXGB/X550w2Nr3tTbezL6RwEE/iMcm+tZnXeoZtKuOq6ft8+CqzEkrIgx1fPoQA==", "dev": true, + "peer": true, "dependencies": { "minimist": "^1.2.5" }, @@ -2727,12 +2750,6 @@ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" }, - "node_modules/multimap": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/multimap/-/multimap-1.1.0.tgz", - "integrity": "sha512-0ZIR9PasPxGXmRsEF8jsDzndzHDj7tIav+JUmvIFB/WHswliFnquxECT/De7GR4yg99ky/NlRKJT82G1y271bw==", - "dev": true - }, "node_modules/nan": { "version": "2.15.0", "resolved": "https://registry.npmjs.org/nan/-/nan-2.15.0.tgz", @@ -2838,7 +2855,8 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.1.tgz", "integrity": "sha512-CqyzN6z7Q6aMeF/ktcMVTzhAHCEpf8SOarwpzpf8pNBY2k5/oM34UHldUwp8VKI7uxct2HxSRdJjBaZeESzcxA==", - "dev": true + "dev": true, + "peer": true }, "node_modules/normalize-package-data": { "version": "2.5.0", @@ -3046,11 +3064,11 @@ "dev": true }, "node_modules/peek-readable": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/peek-readable/-/peek-readable-4.0.2.tgz", - "integrity": "sha512-9fMaz6zoxw9ypO1KZy5RDJgSupEtu0Q+g/OqqsVHX3rKGR8qehRLYzsFARZ4bVvdvfknKiXvuDbkMnO1g6cRpQ==", + "version": "5.0.0-alpha.5", + "resolved": "https://registry.npmjs.org/peek-readable/-/peek-readable-5.0.0-alpha.5.tgz", + "integrity": "sha512-pJohF/tDwV3ntnT5+EkUo4E700q/j/OCDuPxtM+5/kFGjyOai/sK4/We4Cy1MB2OiTQliWU5DxPvYIKQAdPqAA==", "engines": { - "node": ">=8" + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" }, "funding": { "type": "github", @@ -3142,7 +3160,8 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", - "dev": true + "dev": true, + "peer": true }, "node_modules/pluralize": { "version": "8.0.0", @@ -3750,31 +3769,6 @@ "url": "https://opencollective.com/libvips" } }, - "node_modules/sharp/node_modules/color": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/color/-/color-4.2.0.tgz", - "integrity": "sha512-hHTcrbvEnGjC7WBMk6ibQWFVDgEFTVmjrz2Q5HlU6ltwxv0JJN2Z8I7uRbWeQLF04dikxs8zgyZkazRJvSMtyQ==", - "dependencies": { - "color-convert": "^2.0.1", - "color-string": "^1.9.0" - } - }, - "node_modules/sharp/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/sharp/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" - }, "node_modules/sharp/node_modules/detect-libc": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz", @@ -4012,15 +4006,15 @@ } }, "node_modules/strtok3": { - "version": "6.2.4", - "resolved": "https://registry.npmjs.org/strtok3/-/strtok3-6.2.4.tgz", - "integrity": "sha512-GO8IcFF9GmFDvqduIspUBwCzCbqzegyVKIsSymcMgiZKeCfrN9SowtUoi8+b59WZMAjIzVZic/Ft97+pynR3Iw==", + "version": "7.0.0-alpha.8", + "resolved": "https://registry.npmjs.org/strtok3/-/strtok3-7.0.0-alpha.8.tgz", + "integrity": "sha512-u+k19v+rTxBjGYxncRQjGvZYwYvEd0uP3D+uHKe/s4WB1eXS5ZwpZsTlBu5xSS4zEd89mTXECXg6WW3FSeV8cA==", "dependencies": { "@tokenizer/token": "^0.3.0", - "peek-readable": "^4.0.1" + "peek-readable": "^5.0.0-alpha.5" }, "engines": { - "node": ">=10" + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" }, "funding": { "type": "github", @@ -4182,15 +4176,15 @@ } }, "node_modules/token-types": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/token-types/-/token-types-4.1.1.tgz", - "integrity": "sha512-hD+QyuUAyI2spzsI0B7gf/jJ2ggR4RjkAo37j3StuePhApJUwcWDjnHDOFdIWYSwNR28H14hpwm4EI+V1Ted1w==", + "version": "5.0.0-alpha.2", + "resolved": "https://registry.npmjs.org/token-types/-/token-types-5.0.0-alpha.2.tgz", + "integrity": "sha512-EsG9UxAW4M6VATrEEjhPFTKEUi1OiJqTUMIZOGBN49fGxYjZB36k0p7to3HZSmWRoHm1QfZgrg3e02fpqAt5fQ==", "dependencies": { "@tokenizer/token": "^0.3.0", "ieee754": "^1.2.1" }, "engines": { - "node": ">=10" + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" }, "funding": { "type": "github", @@ -4411,9 +4405,9 @@ } }, "node_modules/winston": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/winston/-/winston-3.5.0.tgz", - "integrity": "sha512-OQMbmLsIdVHvm2hSurrYZs+iZNIImXneYJ6pX7LseSMEq20HdTETXiNnNX3FDwN4LB/xDRZLF6JYOY+AI112Kw==", + "version": "3.5.1", + "resolved": "https://registry.npmjs.org/winston/-/winston-3.5.1.tgz", + "integrity": "sha512-tbRtVy+vsSSCLcZq/8nXZaOie/S2tPXPFt4be/Q3vI/WtYwm7rrwidxVw2GRa38FIXcJ1kUM6MOZ9Jmnk3F3UA==", "dependencies": { "@dabh/diagnostics": "^2.0.2", "async": "^3.2.3", @@ -4733,13 +4727,15 @@ "version": "7.16.8", "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.16.8.tgz", "integrity": "sha512-m7OkX0IdKLKPpBlJtF561YJal5y/jyI5fNfWbPxh2D/nbzzGI4qRyrD8xO2jB24u7l+5I2a43scCG2IrfjC50Q==", - "dev": true + "dev": true, + "peer": true }, "@babel/core": { "version": "7.16.12", "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.16.12.tgz", "integrity": "sha512-dK5PtG1uiN2ikk++5OzSYsitZKny4wOCD0nrO4TqnW4BVBTQ2NGS3NgilvT/TEyxTST7LNyWV/T4tXDoD3fOgg==", "dev": true, + "peer": true, "requires": { "@babel/code-frame": "^7.16.7", "@babel/generator": "^7.16.8", @@ -4803,6 +4799,7 @@ "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.16.7.tgz", "integrity": "sha512-mGojBwIWcwGD6rfqgRXVlVYmPAv7eOpIemUG3dGnDdCY4Pae70ROij3XmfrH6Fa1h1aiDylpglbZyktfzyo/hA==", "dev": true, + "peer": true, "requires": { "@babel/compat-data": "^7.16.4", "@babel/helper-validator-option": "^7.16.7", @@ -4877,6 +4874,7 @@ "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.16.7.tgz", "integrity": "sha512-LVtS6TqjJHFc+nYeITRo6VLXve70xmq7wPhWTqDJusJEgGmkAACWwMiTNrvfoQo6hEhFwAIixNkvB0jPXDL8Wg==", "dev": true, + "peer": true, "requires": { "@babel/types": "^7.16.7" } @@ -4886,6 +4884,7 @@ "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.16.7.tgz", "integrity": "sha512-gaqtLDxJEFCeQbYp9aLAefjhkKdjKcdh6DB7jniIGU3Pz52WAmP268zK0VgPz9hUNkMSYeH976K2/Y6yPadpng==", "dev": true, + "peer": true, "requires": { "@babel/helper-environment-visitor": "^7.16.7", "@babel/helper-module-imports": "^7.16.7", @@ -4930,6 +4929,7 @@ "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.16.7.tgz", "integrity": "sha512-ZIzHVyoeLMvXMN/vok/a4LWRy8G2v205mNP0XOuf9XRLyX5/u9CnVulUtDgUTama3lT+bf/UqucuZjqiGuTS1g==", "dev": true, + "peer": true, "requires": { "@babel/types": "^7.16.7" } @@ -4953,13 +4953,15 @@ "version": "7.16.7", "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.16.7.tgz", "integrity": "sha512-TRtenOuRUVo9oIQGPC5G9DgK4743cdxvtOw0weQNpZXaS16SCBi5MNjZF8vba3ETURjZpTbVn7Vvcf2eAwFozQ==", - "dev": true + "dev": true, + "peer": true }, "@babel/helpers": { "version": "7.16.7", "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.16.7.tgz", "integrity": "sha512-9ZDoqtfY7AuEOt3cxchfii6C7GDyyMBffktR5B2jvWv8u2+efwvpnVKXMWzNehqy68tKgAfSwfdw/lWpthS2bw==", "dev": true, + "peer": true, "requires": { "@babel/template": "^7.16.7", "@babel/traverse": "^7.16.7", @@ -5337,6 +5339,7 @@ "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.19.1.tgz", "integrity": "sha512-u2tbbG5PdKRTUoctO3NBD8FQ5HdPh1ZXPHzp1rwaa5jTc+RV9/+RlWiAIKmjRPQF+xbGM9Kklj5bZQFa2s/38A==", "dev": true, + "peer": true, "requires": { "caniuse-lite": "^1.0.30001286", "electron-to-chromium": "^1.4.17", @@ -5407,10 +5410,11 @@ "integrity": "sha1-fB0W1nmhu+WcoCys7PsBHiAfWh8=" }, "caniuse-lite": { - "version": "1.0.30001303", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001303.tgz", - "integrity": "sha512-/Mqc1oESndUNszJP0kx0UaQU9kEv9nNtJ7Kn8AdA0mNnH8eR1cj0kG+NbNuC1Wq/b21eA8prhKRA3bbkjONegQ==", - "dev": true + "version": "1.0.30001304", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001304.tgz", + "integrity": "sha512-bdsfZd6K6ap87AGqSHJP/s1V+U6Z5lyrcbBu3ovbCCf8cSYpwTtGrCBObMpJqwxfTbLW6YTIdbb1jEeTelcpYQ==", + "dev": true, + "peer": true }, "chainsaw": { "version": "0.1.0", @@ -5529,12 +5533,27 @@ "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=" }, "color": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/color/-/color-3.2.1.tgz", - "integrity": "sha512-aBl7dZI9ENN6fUGC7mWpMTPNHmWUSNan9tuWN6ahh5ZLNk9baLJOnSMlrQkHcrfFgz2/RigjUVAjdx36VcemKA==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/color/-/color-4.2.0.tgz", + "integrity": "sha512-hHTcrbvEnGjC7WBMk6ibQWFVDgEFTVmjrz2Q5HlU6ltwxv0JJN2Z8I7uRbWeQLF04dikxs8zgyZkazRJvSMtyQ==", "requires": { - "color-convert": "^1.9.3", - "color-string": "^1.6.0" + "color-convert": "^2.0.1", + "color-string": "^1.9.0" + }, + "dependencies": { + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + } } }, "color-convert": { @@ -5571,6 +5590,17 @@ "requires": { "color": "^3.1.3", "text-hex": "1.0.x" + }, + "dependencies": { + "color": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/color/-/color-3.2.1.tgz", + "integrity": "sha512-aBl7dZI9ENN6fUGC7mWpMTPNHmWUSNan9tuWN6ahh5ZLNk9baLJOnSMlrQkHcrfFgz2/RigjUVAjdx36VcemKA==", + "requires": { + "color-convert": "^1.9.3", + "color-string": "^1.6.0" + } + } } }, "concat-map": { @@ -5588,6 +5618,7 @@ "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.8.0.tgz", "integrity": "sha512-+OQdjP49zViI/6i7nIJpA8rAl4sV/JdPfU9nZs3VqOwGIgizICvuN2ru6fMd+4llL0tar18UYJXfZ/TWtmhUjA==", "dev": true, + "peer": true, "requires": { "safe-buffer": "~5.1.1" } @@ -5694,9 +5725,9 @@ } }, "dotenv": { - "version": "10.0.0", - "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-10.0.0.tgz", - "integrity": "sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q==" + "version": "15.0.0", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-15.0.0.tgz", + "integrity": "sha512-/l1sXXm79ry34KwwS0y4oVZjB468iw/6u9g1W26dtexKcIJAnVL2pMF+hxQwzZ7LutxOwEgtym9eIxvX33CMKg==" }, "duplexer2": { "version": "0.1.4", @@ -5736,10 +5767,11 @@ } }, "electron-to-chromium": { - "version": "1.4.57", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.57.tgz", - "integrity": "sha512-FNC+P5K1n6pF+M0zIK+gFCoXcJhhzDViL3DRIGy2Fv5PohuSES1JHR7T+GlwxSxlzx4yYbsuzCZvHxcBSRCIOw==", - "dev": true + "version": "1.4.58", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.58.tgz", + "integrity": "sha512-7LXwnKyqcEaMFVXOer+2JPfFs1D+ej7yRRrfZoIH1YlLQZ81OvBNwSCBBLtExVkoMQQgOWwO0FbZVge6U/8rhQ==", + "dev": true, + "peer": true }, "emoji-regex": { "version": "10.0.0", @@ -5802,7 +5834,8 @@ "version": "3.1.1", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", - "dev": true + "dev": true, + "peer": true }, "escape-string-regexp": { "version": "1.0.5", @@ -5948,23 +5981,22 @@ } }, "eslint-plugin-unicorn": { - "version": "38.0.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-unicorn/-/eslint-plugin-unicorn-38.0.1.tgz", - "integrity": "sha512-eu4HCg7Bv43nk/hYZoWpLzRo668Nb7swQySn94aohn0heh9KLJ1GOFgVxJndLS8BploMGaClxgsyTNGJrP69yw==", + "version": "40.1.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-unicorn/-/eslint-plugin-unicorn-40.1.0.tgz", + "integrity": "sha512-y5doK2DF9Sr5AqKEHbHxjFllJ167nKDRU01HDcWyv4Tnmaoe9iNxMrBnaybZvWZUaE3OC5Unu0lNIevYamloig==", "dev": true, "requires": { - "@babel/helper-validator-identifier": "^7.14.9", - "ci-info": "^3.2.0", + "@babel/helper-validator-identifier": "^7.15.7", + "ci-info": "^3.3.0", "clean-regexp": "^1.0.0", - "eslint-template-visitor": "^2.3.2", "eslint-utils": "^3.0.0", "esquery": "^1.4.0", - "indent-string": "4", + "indent-string": "^4.0.0", "is-builtin-module": "^3.1.0", "lodash": "^4.17.21", "pluralize": "^8.0.0", "read-pkg-up": "^7.0.1", - "regexp-tree": "^0.1.23", + "regexp-tree": "^0.1.24", "safe-regex": "^2.1.1", "semver": "^7.3.5", "strip-indent": "^3.0.0" @@ -5997,19 +6029,6 @@ "estraverse": "^4.1.1" } }, - "eslint-template-visitor": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/eslint-template-visitor/-/eslint-template-visitor-2.3.2.tgz", - "integrity": "sha512-3ydhqFpuV7x1M9EK52BPNj6V0Kwu0KKkcIAfpUhwHbR8ocRln/oUHgfxQupY8O1h4Qv/POHDumb/BwwNfxbtnA==", - "dev": true, - "requires": { - "@babel/core": "^7.12.16", - "@babel/eslint-parser": "^7.12.16", - "eslint-visitor-keys": "^2.0.0", - "esquery": "^1.3.1", - "multimap": "^1.1.0" - } - }, "eslint-utils": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-3.0.0.tgz", @@ -6137,13 +6156,13 @@ } }, "file-type": { - "version": "16.5.3", - "resolved": "https://registry.npmjs.org/file-type/-/file-type-16.5.3.tgz", - "integrity": "sha512-uVsl7iFhHSOY4bEONLlTK47iAHtNsFHWP5YE4xJfZ4rnX7S1Q3wce09XgqSC7E/xh8Ncv/be1lNoyprlUH/x6A==", + "version": "17.1.1", + "resolved": "https://registry.npmjs.org/file-type/-/file-type-17.1.1.tgz", + "integrity": "sha512-heRUMZHby2Qj6wZAA3YHeMlRmZNQTcb6VxctkGmM+mcM6ROQKvHpr7SS6EgdfEhH+s25LDshBjvPx/Ecm+bOVQ==", "requires": { - "readable-web-to-node-stream": "^3.0.0", - "strtok3": "^6.2.4", - "token-types": "^4.1.1" + "readable-web-to-node-stream": "^3.0.2", + "strtok3": "^7.0.0-alpha.7", + "token-types": "^5.0.0-alpha.2" } }, "file-uri-to-path": { @@ -6281,7 +6300,8 @@ "version": "1.0.0-beta.2", "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", - "dev": true + "dev": true, + "peer": true }, "get-caller-file": { "version": "2.0.5", @@ -6537,6 +6557,7 @@ "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.0.tgz", "integrity": "sha512-f+8cldu7X/y7RAJurMEJmdoKXGB/X550w2Nr3tTbezL6RwEE/iMcm+tZnXeoZtKuOq6ft8+CqzEkrIgx1fPoQA==", "dev": true, + "peer": true, "requires": { "minimist": "^1.2.5" } @@ -6748,12 +6769,6 @@ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" }, - "multimap": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/multimap/-/multimap-1.1.0.tgz", - "integrity": "sha512-0ZIR9PasPxGXmRsEF8jsDzndzHDj7tIav+JUmvIFB/WHswliFnquxECT/De7GR4yg99ky/NlRKJT82G1y271bw==", - "dev": true - }, "nan": { "version": "2.15.0", "resolved": "https://registry.npmjs.org/nan/-/nan-2.15.0.tgz", @@ -6827,7 +6842,8 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.1.tgz", "integrity": "sha512-CqyzN6z7Q6aMeF/ktcMVTzhAHCEpf8SOarwpzpf8pNBY2k5/oM34UHldUwp8VKI7uxct2HxSRdJjBaZeESzcxA==", - "dev": true + "dev": true, + "peer": true }, "normalize-package-data": { "version": "2.5.0", @@ -6989,9 +7005,9 @@ "dev": true }, "peek-readable": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/peek-readable/-/peek-readable-4.0.2.tgz", - "integrity": "sha512-9fMaz6zoxw9ypO1KZy5RDJgSupEtu0Q+g/OqqsVHX3rKGR8qehRLYzsFARZ4bVvdvfknKiXvuDbkMnO1g6cRpQ==" + "version": "5.0.0-alpha.5", + "resolved": "https://registry.npmjs.org/peek-readable/-/peek-readable-5.0.0-alpha.5.tgz", + "integrity": "sha512-pJohF/tDwV3ntnT5+EkUo4E700q/j/OCDuPxtM+5/kFGjyOai/sK4/We4Cy1MB2OiTQliWU5DxPvYIKQAdPqAA==" }, "pg": { "version": "8.7.1", @@ -7059,7 +7075,8 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", - "dev": true + "dev": true, + "peer": true }, "pluralize": { "version": "8.0.0", @@ -7529,28 +7546,6 @@ "tunnel-agent": "^0.6.0" }, "dependencies": { - "color": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/color/-/color-4.2.0.tgz", - "integrity": "sha512-hHTcrbvEnGjC7WBMk6ibQWFVDgEFTVmjrz2Q5HlU6ltwxv0JJN2Z8I7uRbWeQLF04dikxs8zgyZkazRJvSMtyQ==", - "requires": { - "color-convert": "^2.0.1", - "color-string": "^1.9.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" - }, "detect-libc": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz", @@ -7721,12 +7716,12 @@ "dev": true }, "strtok3": { - "version": "6.2.4", - "resolved": "https://registry.npmjs.org/strtok3/-/strtok3-6.2.4.tgz", - "integrity": "sha512-GO8IcFF9GmFDvqduIspUBwCzCbqzegyVKIsSymcMgiZKeCfrN9SowtUoi8+b59WZMAjIzVZic/Ft97+pynR3Iw==", + "version": "7.0.0-alpha.8", + "resolved": "https://registry.npmjs.org/strtok3/-/strtok3-7.0.0-alpha.8.tgz", + "integrity": "sha512-u+k19v+rTxBjGYxncRQjGvZYwYvEd0uP3D+uHKe/s4WB1eXS5ZwpZsTlBu5xSS4zEd89mTXECXg6WW3FSeV8cA==", "requires": { "@tokenizer/token": "^0.3.0", - "peek-readable": "^4.0.1" + "peek-readable": "^5.0.0-alpha.5" } }, "supports-color": { @@ -7836,9 +7831,9 @@ "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==" }, "token-types": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/token-types/-/token-types-4.1.1.tgz", - "integrity": "sha512-hD+QyuUAyI2spzsI0B7gf/jJ2ggR4RjkAo37j3StuePhApJUwcWDjnHDOFdIWYSwNR28H14hpwm4EI+V1Ted1w==", + "version": "5.0.0-alpha.2", + "resolved": "https://registry.npmjs.org/token-types/-/token-types-5.0.0-alpha.2.tgz", + "integrity": "sha512-EsG9UxAW4M6VATrEEjhPFTKEUi1OiJqTUMIZOGBN49fGxYjZB36k0p7to3HZSmWRoHm1QfZgrg3e02fpqAt5fQ==", "requires": { "@tokenizer/token": "^0.3.0", "ieee754": "^1.2.1" @@ -8027,9 +8022,9 @@ "integrity": "sha1-+OGqHuWlPsW/FR/6CXQqatdpeHY=" }, "winston": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/winston/-/winston-3.5.0.tgz", - "integrity": "sha512-OQMbmLsIdVHvm2hSurrYZs+iZNIImXneYJ6pX7LseSMEq20HdTETXiNnNX3FDwN4LB/xDRZLF6JYOY+AI112Kw==", + "version": "3.5.1", + "resolved": "https://registry.npmjs.org/winston/-/winston-3.5.1.tgz", + "integrity": "sha512-tbRtVy+vsSSCLcZq/8nXZaOie/S2tPXPFt4be/Q3vI/WtYwm7rrwidxVw2GRa38FIXcJ1kUM6MOZ9Jmnk3F3UA==", "requires": { "@dabh/diagnostics": "^2.0.2", "async": "^3.2.3", diff --git a/package.json b/package.json index 4e4deb2..d905874 100644 --- a/package.json +++ b/package.json @@ -27,17 +27,17 @@ "@top-gg/sdk": "^3.1.1", "cmake-js": "^6.3.0", "cowsay2": "^2.0.4", - "dotenv": "^10.0.0", + "dotenv": "^15.0.0", "emoji-regex": "^10.0.0", "eris": "^0.16.1", "eris-fleet": "^1.0.0", - "file-type": "^16.1.0", + "file-type": "^17.1.1", "format-duration": "^1.4.0", "jsqr": "^1.3.1", "lavacord": "^1.1.9", - "node-addon-api": "^4.2.0", + "node-addon-api": "^4.3.0", "node-emoji": "^1.10.0", - "node-fetch": "^3.1.1", + "node-fetch": "^3.2.0", "qrcode": "^1.4.4", "sharp": "^0.29.3", "winston": "^3.3.3" @@ -47,7 +47,7 @@ "@babel/eslint-plugin": "^7.13.0", "@babel/plugin-proposal-class-properties": "^7.13.0", "eslint": "^8.2.0", - "eslint-plugin-unicorn": "^38.0.1" + "eslint-plugin-unicorn": "^40.1.0" }, "optionalDependencies": { "better-sqlite3": "^7.4.1", diff --git a/utils/image.js b/utils/image.js index 1486b60..17a40fa 100644 --- a/utils/image.js +++ b/utils/image.js @@ -1,6 +1,6 @@ import fetch from "node-fetch"; import fs from "fs"; -import fileType from "file-type"; +import { fileTypeFromBuffer, fileTypeFromFile } from "file-type"; const formats = ["image/jpeg", "image/png", "image/webp", "image/gif", "video/mp4", "video/webm", "video/quicktime"]; @@ -12,7 +12,7 @@ export const servers = JSON.parse(fs.readFileSync("./servers.json", { encoding: export async function getType(image, extraReturnTypes) { if (!image.startsWith("http")) { - const imageType = await fileType.fromFile(image); + const imageType = await fileTypeFromFile(image); if (imageType && formats.includes(imageType.mime)) { return imageType.mime; } @@ -36,7 +36,7 @@ export async function getType(image, extraReturnTypes) { return type; } const imageBuffer = await imageRequest.arrayBuffer(); - const imageType = await fileType.fromBuffer(imageBuffer); + const imageType = await fileTypeFromBuffer(imageBuffer); if (imageType && formats.includes(imageType.mime)) { type = imageType.mime; } diff --git a/utils/pagination/awaitinteractions.js b/utils/pagination/awaitinteractions.js index 3373a9e..237afcf 100644 --- a/utils/pagination/awaitinteractions.js +++ b/utils/pagination/awaitinteractions.js @@ -2,30 +2,30 @@ import { EventEmitter } from "events"; class InteractionCollector extends EventEmitter { - constructor(client, message, timeout = 120000) { + constructor(client, message, type, timeout = 120000) { super(); this.message = message; - //this.time = timeout; + this.type = type; this.ended = false; this.bot = client; - this.listener = async (packet) => { - if (packet.t !== "INTERACTION_CREATE") return; - await this.verify(packet.d.message, packet.d.data.custom_id, packet.d.id, packet.d.token, packet.d.member ? packet.d.member.user.id : packet.d.user.id); + this.listener = async (interaction) => { + await this.verify(interaction); }; - this.bot.on("rawWS", this.listener); + this.bot.on("interactionCreate", this.listener); setTimeout(() => this.stop("time"), timeout); } - async verify(message, interaction, id, token, member) { - if (this.message.id !== message.id) return false; - this.emit("interaction", interaction, id, token, member); + async verify(interaction) { + if (!(interaction instanceof this.type)) return false; + if (this.message.id !== interaction.message.id) return false; + this.emit("interaction", interaction); return true; } stop(reason) { if (this.ended) return; this.ended = true; - this.bot.removeListener("rawWS", this.listener); + this.bot.removeListener("interactionCreate", this.listener); this.emit("end", this.collected, reason); } } diff --git a/utils/pagination/pagination.js b/utils/pagination/pagination.js index d11f767..c1b649f 100644 --- a/utils/pagination/pagination.js +++ b/utils/pagination/pagination.js @@ -1,6 +1,6 @@ import MessageCollector from "./awaitmessages.js"; import InteractionCollector from "./awaitinteractions.js"; -import fetch from "node-fetch"; +import { ComponentInteraction } from "eris"; export default async (client, message, pages, timeout = 120000) => { const manageMessages = message.channel.guild && message.channel.permissionsOf(client.user.id).has("manageMessages") ? true : false; @@ -63,36 +63,47 @@ export default async (client, message, pages, timeout = 120000) => { ] }] }; - const ackOptions = { - method: "POST", - body: "{\"type\":6}", - headers: { - "Content-Type": "application/json" - } - }; let currentPage = await client.createMessage(message.channel.id, Object.assign(pages[page], options, pages.length > 1 ? components : {})); if (pages.length > 1) { - const interactionCollector = new InteractionCollector(client, currentPage, timeout); - interactionCollector.on("interaction", async (interaction, id, token, member) => { - if (member === message.author.id) { - switch (interaction) { + const interactionCollector = new InteractionCollector(client, currentPage, ComponentInteraction, timeout); + interactionCollector.on("interaction", async (interaction) => { + if ((interaction.member ?? interaction.user).id === message.author.id) { + switch (interaction.data.custom_id) { case "back": - await fetch(`https://discord.com/api/v9/interactions/${id}/${token}/callback`, ackOptions); + await interaction.deferUpdate(); page = page > 0 ? --page : pages.length - 1; currentPage = await currentPage.edit(Object.assign(pages[page], options)); break; case "forward": - await fetch(`https://discord.com/api/v9/interactions/${id}/${token}/callback`, ackOptions); + await interaction.deferUpdate(); page = page + 1 < pages.length ? ++page : 0; currentPage = await currentPage.edit(Object.assign(pages[page], options)); break; case "jump": - await fetch(`https://discord.com/api/v9/interactions/${id}/${token}/callback`, ackOptions); + await interaction.deferUpdate(); const newComponents = JSON.parse(JSON.stringify(components)); for (const index of newComponents.components[0].components.keys()) { newComponents.components[0].components[index].disabled = true; } currentPage = await currentPage.edit(newComponents); + const jumpComponents = { + components: [{ + type: 1, + components: [{ + type: 3, + custom_id: "seekDropdown", + placeholder: "Page Number", + options: [] + }] + }] + }; + for (let i = 0; i < pages.length; i++) { + const payload = { + label: i + 1, + value: i + }; + jumpComponents.components[0].components[0].options[i] = payload; + } client.createMessage(message.channel.id, Object.assign({ content: "What page do you want to jump to?" }, { messageReference: { channelID: currentPage.channel.id, @@ -103,15 +114,20 @@ export default async (client, message, pages, timeout = 120000) => { allowedMentions: { repliedUser: false } - })).then(askMessage => { - const messageCollector = new MessageCollector(client, askMessage.channel, (response) => response.author.id === message.author.id && !isNaN(response.content) && Number(response.content) <= pages.length && Number(response.content) > 0, { - time: timeout, - maxMatches: 1 - }); - return messageCollector.on("message", async (response) => { + }, jumpComponents)).then(askMessage => { + const dropdownCollector = new InteractionCollector(client, askMessage, ComponentInteraction, timeout); + let ended = false; + dropdownCollector.on("interaction", async (response) => { + if (response.data.custom_id !== "seekDropdown") return; + if (await client.getMessage(askMessage.channel.id, askMessage.id).catch(() => undefined)) await askMessage.delete(); + page = Number(response.data.values[0]); + currentPage = await currentPage.edit(Object.assign(pages[page], options, components)); + ended = true; + dropdownCollector.stop(); + }); + dropdownCollector.once("end", async () => { + if (ended) return; if (await client.getMessage(askMessage.channel.id, askMessage.id).catch(() => undefined)) await askMessage.delete(); - if (manageMessages) await response.delete(); - page = Number(response.content) - 1; currentPage = await currentPage.edit(Object.assign(pages[page], options, components)); }); }).catch(error => { @@ -119,7 +135,7 @@ export default async (client, message, pages, timeout = 120000) => { }); break; case "delete": - await fetch(`https://discord.com/api/v9/interactions/${id}/${token}/callback`, ackOptions); + await interaction.deferUpdate(); interactionCollector.emit("end"); if (await client.getMessage(currentPage.channel.id, currentPage.id).catch(() => undefined)) await currentPage.delete(); return; @@ -130,10 +146,10 @@ export default async (client, message, pages, timeout = 120000) => { }); interactionCollector.once("end", async () => { interactionCollector.removeAllListeners("interaction"); + for (const index of components.components[0].components.keys()) { + components.components[0].components[index].disabled = true; + } if (await client.getMessage(currentPage.channel.id, currentPage.id).catch(() => undefined)) { - for (const index of components.components[0].components.keys()) { - components.components[0].components[index].disabled = true; - } await currentPage.edit(components); } });