upgrade discord.js

This commit is contained in:
almeidx 2021-08-04 20:45:42 +01:00
parent 036d46f08a
commit 3537305c59
No known key found for this signature in database
GPG key ID: 8558FBFF849BD664
32 changed files with 232 additions and 107 deletions

View file

@ -14,7 +14,7 @@
"cors": "^2.8.5",
"cross-env": "^5.2.0",
"deep-diff": "^1.0.2",
"discord.js": "^13.0.0-dev.d310e4f.1627560163",
"discord.js": "^13.0.0-dev.t1628078860.90c2e07",
"dotenv": "^4.0.0",
"emoji-regex": "^8.0.0",
"erlpack": "github:discord/erlpack",
@ -81,8 +81,8 @@
"version": "30.0.0-beta.38",
"license": "MIT",
"dependencies": {
"discord-api-types": "^0.21.0-next.ab1951b.1626870574",
"discord.js": "^13.0.0-dev.4886ae2.1627214570",
"discord-api-types": "^0.18.1",
"discord.js": "github:monbrey/discord.js#9c42f571093b2565df28b756fdca4ac59cad0fe3",
"knub-command-manager": "^9.1.0",
"ts-essentials": "^6.0.7"
},
@ -161,11 +161,14 @@
}
},
"node_modules/@discordjs/builders": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/@discordjs/builders/-/builders-0.2.0.tgz",
"integrity": "sha512-TVq7NZBCJrrTRc3CfxOr3IdgY5nrtqVxZ7qDUF1mN6LgxIiOldmFxsSwMrQBzLFVmOwqFyNLKCeblley8UpEuw==",
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/@discordjs/builders/-/builders-0.3.0.tgz",
"integrity": "sha512-yFBPqohVAtCWoDTQCYk5ubgmkiRbGpbiR4RfYGHCmV5S2YZc7j8WzfKVksjuy2o5IWRfXFsW6G2Lr+KpW41pEA==",
"dependencies": {
"discord-api-types": "^0.18.1",
"@sindresorhus/is": "^4.0.1",
"discord-api-types": "^0.22.0",
"ow": "^0.26.0",
"ts-mixer": "^5.4.1",
"tslib": "^2.3.0"
},
"engines": {
@ -173,15 +176,29 @@
"npm": ">=7.0.0"
}
},
"node_modules/@discordjs/builders/node_modules/@sindresorhus/is": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.0.1.tgz",
"integrity": "sha512-Qm9hBEBu18wt1PO2flE7LPb30BHMQt1eQgbV76YntdNk73XZGpn3izvGTYxbGgzXKgbCjiia0uxTd3aTNQrY/g==",
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/sindresorhus/is?sponsor=1"
}
},
"node_modules/@discordjs/builders/node_modules/tslib": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.0.tgz",
"integrity": "sha512-N82ooyxVNm6h1riLCoyS9e3fuJ3AMG2zIZs2Gd1ATcSFjSA23Q0fzjjZeh0jbJvWVDZ0cJT8yaNNaaXHzueNjg=="
},
"node_modules/@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==",
"engines": {
"node": ">=14.0.0"
}
},
"node_modules/@discordjs/form-data": {
"version": "3.0.1",
@ -1389,7 +1406,6 @@
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz",
"integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==",
"dev": true,
"engines": {
"node": ">=6"
}
@ -2151,41 +2167,33 @@
}
},
"node_modules/discord-api-types": {
"version": "0.18.1",
"resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.18.1.tgz",
"integrity": "sha512-hNC38R9ZF4uaujaZQtQfm5CdQO58uhdkoHQAVvMfIL0LgOSZeW575W8H6upngQOuoxWd8tiRII3LLJm9zuQKYg==",
"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==",
"engines": {
"node": ">=12"
}
},
"node_modules/discord.js": {
"version": "13.0.0-dev.d310e4f.1627560163",
"resolved": "https://registry.npmjs.org/discord.js/-/discord.js-13.0.0-dev.d310e4f.1627560163.tgz",
"integrity": "sha512-qJmQrG4xCnBqYF/WQIOxl4IWY3gYAwK0UyNOAKhRpHzMXYHX99wx3FcGaYrZiqtXxGbN2lgVanBakKNsq/uYYw==",
"version": "13.0.0-dev.t1628078860.90c2e07",
"resolved": "https://registry.npmjs.org/discord.js/-/discord.js-13.0.0-dev.t1628078860.90c2e07.tgz",
"integrity": "sha512-Yet0FjFizVzCZkV2+cxenTh6Y2CzNWnA9BK12gmifSa6GuUJ0o98ptx5jpo+jpaXpwkKooivOCNl3wrulupmzg==",
"dependencies": {
"@discordjs/builders": "^0.2.0",
"@discordjs/collection": "^0.1.6",
"@discordjs/builders": "^0.3.0",
"@discordjs/collection": "^0.2.1",
"@discordjs/form-data": "^3.0.1",
"@sapphire/async-queue": "^1.1.4",
"@types/ws": "^7.4.5",
"abort-controller": "^3.0.0",
"discord-api-types": "^0.19.0",
"discord-api-types": "^0.22.0",
"node-fetch": "^2.6.1",
"ws": "^7.5.1"
},
"engines": {
"node": ">=14.0.0",
"node": ">=14.6.0",
"npm": ">=7.0.0"
}
},
"node_modules/discord.js/node_modules/discord-api-types": {
"version": "0.19.0",
"resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.19.0.tgz",
"integrity": "sha512-t2HKLd43Lbe+rf+ffYfKVv9Kk5f6p7sFqvO6CMV55ZB0PgZv8WigCkt9FoJciYo5S3Q6CGYK+WnE/ZG+6vkBDQ==",
"engines": {
"node": ">=12"
}
},
"node_modules/dot-prop": {
"version": "5.2.0",
"resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.2.0.tgz",
@ -2277,6 +2285,7 @@
"version": "0.1.3",
"resolved": "git+ssh://git@github.com/discord/erlpack.git#e27db8f82892bdb9b28a0547cc394d68b5d2242d",
"integrity": "sha512-uDE+ma9xOMfF4ncJHoymBWA084DqoO8q/hBDvGx4WUxmvFQfHoCsk3BYk1D1Lei/lhNCZXLf1vkeNYVBSqrSgw==",
"hasInstallScript": true,
"license": "MIT",
"dependencies": {
"bindings": "^1.5.0",
@ -3106,7 +3115,6 @@
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/is-obj/-/is-obj-2.0.0.tgz",
"integrity": "sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w==",
"dev": true,
"engines": {
"node": ">=8"
}
@ -3961,6 +3969,61 @@
"node": ">=0.10.0"
}
},
"node_modules/ow": {
"version": "0.26.0",
"resolved": "https://registry.npmjs.org/ow/-/ow-0.26.0.tgz",
"integrity": "sha512-22YUQW9d6oUSCpIQuBV25djtC1uMtpWqmtUYnuh2UHWeNMpppCFCvq3eSBIWWMDbe2UVq26kWYvBHDzOIu5NYg==",
"dependencies": {
"@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"
},
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/ow/node_modules/@sindresorhus/is": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.0.1.tgz",
"integrity": "sha512-Qm9hBEBu18wt1PO2flE7LPb30BHMQt1eQgbV76YntdNk73XZGpn3izvGTYxbGgzXKgbCjiia0uxTd3aTNQrY/g==",
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/sindresorhus/is?sponsor=1"
}
},
"node_modules/ow/node_modules/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==",
"dependencies": {
"is-obj": "^2.0.0"
},
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/ow/node_modules/type-fest": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/type-fest/-/type-fest-1.3.0.tgz",
"integrity": "sha512-mYUYkAy6fPatVWtUeCV/qGeGL3IVucmdJOzeAEfwgCJDx8gP0JaW8jn6KQ5xDfPec31e0KXWn5EUOZMhquR1zA==",
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/p-cancelable": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-1.1.0.tgz",
@ -5428,6 +5491,11 @@
"node": ">=0.10.0"
}
},
"node_modules/ts-mixer": {
"version": "5.4.1",
"resolved": "https://registry.npmjs.org/ts-mixer/-/ts-mixer-5.4.1.tgz",
"integrity": "sha512-Zo9HgPCtNouDgJ+LGtrzVOjSg8+7WGQktIKLwAfaNrlOK1mWGlz1ejsAF/YqUEqAGjUTeB5fEg8gH9Aui6w9xA=="
},
"node_modules/tsc-watch": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/tsc-watch/-/tsc-watch-4.0.0.tgz",
@ -5903,6 +5971,14 @@
"uuid": "bin/uuid"
}
},
"node_modules/vali-date": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/vali-date/-/vali-date-1.0.0.tgz",
"integrity": "sha1-G5BKWWCfsyjvB4E4Qgk09rhnCaY=",
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/validate-npm-package-license": {
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz",
@ -6437,14 +6513,22 @@
}
},
"@discordjs/builders": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/@discordjs/builders/-/builders-0.2.0.tgz",
"integrity": "sha512-TVq7NZBCJrrTRc3CfxOr3IdgY5nrtqVxZ7qDUF1mN6LgxIiOldmFxsSwMrQBzLFVmOwqFyNLKCeblley8UpEuw==",
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/@discordjs/builders/-/builders-0.3.0.tgz",
"integrity": "sha512-yFBPqohVAtCWoDTQCYk5ubgmkiRbGpbiR4RfYGHCmV5S2YZc7j8WzfKVksjuy2o5IWRfXFsW6G2Lr+KpW41pEA==",
"requires": {
"discord-api-types": "^0.18.1",
"@sindresorhus/is": "^4.0.1",
"discord-api-types": "^0.22.0",
"ow": "^0.26.0",
"ts-mixer": "^5.4.1",
"tslib": "^2.3.0"
},
"dependencies": {
"@sindresorhus/is": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.0.1.tgz",
"integrity": "sha512-Qm9hBEBu18wt1PO2flE7LPb30BHMQt1eQgbV76YntdNk73XZGpn3izvGTYxbGgzXKgbCjiia0uxTd3aTNQrY/g=="
},
"tslib": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.0.tgz",
@ -6453,9 +6537,9 @@
}
},
"@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",
@ -7442,8 +7526,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=="
},
"camelcase": {
"version": "5.3.1",
@ -8029,31 +8112,24 @@
}
},
"discord-api-types": {
"version": "0.18.1",
"resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.18.1.tgz",
"integrity": "sha512-hNC38R9ZF4uaujaZQtQfm5CdQO58uhdkoHQAVvMfIL0LgOSZeW575W8H6upngQOuoxWd8tiRII3LLJm9zuQKYg=="
"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": "13.0.0-dev.d310e4f.1627560163",
"resolved": "https://registry.npmjs.org/discord.js/-/discord.js-13.0.0-dev.d310e4f.1627560163.tgz",
"integrity": "sha512-qJmQrG4xCnBqYF/WQIOxl4IWY3gYAwK0UyNOAKhRpHzMXYHX99wx3FcGaYrZiqtXxGbN2lgVanBakKNsq/uYYw==",
"version": "13.0.0-dev.t1628078860.90c2e07",
"resolved": "https://registry.npmjs.org/discord.js/-/discord.js-13.0.0-dev.t1628078860.90c2e07.tgz",
"integrity": "sha512-Yet0FjFizVzCZkV2+cxenTh6Y2CzNWnA9BK12gmifSa6GuUJ0o98ptx5jpo+jpaXpwkKooivOCNl3wrulupmzg==",
"requires": {
"@discordjs/builders": "^0.2.0",
"@discordjs/collection": "^0.1.6",
"@discordjs/builders": "^0.3.0",
"@discordjs/collection": "^0.2.1",
"@discordjs/form-data": "^3.0.1",
"@sapphire/async-queue": "^1.1.4",
"@types/ws": "^7.4.5",
"abort-controller": "^3.0.0",
"discord-api-types": "^0.19.0",
"discord-api-types": "^0.22.0",
"node-fetch": "^2.6.1",
"ws": "^7.5.1"
},
"dependencies": {
"discord-api-types": {
"version": "0.19.0",
"resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.19.0.tgz",
"integrity": "sha512-t2HKLd43Lbe+rf+ffYfKVv9Kk5f6p7sFqvO6CMV55ZB0PgZv8WigCkt9FoJciYo5S3Q6CGYK+WnE/ZG+6vkBDQ=="
}
}
},
"dot-prop": {
@ -8760,8 +8836,7 @@
"is-obj": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/is-obj/-/is-obj-2.0.0.tgz",
"integrity": "sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w==",
"dev": true
"integrity": "sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w=="
},
"is-path-cwd": {
"version": "2.2.0",
@ -8877,8 +8952,8 @@
"@typescript-eslint/eslint-plugin": "^4.23.0",
"@typescript-eslint/parser": "^4.23.0",
"chai": "^4.3.4",
"discord-api-types": "^0.21.0-next.ab1951b.1626870574",
"discord.js": "^13.0.0-dev.4886ae2.1627214570",
"discord-api-types": "^0.18.1",
"discord.js": "github:monbrey/discord.js#9c42f571093b2565df28b756fdca4ac59cad0fe3",
"eslint": "^7.2.0",
"husky": "^4.3.8",
"knub-command-manager": "^9.1.0",
@ -9462,6 +9537,39 @@
"resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz",
"integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ="
},
"ow": {
"version": "0.26.0",
"resolved": "https://registry.npmjs.org/ow/-/ow-0.26.0.tgz",
"integrity": "sha512-22YUQW9d6oUSCpIQuBV25djtC1uMtpWqmtUYnuh2UHWeNMpppCFCvq3eSBIWWMDbe2UVq26kWYvBHDzOIu5NYg==",
"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": {
"@sindresorhus/is": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.0.1.tgz",
"integrity": "sha512-Qm9hBEBu18wt1PO2flE7LPb30BHMQt1eQgbV76YntdNk73XZGpn3izvGTYxbGgzXKgbCjiia0uxTd3aTNQrY/g=="
},
"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"
}
},
"type-fest": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/type-fest/-/type-fest-1.3.0.tgz",
"integrity": "sha512-mYUYkAy6fPatVWtUeCV/qGeGL3IVucmdJOzeAEfwgCJDx8gP0JaW8jn6KQ5xDfPec31e0KXWn5EUOZMhquR1zA=="
}
}
},
"p-cancelable": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-1.1.0.tgz",
@ -10623,6 +10731,11 @@
"integrity": "sha1-n5up2e+odkw4dpi8v+sshI8RrbM=",
"dev": true
},
"ts-mixer": {
"version": "5.4.1",
"resolved": "https://registry.npmjs.org/ts-mixer/-/ts-mixer-5.4.1.tgz",
"integrity": "sha512-Zo9HgPCtNouDgJ+LGtrzVOjSg8+7WGQktIKLwAfaNrlOK1mWGlz1ejsAF/YqUEqAGjUTeB5fEg8gH9Aui6w9xA=="
},
"tsc-watch": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/tsc-watch/-/tsc-watch-4.0.0.tgz",
@ -10976,6 +11089,11 @@
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz",
"integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA=="
},
"vali-date": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/vali-date/-/vali-date-1.0.0.tgz",
"integrity": "sha1-G5BKWWCfsyjvB4E4Qgk09rhnCaY="
},
"validate-npm-package-license": {
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz",

View file

@ -29,7 +29,7 @@
"cors": "^2.8.5",
"cross-env": "^5.2.0",
"deep-diff": "^1.0.2",
"discord.js": "^13.0.0-dev.d310e4f.1627560163",
"discord.js": "^13.0.0-dev.t1628078860.90c2e07",
"dotenv": "^4.0.0",
"emoji-regex": "^8.0.0",
"erlpack": "github:discord/erlpack",

View file

@ -45,9 +45,9 @@ export class GuildSavedMessages extends BaseGuildRepository {
timestamp: msg.createdTimestamp,
};
if (msg.attachments.size) data.attachments = msg.attachments.array();
if (msg.attachments.size) data.attachments = [...msg.attachments.values()];
if (msg.embeds.length) data.embeds = msg.embeds;
if (msg.stickers?.size) data.stickers = msg.stickers.array();
if (msg.stickers?.size) data.stickers = [...msg.stickers.values()];
return data;
}

