From d06b9200e7a494f3ede716fb12050eb6fdbd6fa0 Mon Sep 17 00:00:00 2001 From: strawhathacker Date: Thu, 9 Sep 2021 18:13:50 +0300 Subject: [PATCH] Bumped Dependencies to latest --- README.md | 2 +- package-lock.json | 182 +++++++++++++------- package.json | 6 +- src/classes/Permissions.js | 6 +- src/commands/info/help.js | 19 +- src/commands/info/ping.js | 4 +- src/commands/info/userinfo.js | 6 +- src/commands/moderation/make/embed.js | 8 +- src/commands/reactions/reactions.js | 5 +- src/events/guildMemberAdd.js | 7 +- src/events/{message.js => messageCreate.js} | 2 +- src/index.js | 9 + src/utils/findMember.js | 2 +- 13 files changed, 164 insertions(+), 94 deletions(-) rename src/events/{message.js => messageCreate.js} (96%) diff --git a/README.md b/README.md index ffddf8c..3579b37 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Feature rich and easy to maintain.
Based on the [discord.js](https://github.com/discordjs/discord.js) library. ## 📥 Installation - NPM and Node.js 14.0.0 or higher required. Download [here](https://nodejs.org/)
+ Node.js v14.0.0 or higher required. Download [here](https://nodejs.org/)
MongoDB v4 or higher required. Create [here](https://docs.atlas.mongodb.com/getting-started) for free. ###### 1. Clone this repository from your terminal: ```shell diff --git a/package-lock.json b/package-lock.json index 00fa7b1..3d8ceac 100644 --- a/package-lock.json +++ b/package-lock.json @@ -49,10 +49,22 @@ } } }, + "@discordjs/builders": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/@discordjs/builders/-/builders-0.5.0.tgz", + "integrity": "sha512-HP5y4Rqw68o61Qv4qM5tVmDbWi4mdTFftqIOGRo33SNPpLJ1Ga3KEIR2ibKofkmsoQhEpLmopD1AZDs3cKpHuw==", + "requires": { + "@sindresorhus/is": "^4.0.1", + "discord-api-types": "^0.22.0", + "ow": "^0.27.0", + "ts-mixer": "^6.0.0", + "tslib": "^2.3.0" + } + }, "@discordjs/collection": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-0.1.6.tgz", - "integrity": "sha512-utRNxnd9kSS2qhyivo9lMlt5qgAUasH2gb7BEOn6p0efFh24gjGomHzWKMAPn2hEReOPQZCJaRKoURwRotKucQ==" + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-0.2.1.tgz", + "integrity": "sha512-vhxqzzM8gkomw0TYRF3tgx7SwElzUlXT/Aa41O7mOcyN6wIJfj5JmDWaO5XGKsGSsNx7F3i5oIlrucCCWV1Nog==" }, "@discordjs/form-data": { "version": "3.0.1", @@ -120,6 +132,16 @@ "integrity": "sha512-wdppn25U8z/2yiaT6YGquE6X8sSv7hNMWSXYSSU1jGv/yd6XqjXgTDJ8KP4NgjTXfJ3GbRjeeb8RTV7a/VpM+w==", "dev": true }, + "@sapphire/async-queue": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/@sapphire/async-queue/-/async-queue-1.1.4.tgz", + "integrity": "sha512-fFrlF/uWpGOX5djw5Mu2Hnnrunao75WGey0sP0J3jnhmrJ5TAPzHYOmytD5iN/+pMxS+f+u/gezqHa9tPhRHEA==" + }, + "@sindresorhus/is": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.0.1.tgz", + "integrity": "sha512-Qm9hBEBu18wt1PO2flE7LPb30BHMQt1eQgbV76YntdNk73XZGpn3izvGTYxbGgzXKgbCjiia0uxTd3aTNQrY/g==" + }, "@types/bson": { "version": "4.0.5", "resolved": "https://registry.npmjs.org/@types/bson/-/bson-4.0.5.tgz", @@ -142,12 +164,12 @@ "resolved": "https://registry.npmjs.org/@types/node/-/node-16.7.4.tgz", "integrity": "sha512-25QXpDsTiDnl2rZGUenagVMwO46way8dOUdvoC3R3p+6TrbpxeJBo/v87BEG1IHI31Jhaa8lPeSHcqwxsVBeYQ==" }, - "abort-controller": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", - "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==", + "@types/ws": { + "version": "7.4.7", + "resolved": "https://registry.npmjs.org/@types/ws/-/ws-7.4.7.tgz", + "integrity": "sha512-JQbbmxZTZehdc2iszGKs5oC3NFnjeay7mtAWrdt7qNtAVK0g19muApzAy4bm9byz79xa2ZnO/BOBC2R8RC5Lww==", "requires": { - "event-target-shim": "^5.0.0" + "@types/node": "*" } }, "acorn": { @@ -216,11 +238,11 @@ "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" }, "axios": { - "version": "0.21.1", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.1.tgz", - "integrity": "sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==", + "version": "0.21.4", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.4.tgz", + "integrity": "sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==", "requires": { - "follow-redirects": "^1.10.0" + "follow-redirects": "^1.14.0" } }, "balanced-match": { @@ -261,8 +283,7 @@ "callsites": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", - "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", - "dev": true + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==" }, "chalk": { "version": "4.1.2", @@ -345,9 +366,9 @@ "dev": true }, "core-util-is": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", + "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==" }, "cross-spawn": { "version": "7.0.3", @@ -391,19 +412,24 @@ "resolved": "https://registry.npmjs.org/denque/-/denque-1.5.1.tgz", "integrity": "sha512-XwE+iZ4D6ZUB7mfYRMb5wByE8L74HCn30FBN7sWnXksWc1LO1bPDl67pBR9o/kC4z/xSNAwkMYcGgqDV3BE3Hw==" }, + "discord-api-types": { + "version": "0.22.0", + "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.22.0.tgz", + "integrity": "sha512-l8yD/2zRbZItUQpy7ZxBJwaLX/Bs2TGaCthRppk8Sw24LOIWg12t9JEreezPoYD0SQcC2htNNo27kYEpYW/Srg==" + }, "discord.js": { - "version": "12.5.3", - "resolved": "https://registry.npmjs.org/discord.js/-/discord.js-12.5.3.tgz", - "integrity": "sha512-D3nkOa/pCkNyn6jLZnAiJApw2N9XrIsXUAdThf01i7yrEuqUmDGc7/CexVWwEcgbQR97XQ+mcnqJpmJ/92B4Aw==", + "version": "13.1.0", + "resolved": "https://registry.npmjs.org/discord.js/-/discord.js-13.1.0.tgz", + "integrity": "sha512-gxO4CXKdHpqA+WKG+f5RNnd3srTDj5uFJHgOathksDE90YNq/Qijkd2WlMgTTMS6AJoEnHxI7G9eDQHCuZ+xDA==", "requires": { - "@discordjs/collection": "^0.1.6", + "@discordjs/builders": "^0.5.0", + "@discordjs/collection": "^0.2.1", "@discordjs/form-data": "^3.0.1", - "abort-controller": "^3.0.0", + "@sapphire/async-queue": "^1.1.4", + "@types/ws": "^7.4.7", + "discord-api-types": "^0.22.0", "node-fetch": "^2.6.1", - "prism-media": "^1.2.9", - "setimmediate": "^1.0.5", - "tweetnacl": "^1.0.3", - "ws": "^7.4.4" + "ws": "^7.5.1" } }, "doctrine": { @@ -415,6 +441,14 @@ "esutils": "^2.0.2" } }, + "dot-prop": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-6.0.1.tgz", + "integrity": "sha512-tE7ztYzXHIeyvc7N+hR3oi7FIbf/NIjVP9hmAt3yMXzrQ072/fpjGLx2GxNxGxUl5V73MEqYzioOMoVhGMJ5cA==", + "requires": { + "is-obj": "^2.0.0" + } + }, "dotenv": { "version": "8.6.0", "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-8.6.0.tgz", @@ -604,11 +638,6 @@ "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", "dev": true }, - "event-target-shim": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", - "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==" - }, "fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", @@ -653,9 +682,9 @@ "dev": true }, "follow-redirects": { - "version": "1.13.3", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.13.3.tgz", - "integrity": "sha512-DUgl6+HDzB0iEptNQEXLx/KhTmDb8tZUHSeLqpnjpknR70H0nC2t9N73BK6fN4hOvJ84pKlIQVQ4k5FFlBedKA==" + "version": "1.14.3", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.3.tgz", + "integrity": "sha512-3MkHxknWMUtb23apkgz/83fDoe+y+qr0TdgacGIA7bew+QLBo3vdgEN2xEsuXNivpFy4CyDhBBZnNZOtalmenw==" }, "fs.realpath": { "version": "1.0.0", @@ -765,6 +794,11 @@ "is-extglob": "^2.1.1" } }, + "is-obj": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-2.0.0.tgz", + "integrity": "sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w==" + }, "isarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", @@ -825,6 +859,11 @@ "integrity": "sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8=", "dev": true }, + "lodash.isequal": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.isequal/-/lodash.isequal-4.5.0.tgz", + "integrity": "sha1-QVxEePK8wwEgwizhDtMib30+GOA=" + }, "lodash.merge": { "version": "4.6.2", "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", @@ -888,16 +927,17 @@ } }, "mongoose": { - "version": "5.13.8", - "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-5.13.8.tgz", - "integrity": "sha512-z3d+qei9Dem/LxRcJi0cdGPKzQnYk71oHEsEfYm17JA/vLiAbJiGuBS2hW7vkd9afkPAqu3KsPZh2ax0c5iPQw==", + "version": "5.13.9", + "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-5.13.9.tgz", + "integrity": "sha512-JbLw5ie0LJxm7V9LoNxRY//6cyFJf0cOpON2TWUWvF9pabil6ArfECL3xHV2N+mwwO4gXiIa+c0pwTzDUVTgqw==", "requires": { + "@types/bson": "1.x || 4.0.x", "@types/mongodb": "^3.5.27", "bson": "^1.1.4", "kareem": "2.3.2", "mongodb": "3.6.11", "mongoose-legacy-pluralize": "1.0.2", - "mpath": "0.8.3", + "mpath": "0.8.4", "mquery": "3.2.5", "ms": "2.1.2", "optional-require": "1.0.x", @@ -913,9 +953,9 @@ "integrity": "sha512-Yo/7qQU4/EyIS8YDFSeenIvXxZN+ld7YdV9LqFVQJzTLye8unujAWPZ4NWKfFA+RNjh+wvTWKY9Z3E5XM6ZZiQ==" }, "mpath": { - "version": "0.8.3", - "resolved": "https://registry.npmjs.org/mpath/-/mpath-0.8.3.tgz", - "integrity": "sha512-eb9rRvhDltXVNL6Fxd2zM9D4vKBxjVVQNLNijlj7uoXUy19zNDsIif5zR+pWmPCWNKwAtqyo4JveQm4nfD5+eA==" + "version": "0.8.4", + "resolved": "https://registry.npmjs.org/mpath/-/mpath-0.8.4.tgz", + "integrity": "sha512-DTxNZomBcTWlrMW76jy1wvV37X/cNNxPW1y2Jzd4DZkAaC5ZGsm8bfGfNOthcDuRJujXLqiuS6o3Tpy0JEoh7g==" }, "mquery": { "version": "3.2.5", @@ -948,9 +988,9 @@ "dev": true }, "node-fetch": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", - "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==" + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.2.tgz", + "integrity": "sha512-aLoxToI6RfZ+0NOjmWAgn9+LEd30YCkJKFSyWacNZdEKTit/ZMcKjGkTRo8uWEsnIb/hfKecNPEbln02PdWbcA==" }, "once": { "version": "1.4.0", @@ -980,6 +1020,26 @@ "word-wrap": "^1.2.3" } }, + "ow": { + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/ow/-/ow-0.27.0.tgz", + "integrity": "sha512-SGnrGUbhn4VaUGdU0EJLMwZWSupPmF46hnTRII7aCLCrqixTAC5eKo8kI4/XXf1eaaI8YEVT+3FeGNJI9himAQ==", + "requires": { + "@sindresorhus/is": "^4.0.1", + "callsites": "^3.1.0", + "dot-prop": "^6.0.1", + "lodash.isequal": "^4.5.0", + "type-fest": "^1.2.1", + "vali-date": "^1.0.0" + }, + "dependencies": { + "type-fest": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-1.4.0.tgz", + "integrity": "sha512-yGSza74xk0UG8k+pLh5oeoYirvIiWo5t0/o3zHHAO2tRDiZcxWP7fywNlXhqb6/r6sWvwi+RsyQMWhVLe4BVuA==" + } + } + }, "parent-module": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", @@ -1012,11 +1072,6 @@ "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", "dev": true }, - "prism-media": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/prism-media/-/prism-media-1.3.2.tgz", - "integrity": "sha512-L6UsGHcT6i4wrQhFF1aPK+MNYgjRqR2tUoIqEY+CG1NqVkMjPRKzS37j9f8GiYPlD6wG9ruBj+q5Ax+bH8Ik1g==" - }, "process-nextick-args": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", @@ -1118,11 +1173,6 @@ "lru-cache": "^6.0.0" } }, - "setimmediate": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", - "integrity": "sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU=" - }, "shebang-command": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", @@ -1290,10 +1340,15 @@ "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", "dev": true }, - "tweetnacl": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-1.0.3.tgz", - "integrity": "sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw==" + "ts-mixer": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/ts-mixer/-/ts-mixer-6.0.0.tgz", + "integrity": "sha512-nXIb1fvdY5CBSrDIblLn73NW0qRDk5yJ0Sk1qPBF560OdJfQp9jhl+0tzcY09OZ9U+6GpeoI9RjwoIKFIoB9MQ==" + }, + "tslib": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz", + "integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==" }, "type-check": { "version": "0.4.0", @@ -1330,6 +1385,11 @@ "integrity": "sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==", "dev": true }, + "vali-date": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/vali-date/-/vali-date-1.0.0.tgz", + "integrity": "sha1-G5BKWWCfsyjvB4E4Qgk09rhnCaY=" + }, "which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", @@ -1352,9 +1412,9 @@ "dev": true }, "ws": { - "version": "7.5.3", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.3.tgz", - "integrity": "sha512-kQ/dHIzuLrS6Je9+uv81ueZomEwH0qVYstcAQ4/Z93K8zeko9gtAbttJWzoC5ukqXY1PpoouV3+VSOqEAFt5wg==" + "version": "7.5.5", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.5.tgz", + "integrity": "sha512-BAkMFcAzl8as1G/hArkxOxq3G7pjUqQ3gzYbLL0/5zNkph70e+lCoxBGnm6AW1+/aiNeV4fnKqZ8m4GZewmH2w==" }, "yallist": { "version": "4.0.0", diff --git a/package.json b/package.json index 8a828bb..ec86dc4 100644 --- a/package.json +++ b/package.json @@ -5,10 +5,10 @@ "repository": "https://github.com/StrawHatHacker/Kiyo-Discord-Bot", "main": "index.js", "dependencies": { - "axios": "^0.21.1", - "discord.js": "^12.5.3", + "axios": "^0.21.4", + "discord.js": "^13.1.0", "dotenv": "^8.6.0", - "mongoose": "^5.13.8", + "mongoose": "^5.13.9", "readdirp": "^3.6.0" }, "scripts": {}, diff --git a/src/classes/Permissions.js b/src/classes/Permissions.js index 42b0eb4..78ba752 100644 --- a/src/classes/Permissions.js +++ b/src/classes/Permissions.js @@ -9,11 +9,11 @@ const Err = require('./Err'); */ module.exports = class Permissions { /** - * @param {TPermissions} perms + * @param {TPermissions | String[]} perms */ constructor(perms) { - if (!(perms instanceof TPermissions)) - throw new Err(400).inputErr().setMessage('Parameter `perms` should be an instance of `Collection`'); + if (!(perms instanceof TPermissions) && !Array.isArray(perms)) + throw new Err(400).inputErr().setMessage('Parameter `perms` should be an instance of `Collection` or an array of permissions'); this.perms = perms; } diff --git a/src/commands/info/help.js b/src/commands/info/help.js index 99d69ec..2e232f3 100644 --- a/src/commands/info/help.js +++ b/src/commands/info/help.js @@ -15,7 +15,7 @@ module.exports = { async run({ client, message, args, Guild }) { // If no argument is passed (EG. .help) if (args.length === 0) { - return message.channel.send(new Embed() + const e = new Embed() .setColor(message.guild.me.roles.color?.hexColor || 0xffffff) .setThumbnail(client.user.displayAvatarURL({ dynamic: true, size: 2048 })) .addDescription('[ɪɴᴠɪᴛᴇ ᴍᴇ](https://discord.com/api/oauth2/authorize?client_id=794989015765483571&permissions=0&scope=bot) ┃ [ꜱᴜᴘᴘᴏʀᴛ ꜱᴇʀᴠᴇʀ](https://discord.gg/ypEBGHB) \n') @@ -24,7 +24,9 @@ module.exports = { .addDescription(`Type \`${Guild.prefix}help commandName\` to see all information of that command.`) .addField('Modules', Object.keys(client.modulesWithCommands).map(m => `\`${m}\``).join(', ')) .addField('Referrals', 'Hosting Services: [DigitalOcean](https://m.do.co/c/f51cd516e684), [Hetzner](https://hetzner.cloud/?ref=0fswF9Kv99Av)\nCDN: [BunnyCDN](https://bunnycdn.com/?ref=1dqicv581x)\nVPN: [Surfshark](https://surfshark.club/friend/VZJP3rPr)') - .addField('Donate', '[Ko-fi](https://ko-fi.com/skillers3)')); + .addField('Donate', '[Ko-fi](https://ko-fi.com/skillers3)'); + + return message.channel.send({ embeds: [e] }); } // Else, meaning there is an argument else { @@ -37,18 +39,18 @@ module.exports = { if (arg === 'reactions') moduleCommands = client.modulesWithCommands['reactions'][0].aliases; else moduleCommands = client.modulesWithCommands[arg].map(c => c.name); - return message.channel.send(new Embed() + const e = new Embed() .setColor(message.guild.me.roles.color?.hexColor || 0xffffff) .setTitle(`Module: ${arg}`) - .addField('Commands', moduleCommands.map(c => `\`${c}\``).join(', ')) - ); + .addField('Commands', moduleCommands.map(c => `\`${c}\``).join(', ')); + return message.channel.send({ embeds: [e] }); } // Search throught command names and aliases else { for (let cmd of client.commands) { if (arg === cmd.name || cmd.aliases.includes(arg)) { - return message.channel.send(new Embed() + const e = new Embed() .setColor(message.guild.me.roles.color?.hexColor || 0xffffff) .setTitle(`Command: ${cmd.name}`) .addDescription(`Syntax: \`${Guild.prefix}${cmd.syntax}\``) @@ -56,8 +58,9 @@ module.exports = { .addDescription(`Module: ${cmd.module}`) .addDescription(`User Permissions: ${cmd.requiredPermissions.user.length === 0 ? '`None`' : new Perms(cmd.requiredPermissions.user).formatToReadableCode()}`) .addDescription(`Bot Permissions: ${cmd.requiredPermissions.client.length === 0 ? '`None`' : new Perms(cmd.requiredPermissions.client).formatToReadableCode()}`) - .addDescription('\n' + cmd.description) - ); + .addDescription('\n' + cmd.description); + + return message.channel.send({ embeds: [e] }); } } } diff --git a/src/commands/info/ping.js b/src/commands/info/ping.js index 3973d9a..207f71f 100644 --- a/src/commands/info/ping.js +++ b/src/commands/info/ping.js @@ -13,7 +13,7 @@ module.exports = { }, async run({ message, client }) { // Sending temporary message - const botMessage = await message.channel.send('Pinging...'); + const botMessage = await message.channel.send({ content: 'Pinging...' }); const { minutes, hours, days } = getTimeFromMS(client.uptime); @@ -24,7 +24,7 @@ module.exports = { .addField('Memory Usage', `:dna: ${Math.trunc(process.memoryUsage().heapUsed / 1024 / 1024)}MBs`, true); // Editing the embed - botMessage.edit('', { embed: pingembed }); + botMessage.edit({ content: '\u2005', embeds: [pingembed] }); } }; diff --git a/src/commands/info/userinfo.js b/src/commands/info/userinfo.js index d04399a..b331144 100644 --- a/src/commands/info/userinfo.js +++ b/src/commands/info/userinfo.js @@ -44,8 +44,8 @@ module.exports = { // If member is the guild owner, bypass permission filtering and formatting const keyPerms = targetMember.id === message.guild.ownerID ? 'Owner' : new Permissions(memberPerms).filterKeyPerms().formatToReadable(); const otherPerms = targetMember.id === message.guild.ownerID ? 'Owner' : new Permissions(memberPerms).filterNonKeyPerms().formatToReadable(); - - const embed = new Embed() + + const e = new Embed() .setAuthor(targetMember.displayName, smallAV) .setThumbnail(bigAV) .addDescription(`Mention: ${targetMember.toString()}`) @@ -56,6 +56,6 @@ module.exports = { .addField('Other Permissions', otherPerms) .setFooter(`Requested by: ${message.member.displayName}`, authorAV); - await message.channel.send(embed); + await message.channel.send({ embeds: [e] }); } }; diff --git a/src/commands/moderation/make/embed.js b/src/commands/moderation/make/embed.js index 72781c3..4ff1c33 100644 --- a/src/commands/moderation/make/embed.js +++ b/src/commands/moderation/make/embed.js @@ -23,13 +23,11 @@ module.exports = { const { content, embed } = jsonArgs; const targetEmbed = new Embed(embed); - await message.channel.send(content, targetEmbed) - .catch(e => { throw new Err(401).inputErr().setMessage(e.message); }); - + await message.channel.send({ content, embeds: [targetEmbed] }); await message.channel.send('Do you want me to save this embed? (Y/N)'); const filterYN = m => m.author.id === message.author.id && (m.content.toLowerCase() === 'y' || m.content.toLowerCase() === 'n'); - let collected = await message.channel.awaitMessages(filterYN, { max: 1, time: 10000, errors: ['time'] }) + let collected = await message.channel.awaitMessages({ filter: filterYN, max: 1, time: 10000, errors: ['time'] }) .catch(() => { throw new Err(401).inputErr().timedOut(); }); if (!collected) return; @@ -40,7 +38,7 @@ module.exports = { await message.channel.send('Let\'s give this embed a name. What do you want me to call it?'); const filterString = m => m.author.id === message.author.id; - collected = await message.channel.awaitMessages(filterString, { max: 1, time: 10000, errors: ['time'] }) + collected = await message.channel.awaitMessages({ filter: filterString, max: 1, time: 10000, errors: ['time'] }) .catch(() => { throw new Err(401).inputErr().timedOut(); }); if (!collected) return; diff --git a/src/commands/reactions/reactions.js b/src/commands/reactions/reactions.js index f8e9246..c63800e 100644 --- a/src/commands/reactions/reactions.js +++ b/src/commands/reactions/reactions.js @@ -47,8 +47,7 @@ module.exports = { } }); - // .color IS A ROLE INSTANCE ITS NOT A MISTAKE and YES it has .color property - let highestRoleColor = message.member.roles.color?.hexColor || 0xffffff; + const highestRoleColor = message.member.roles.color?.hexColor || 0xffffff; let desc = DESCRIPTIONS[cmd]; // Object { single: [...], multiple: [...] } desc = message.mentions.members.size === 0 ? desc.single : desc.multiple; // Array of `single` or `multiple` [...] @@ -65,6 +64,6 @@ module.exports = { .setColor(highestRoleColor) .setFooter('Powered by otakugifs.xyz', 'https://otakugifs.b-cdn.net/assets/otakugifsLogo.png'); - message.channel.send(embed); + message.channel.send({ embeds: [embed] }); } }; diff --git a/src/events/guildMemberAdd.js b/src/events/guildMemberAdd.js index bfaecec..3630c23 100644 --- a/src/events/guildMemberAdd.js +++ b/src/events/guildMemberAdd.js @@ -7,9 +7,10 @@ const Embed = require('../classes/Embed'); module.exports = async (_client, member) => { const Guild = await GuildModel.findById(member.guild.id); + if (!Guild) return; - if (!Guild?.features.welcome_messages) return; - if (Guild?.welcome_channel_id === null || Guild.welcome_embed_id === null) return; + if (!Guild.features.welcome_messages) return; + if (Guild.welcome_channel_id === null || Guild.welcome_embed_id === null) return; const channel = member.guild.channels.cache.get(Guild.welcome_channel_id); const EmbedProps = await EmbedModel.findById(Guild.welcome_embed_id); @@ -18,5 +19,5 @@ module.exports = async (_client, member) => { const formattedEmbedProps = formatEmbed(EmbedProps, member); - await channel.send(EmbedProps.content, new Embed(formattedEmbedProps)); + await channel.send({ content: EmbedProps.content, embeds: [new Embed(formattedEmbedProps)] }); }; \ No newline at end of file diff --git a/src/events/message.js b/src/events/messageCreate.js similarity index 96% rename from src/events/message.js rename to src/events/messageCreate.js index 47e6ea6..b365033 100644 --- a/src/events/message.js +++ b/src/events/messageCreate.js @@ -7,7 +7,7 @@ const databaseUtils = require('../utils/database'); module.exports = async (client, message) => { // If message came from another bot or it was from a non *text* channel, ignore it - if (message.author.bot || message.channel.type !== 'text') return; + if (message.author.bot || message.channel.type !== 'GUILD_TEXT') return; // Fetching or creating if doesn't exist a Guild in the database const Guild = await databaseUtils.guild.findOneOrCreate(GuildModel, message.guild.id); diff --git a/src/index.js b/src/index.js index 79658bf..a54d4cf 100644 --- a/src/index.js +++ b/src/index.js @@ -2,6 +2,7 @@ require('dotenv').config(); const Bot = require('./classes/Bot'); +const { Intents, Options } = require('discord.js'); // Creating a new Bot Client instance const Kiyo = new Bot({ @@ -11,6 +12,14 @@ const Kiyo = new Bot({ type: 'COMPETING', }, }, + makeCache: Options.cacheWithLimits({ + MessageManager: 100 + }), + allowedMentions: { parse: ['roles', 'users'] }, + intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MEMBERS, Intents.FLAGS.GUILD_MESSAGES, Intents.FLAGS.GUILD_MESSAGE_REACTIONS, Intents.FLAGS.GUILD_EMOJIS_AND_STICKERS], + restRequestTimeout: 5000, + restGlobalRateLimit: 40, + large_threshold: 100 }); Kiyo.start(); // Running the bot diff --git a/src/utils/findMember.js b/src/utils/findMember.js index 4878b25..b3fbd84 100644 --- a/src/utils/findMember.js +++ b/src/utils/findMember.js @@ -5,7 +5,7 @@ const { GuildMember, Collection, Message } = require('discord.js'); /** * @param {Message} message * @param {String} arg - * @returns {GuildMember} + * @returns {Promise} */ module.exports = async (message, arg) => { if (!(message instanceof Message)) throw new Error('Parameter `message` is not instance of `Message`');