View file

@ -53,7 +53,7 @@ export const AddRolesAction = automodAction({
await Promise.all(
members.map(async member => {
const memberRoles = new Set(member.roles.cache.keyArray());
const memberRoles = new Set(member.roles.cache.keys());
for (const roleId of rolesToAssign) {
memberRoles.add(roleId as Snowflake);
ignoreRoleChange(pluginData, member.id, roleId);

View file

@ -54,7 +54,7 @@ export const RemoveRolesAction = automodAction({
await Promise.all(
members.map(async member => {
const memberRoles = new Set(member.roles.cache.keyArray());
const memberRoles = new Set(member.roles.cache.keys());
for (const roleId of rolesToRemove) {
memberRoles.delete(roleId as Snowflake);
ignoreRoleChange(pluginData, member.id, roleId);

View file

@ -31,6 +31,6 @@ export async function addRoleAction(
const rolesToAdd = Array.isArray(action.role) ? action.role : [action.role];
await target.edit({
roles: Array.from(new Set([...target.roles.cache.array(), ...rolesToAdd])) as Snowflake[],
roles: Array.from(new Set([...target.roles.cache.values(), ...rolesToAdd])) as Snowflake[],
});
}

View file

@ -27,8 +27,8 @@ export const LogsGuildMemberUpdateEvt = logsEvt({
}
if (!isEqual(oldMember.roles, member.roles)) {
const addedRoles = diff(member.roles.cache.keyArray(), oldMember.roles.cache.keyArray());
const removedRoles = diff(oldMember.roles.cache.keyArray(), member.roles.cache.keyArray());
const addedRoles = diff([...member.roles.cache.keys()], [...oldMember.roles.cache.keys()]);
const removedRoles = diff([...oldMember.roles.cache.keys()], [...member.roles.cache.keys()]);
let skip = false;
if (

View file

@ -16,7 +16,7 @@ export const SavePinsToDBCmd = messageSaverCmd({
await msg.channel.send(`Saving pins from <#${args.channel.id}>...`);
const pins = await args.channel.messages.fetchPinned();
const { savedCount, failed } = await saveMessagesToDB(pluginData, args.channel, pins.keyArray());
const { savedCount, failed } = await saveMessagesToDB(pluginData, args.channel, [...pins.keys()]);
if (failed.length) {
sendSuccessMessage(

View file

@ -60,7 +60,7 @@ export const AddCaseCmd = modActionsCmd({
return;
}
const reason = formatReasonWithAttachments(args.reason, msg.attachments.array());
const reason = formatReasonWithAttachments(args.reason, [...msg.attachments.values()]);
// Create the case
const casesPlugin = pluginData.getPlugin(CasesPlugin);

View file

@ -51,7 +51,7 @@ export const BanCmd = modActionsCmd({
}
const time = args["time"] ? args["time"] : null;
const reason = formatReasonWithAttachments(args.reason, msg.attachments.array());
const reason = formatReasonWithAttachments(args.reason, [...msg.attachments.values()]);
const memberToBan = await resolveMember(pluginData.client, pluginData.guild, user.id);
// The moderator who did the action is the message author or, if used, the specified -mod
let mod = msg.member;

View file

@ -61,7 +61,7 @@ export const ForcebanCmd = modActionsCmd({
mod = args.mod;
}
const reason = formatReasonWithAttachments(args.reason, msg.attachments.array());
const reason = formatReasonWithAttachments(args.reason, [...msg.attachments.values()]);
ignoreEvent(pluginData, IgnoredEventType.Ban, user.id);
pluginData.state.serverLogs.ignoreLog(LogType.MEMBER_BAN, user.id);

View file

@ -39,7 +39,7 @@ export const MassbanCmd = modActionsCmd({
return;
}
const banReason = formatReasonWithAttachments(banReasonReply.content, msg.attachments.array());
const banReason = formatReasonWithAttachments(banReasonReply.content, [...msg.attachments.values()]);
// Verify we can act on each of the users specified
for (const userId of args.userIds) {

View file

@ -37,7 +37,7 @@ export const MassunbanCmd = modActionsCmd({
return;
}
const unbanReason = formatReasonWithAttachments(unbanReasonReply.content, msg.attachments.array());
const unbanReason = formatReasonWithAttachments(unbanReasonReply.content, [...msg.attachments.values()]);
// Ignore automatic unban cases and logs for these users
// We'll create our own cases below and post a single "mass unbanned" log instead

View file

@ -39,7 +39,7 @@ export const MassmuteCmd = modActionsCmd({
return;
}
const muteReason = formatReasonWithAttachments(muteReasonReceived.content, msg.attachments.array());
const muteReason = formatReasonWithAttachments(muteReasonReceived.content, [...msg.attachments.values()]);
// Verify we can act upon all users
for (const userId of args.userIds) {

View file

@ -31,7 +31,7 @@ export const NoteCmd = modActionsCmd({
}
const userName = user.tag;
const reason = formatReasonWithAttachments(args.note, msg.attachments.array());
const reason = formatReasonWithAttachments(args.note, [...msg.attachments.values()]);
const casesPlugin = pluginData.getPlugin(CasesPlugin);
const createdCase = await casesPlugin.createCase({

View file

@ -47,7 +47,7 @@ export const UnbanCmd = modActionsCmd({
}
pluginData.state.serverLogs.ignoreLog(LogType.MEMBER_UNBAN, user.id);
const reason = formatReasonWithAttachments(args.reason, msg.attachments.array());
const reason = formatReasonWithAttachments(args.reason, [...msg.attachments.values()]);
try {
ignoreEvent(pluginData, IgnoredEventType.Unban, user.id);

View file

@ -63,7 +63,7 @@ export const WarnCmd = modActionsCmd({
}
const config = pluginData.config.get();
const reason = formatReasonWithAttachments(args.reason, msg.attachments.array());
const reason = formatReasonWithAttachments(args.reason, [...msg.attachments.values()]);
const casesPlugin = pluginData.getPlugin(CasesPlugin);
const priorWarnAmount = await casesPlugin.getCaseTypeAmountForUserId(memberToWarn.id, CaseTypes.Warn);

View file

@ -42,7 +42,7 @@ export async function actualMuteUserCmd(
}
const timeUntilUnmute = args.time && humanizeDuration(args.time);
const reason = args.reason ? formatReasonWithAttachments(args.reason, msg.attachments.array()) : undefined;
const reason = args.reason ? formatReasonWithAttachments(args.reason, [...msg.attachments.values()]) : undefined;
let muteResult: MuteResult;
const mutesPlugin = pluginData.getPlugin(MutesPlugin);

View file

@ -27,7 +27,7 @@ export async function actualUnmuteCmd(
pp = msg.author;
}
const reason = args.reason ? formatReasonWithAttachments(args.reason, msg.attachments.array()) : undefined;
const reason = args.reason ? formatReasonWithAttachments(args.reason, [...msg.attachments.values()]) : undefined;
const mutesPlugin = pluginData.getPlugin(MutesPlugin);
const result = await mutesPlugin.unmuteUser(user.id, args.time, {

View file

@ -24,7 +24,7 @@ export async function updateCase(pluginData, msg: Message, args) {
return;
}
const note = formatReasonWithAttachments(args.note, msg.attachments.array());
const note = formatReasonWithAttachments(args.note, [...msg.attachments.values()]);
const casesPlugin = pluginData.getPlugin(CasesPlugin);
await casesPlugin.createCaseNote({

View file

@ -21,7 +21,7 @@ export async function clearExpiredMutes(pluginData: GuildPluginData<MutesPluginT
}
if (mute.roles_to_restore) {
const guildRoles = pluginData.guild.roles.cache;
let newRoles: string[] = member.roles.cache.keyArray();
let newRoles = [...member.roles.cache.keys()];
newRoles =
muteRole && newRoles.includes(muteRole) ? newRoles.splice(newRoles.indexOf(muteRole), 1) : newRoles;
for (const toRestore of mute.roles_to_restore) {

View file

@ -58,7 +58,7 @@ export async function muteUser(
if (member) {
const logs = pluginData.getPlugin(LogsPlugin);
// remove and store any roles to be removed/restored
const currentUserRoles = member.roles.cache.keyArray();
const currentUserRoles = [...member.roles.cache.keys()];
let newRoles: string[] = currentUserRoles;
const removeRoles = removeRolesOnMuteOverride ?? config.remove_roles_on_mute;
const restoreRoles = restoreRolesOnMuteOverride ?? config.restore_roles_on_mute;

View file

@ -42,7 +42,7 @@ export async function unmuteUser(
}
if (existingMute?.roles_to_restore) {
const guildRoles = pluginData.guild.roles.cache;
let newRoles: string[] = member.roles.cache.keyArray();
let newRoles = [...member.roles.cache.keys()];
newRoles = muteRole && newRoles.includes(muteRole) ? newRoles.splice(newRoles.indexOf(muteRole), 1) : newRoles;
for (const toRestore of existingMute.roles_to_restore) {
if (guildRoles.has(toRestore as Snowflake) && toRestore !== muteRole) newRoles.push(toRestore);

View file

@ -141,7 +141,7 @@ export async function actualPostCmd(
author_name: msg.author.tag,
channel_id: targetChannel.id,
content,
attachments: msg.attachments.array(),
attachments: [...msg.attachments.values()],
post_at: postAt
.clone()
.tz("Etc/UTC")
@ -180,7 +180,7 @@ export async function actualPostCmd(
// When the message isn't scheduled for later, post it immediately
if (!opts.schedule) {
await postMessage(pluginData, targetChannel, content, msg.attachments.array(), opts["enable-mentions"]);
await postMessage(pluginData, targetChannel, content, [...msg.attachments.values()], opts["enable-mentions"]);
}
if (opts.repeat) {

View file

@ -24,7 +24,7 @@ export async function addMemberPendingRoleChange(
const member = await resolveMember(pluginData.client, pluginData.guild, memberId);
if (member) {
const newRoleIds = new Set(member.roles.cache.keyArray());
const newRoleIds = new Set(member.roles.cache.keys());
for (const change of newPendingRoleChangeObj.changes) {
if (change.mode === "+") newRoleIds.add(change.roleId as Snowflake);
else newRoleIds.delete(change.roleId as Snowflake);

View file

@ -31,7 +31,7 @@ export const MigratePinsCmd = starboardCmd({
msg.channel.send(`Migrating pins from <#${args.pinChannel.id}> to <#${starboardChannel.id}>...`);
const pins = (await args.pinChannel.messages.fetchPinned()).array();
const pins = [...(await args.pinChannel.messages.fetchPinned().catch(() => [])).values()];
pins.reverse(); // Migrate pins starting from the oldest message
for (const pin of pins) {

View file

@ -118,7 +118,7 @@ export const CleanCmd = utilityCmd({
const deletePins = args["delete-pins"] != null ? args["delete-pins"] : false;
let pins: Message[] = [];
if (!deletePins) {
pins = (await msg.channel.messages.fetchPinned()).array();
pins = [...(await msg.channel.messages.fetchPinned().catch(() => [])).values()];
}
while (messagesToClean.length < args.count) {
@ -128,14 +128,14 @@ export const CleanCmd = utilityCmd({
});
if (potentialMessages.size === 0) break;
const existingStored = await pluginData.state.savedMessages.getMultiple(potentialMessages.keyArray());
const existingStored = await pluginData.state.savedMessages.getMultiple([...potentialMessages.keys()]);
const alreadyStored = existingStored.map(stored => stored.id);
const messagesToStore = potentialMessages
.array()
.filter(potentialMsg => !alreadyStored.includes(potentialMsg.id));
const messagesToStore = [
...potentialMessages.filter(potentialMsg => !alreadyStored.includes(potentialMsg.id)).values(),
];
await pluginData.state.savedMessages.createFromMessages(messagesToStore);
const potentialMessagesToClean = await pluginData.state.savedMessages.getMultiple(potentialMessages.keyArray());
const potentialMessagesToClean = await pluginData.state.savedMessages.getMultiple([...potentialMessages.keys()]);
if (potentialMessagesToClean.length === 0) break;
const filtered: SavedMessage[] = [];

View file

@ -32,7 +32,7 @@ export const VcdisconnectCmd = utilityCmd({
const channel = pluginData.guild.channels.cache.get(args.member.voice.channelId) as VoiceChannel;
try {
await args.member.voice.kick();
await args.member.voice.disconnect();
} catch {
sendErrorMessage(pluginData, msg.channel, "Failed to disconnect member");
return;

View file

@ -9,6 +9,7 @@ import { LogType } from "../../../data/LogType";
import { canActOn, sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
import { channelMentionRegex, isSnowflake, simpleClosestStringMatch } from "../../../utils";
import { utilityCmd } from "../types";
import { ChannelTypeStrings } from "../../../types";
export const VcmoveCmd = utilityCmd({
trigger: "vcmove",
@ -45,9 +46,11 @@ export const VcmoveCmd = utilityCmd({
channel = potentialChannel;
} else {
// Search string -> find closest matching voice channel name
const voiceChannels = pluginData.guild.channels.cache.array().filter(theChannel => {
return theChannel instanceof VoiceChannel;
}) as VoiceChannel[];
const voiceChannels = [
...pluginData.guild.channels.cache
.filter((c): c is VoiceChannel => c.type === ChannelTypeStrings.VOICE)
.values(),
];
const closestMatch = simpleClosestStringMatch(args.channel, voiceChannels, ch => ch.name);
if (!closestMatch) {
sendErrorMessage(pluginData, msg.channel, "No matching voice channels");
@ -124,9 +127,11 @@ export const VcmoveAllCmd = utilityCmd({
channel = potentialChannel;
} else {
// Search string -> find closest matching voice channel name
const voiceChannels = pluginData.guild.channels.cache.array().filter(theChannel => {
return theChannel instanceof VoiceChannel;
}) as VoiceChannel[];
const voiceChannels = [
...pluginData.guild.channels.cache
.filter((c): c is VoiceChannel => c.type === ChannelTypeStrings.VOICE)
.values(),
];
const closestMatch = simpleClosestStringMatch(args.channel, voiceChannels, ch => ch.name);
if (!closestMatch) {
sendErrorMessage(pluginData, msg.channel, "No matching voice channels");

View file

@ -130,11 +130,13 @@ export async function getChannelInfoEmbed(
if (channel.type === ChannelTypeStrings.PRIVATE_THREAD || channel.type === ChannelTypeStrings.PUBLIC_THREAD) {
const thread = channel as ThreadChannel;
const parentChannelName = thread.parent?.name ? thread.parent.name : `<#${thread.parentId}>`;
const parentChannelName = thread.parent?.name ?? `<#${thread.parentId}>`;
const memberCount = thread.memberCount ?? thread.members.cache.size;
const owner = await pluginData.guild.members.fetch(thread.ownerId).catch(() => null);
const ownerMention = owner ? verboseUserMention(owner.user) : "Unknown#0000";
const humanizedArchiveTime = `Archive duration: **${humanizeDuration(thread.autoArchiveDuration * MINUTES)}**`;
const owner = await thread.fetchOwner().catch(() => null);
const ownerMention = owner?.user ? verboseUserMention(owner.user) : "Unknown#0000";
const humanizedArchiveTime = `Archive duration: **${humanizeDuration(
(thread.autoArchiveDuration ?? 0) * MINUTES,
)}**`;
embed.fields.push({
name: preEmbedPadding + "Thread information",

View file

@ -535,7 +535,7 @@ export async function findRelevantAuditLogEntry(
}
}
const entries = auditLogs ? auditLogs.entries.array() : [];
const entries = auditLogs ? [...auditLogs.entries.values()] : [];
entries.sort((a, b) => {
if (a.createdAt > b.createdAt) return -1;
@ -1302,7 +1302,7 @@ export async function resolveInvite<T extends boolean>(
return promise as ResolveInviteReturnType<T>;
}
const internalStickerCache: LimitedCollection<Snowflake, Sticker> = new LimitedCollection(500);
const internalStickerCache: LimitedCollection<Snowflake, Sticker> = new LimitedCollection({ maxSize: 500 });
export async function resolveStickerId(bot: Client, id: Snowflake): Promise<Sticker | null> {
const cachedSticker = internalStickerCache.get(id);

View file

@ -87,7 +87,7 @@ export function memberToConfigAccessibleMember(member: GuildMember | PartialGuil
...user,
user,
nick: member.nickname ?? "*None*",
roles: member.roles.cache.mapValues(r => roleToConfigAccessibleRole(r)).array(),
roles: [...member.roles.cache.mapValues(r => roleToConfigAccessibleRole(r)).values()],
joinedAt: member.joinedTimestamp ?? undefined,
guildName: member.guild.name,
};