diff --git a/backend/package-lock.json b/backend/package-lock.json index 1647e84c..bae5e80a 100644 --- a/backend/package-lock.json +++ b/backend/package-lock.json @@ -13,8 +13,8 @@ "cors": "^2.8.5", "cross-env": "^5.2.0", "deep-diff": "^1.0.2", - "discord-api-types": "^0.31.0", - "discord.js": "^13.6.0", + "discord-api-types": "^0.33.1", + "discord.js": "^13.7.0", "dotenv": "^4.0.0", "emoji-regex": "^8.0.0", "erlpack": "github:discord/erlpack", @@ -124,23 +124,25 @@ } }, "node_modules/@discordjs/builders": { - "version": "0.11.0", - "license": "Apache-2.0", + "version": "0.13.0", + "resolved": "https://registry.npmjs.org/@discordjs/builders/-/builders-0.13.0.tgz", + "integrity": "sha512-4L9y26KRNNU8Y7J78SRUN1Uhava9D8jfit/YqEaKi8gQRc7PdqKqk2poybo6RXaiyt/BgKYPfcjxT7WvzGfYCA==", "dependencies": { - "@sindresorhus/is": "^4.2.0", - "discord-api-types": "^0.26.0", - "ts-mixer": "^6.0.0", - "tslib": "^2.3.1", - "zod": "^3.11.6" + "@sapphire/shapeshift": "^2.0.0", + "@sindresorhus/is": "^4.6.0", + "discord-api-types": "^0.31.1", + "fast-deep-equal": "^3.1.3", + "ts-mixer": "^6.0.1", + "tslib": "^2.3.1" }, "engines": { - "node": ">=16.0.0", - "npm": ">=7.0.0" + "node": ">=16.9.0" } }, "node_modules/@discordjs/builders/node_modules/@sindresorhus/is": { "version": "4.6.0", - "license": "MIT", + "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.6.0.tgz", + "integrity": "sha512-t09vSN3MdfsyCHoFcTRCH/iUtG7OJ0CsjzB8cjAmKc/va/kIgeDI/TxsigdncE/4be734m0cvIYwNaV4i2XqAw==", "engines": { "node": ">=10" }, @@ -149,22 +151,21 @@ } }, "node_modules/@discordjs/builders/node_modules/discord-api-types": { - "version": "0.26.1", - "license": "MIT", - "engines": { - "node": ">=12" - } + "version": "0.31.2", + "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.31.2.tgz", + "integrity": "sha512-gpzXTvFVg7AjKVVJFH0oJGC0q0tO34iJGSHZNz9u3aqLxlD6LfxEs9wWVVikJqn9gra940oUTaPFizCkRDcEiA==" }, "node_modules/@discordjs/builders/node_modules/tslib": { - "version": "2.3.1", - "license": "0BSD" + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz", + "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==" }, "node_modules/@discordjs/collection": { - "version": "0.4.0", - "license": "Apache-2.0", + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-0.6.0.tgz", + "integrity": "sha512-Ieaetb36l0nmAS5X9Upqk4W7euAO6FdXPxn3I8vBAKEcoIzEZI1mcVcPfCfagGJZSgBKpENnAnKkP4GAn+MV8w==", "engines": { - "node": ">=16.0.0", - "npm": ">=7.0.0" + "node": ">=16.9.0" } }, "node_modules/@nodelib/fs.scandir": { @@ -207,6 +208,15 @@ "npm": ">=7.0.0" } }, + "node_modules/@sapphire/shapeshift": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@sapphire/shapeshift/-/shapeshift-2.2.0.tgz", + "integrity": "sha512-UEnKgMlQyI0yY/q+lCMX0VJft9y86IsesgbIQj6e62FBYSaMVr+IaMNpi4z45Q14VnuMACbK0yrbHISNqgUYcQ==", + "engines": { + "node": ">=v15.0.0", + "npm": ">=7.0.0" + } + }, "node_modules/@silvia-odwyer/photon-node": { "version": "0.3.1", "license": "Apache-2.0" @@ -344,8 +354,9 @@ "license": "MIT" }, "node_modules/@types/node-fetch": { - "version": "2.5.12", - "license": "MIT", + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.6.1.tgz", + "integrity": "sha512-oMqjURCaxoSIsHSr1E47QHzbmzNR5rK8McHuNb11BOM9cHcIK3Avy0s/b2JlXHoQGTYS3NsvWzV1M0iK7l0wbA==", "dependencies": { "@types/node": "*", "form-data": "^3.0.0" @@ -1693,22 +1704,24 @@ } }, "node_modules/discord-api-types": { - "version": "0.31.0", - "license": "MIT" + "version": "0.33.1", + "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.33.1.tgz", + "integrity": "sha512-dc7Xzm3isROh77jdxikQnLzKDslOPORm2Q8odXrKgEy8Aqfd1r9ISVTU/xsHkH6bFo+Hjf1A1C5OnBtu8ghy4w==" }, "node_modules/discord.js": { - "version": "13.6.0", - "license": "Apache-2.0", + "version": "13.7.0", + "resolved": "https://registry.npmjs.org/discord.js/-/discord.js-13.7.0.tgz", + "integrity": "sha512-iV/An3FEB/CiBGdjWHRtgskM4UuWPq5vjhjKsrQhdVU16dbKrBxA+eIV2HWA07B3tXUGM6eco1wkr42gxxV1BA==", "dependencies": { - "@discordjs/builders": "^0.11.0", - "@discordjs/collection": "^0.4.0", - "@sapphire/async-queue": "^1.1.9", - "@types/node-fetch": "^2.5.12", - "@types/ws": "^8.2.2", - "discord-api-types": "^0.26.0", + "@discordjs/builders": "^0.13.0", + "@discordjs/collection": "^0.6.0", + "@sapphire/async-queue": "^1.3.1", + "@types/node-fetch": "^2.6.1", + "@types/ws": "^8.5.3", + "discord-api-types": "^0.30.0", "form-data": "^4.0.0", "node-fetch": "^2.6.1", - "ws": "^8.4.0" + "ws": "^8.6.0" }, "engines": { "node": ">=16.6.0", @@ -1716,11 +1729,9 @@ } }, "node_modules/discord.js/node_modules/discord-api-types": { - "version": "0.26.1", - "license": "MIT", - "engines": { - "node": ">=12" - } + "version": "0.30.0", + "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.30.0.tgz", + "integrity": "sha512-wYst0jrT8EJs2tVlwUTQ2xT0oWMjUrRMpFTkNY3NMleWyQNHgWaKhqFfxdLPdC2im9IuR5EsxcEgjhf/npeftw==" }, "node_modules/discord.js/node_modules/form-data": { "version": "4.0.0", @@ -1941,6 +1952,11 @@ "node": ">= 0.10.0" } }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" + }, "node_modules/fast-diff": { "version": "1.2.0", "dev": true, @@ -4506,7 +4522,8 @@ }, "node_modules/ts-mixer": { "version": "6.0.1", - "license": "MIT" + "resolved": "https://registry.npmjs.org/ts-mixer/-/ts-mixer-6.0.1.tgz", + "integrity": "sha512-hvE+ZYXuINrx6Ei6D6hz+PTim0Uf++dYbK9FFifLNwQj+RwKquhQpn868yZsCtJYiclZF1u8l6WZxxKi+vv7Rg==" }, "node_modules/tsc-watch": { "version": "5.0.2", @@ -5106,8 +5123,9 @@ } }, "node_modules/ws": { - "version": "8.5.0", - "license": "MIT", + "version": "8.7.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.7.0.tgz", + "integrity": "sha512-c2gsP0PRwcLFzUiA8Mkr37/MI7ilIlHQxaEAtd0uNMbVMoy8puJyafRlm0bV9MbGSabUPeLrRRaqIBcFcA2Pqg==", "engines": { "node": ">=10.0.0" }, @@ -5305,28 +5323,39 @@ } }, "@discordjs/builders": { - "version": "0.11.0", + "version": "0.13.0", + "resolved": "https://registry.npmjs.org/@discordjs/builders/-/builders-0.13.0.tgz", + "integrity": "sha512-4L9y26KRNNU8Y7J78SRUN1Uhava9D8jfit/YqEaKi8gQRc7PdqKqk2poybo6RXaiyt/BgKYPfcjxT7WvzGfYCA==", "requires": { - "@sindresorhus/is": "^4.2.0", - "discord-api-types": "^0.26.0", - "ts-mixer": "^6.0.0", - "tslib": "^2.3.1", - "zod": "^3.11.6" + "@sapphire/shapeshift": "^2.0.0", + "@sindresorhus/is": "^4.6.0", + "discord-api-types": "^0.31.1", + "fast-deep-equal": "^3.1.3", + "ts-mixer": "^6.0.1", + "tslib": "^2.3.1" }, "dependencies": { "@sindresorhus/is": { - "version": "4.6.0" + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.6.0.tgz", + "integrity": "sha512-t09vSN3MdfsyCHoFcTRCH/iUtG7OJ0CsjzB8cjAmKc/va/kIgeDI/TxsigdncE/4be734m0cvIYwNaV4i2XqAw==" }, "discord-api-types": { - "version": "0.26.1" + "version": "0.31.2", + "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.31.2.tgz", + "integrity": "sha512-gpzXTvFVg7AjKVVJFH0oJGC0q0tO34iJGSHZNz9u3aqLxlD6LfxEs9wWVVikJqn9gra940oUTaPFizCkRDcEiA==" }, "tslib": { - "version": "2.3.1" + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz", + "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==" } } }, "@discordjs/collection": { - "version": "0.4.0" + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-0.6.0.tgz", + "integrity": "sha512-Ieaetb36l0nmAS5X9Upqk4W7euAO6FdXPxn3I8vBAKEcoIzEZI1mcVcPfCfagGJZSgBKpENnAnKkP4GAn+MV8w==" }, "@nodelib/fs.scandir": { "version": "2.1.3", @@ -5351,6 +5380,11 @@ "@sapphire/async-queue": { "version": "1.3.1" }, + "@sapphire/shapeshift": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@sapphire/shapeshift/-/shapeshift-2.2.0.tgz", + "integrity": "sha512-UEnKgMlQyI0yY/q+lCMX0VJft9y86IsesgbIQj6e62FBYSaMVr+IaMNpi4z45Q14VnuMACbK0yrbHISNqgUYcQ==" + }, "@silvia-odwyer/photon-node": { "version": "0.3.1" }, @@ -5462,7 +5496,9 @@ "version": "14.0.14" }, "@types/node-fetch": { - "version": "2.5.12", + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.6.1.tgz", + "integrity": "sha512-oMqjURCaxoSIsHSr1E47QHzbmzNR5rK8McHuNb11BOM9cHcIK3Avy0s/b2JlXHoQGTYS3NsvWzV1M0iK7l0wbA==", "requires": { "@types/node": "*", "form-data": "^3.0.0" @@ -6346,24 +6382,30 @@ } }, "discord-api-types": { - "version": "0.31.0" + "version": "0.33.1", + "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.33.1.tgz", + "integrity": "sha512-dc7Xzm3isROh77jdxikQnLzKDslOPORm2Q8odXrKgEy8Aqfd1r9ISVTU/xsHkH6bFo+Hjf1A1C5OnBtu8ghy4w==" }, "discord.js": { - "version": "13.6.0", + "version": "13.7.0", + "resolved": "https://registry.npmjs.org/discord.js/-/discord.js-13.7.0.tgz", + "integrity": "sha512-iV/An3FEB/CiBGdjWHRtgskM4UuWPq5vjhjKsrQhdVU16dbKrBxA+eIV2HWA07B3tXUGM6eco1wkr42gxxV1BA==", "requires": { - "@discordjs/builders": "^0.11.0", - "@discordjs/collection": "^0.4.0", - "@sapphire/async-queue": "^1.1.9", - "@types/node-fetch": "^2.5.12", - "@types/ws": "^8.2.2", - "discord-api-types": "^0.26.0", + "@discordjs/builders": "^0.13.0", + "@discordjs/collection": "^0.6.0", + "@sapphire/async-queue": "^1.3.1", + "@types/node-fetch": "^2.6.1", + "@types/ws": "^8.5.3", + "discord-api-types": "^0.30.0", "form-data": "^4.0.0", "node-fetch": "^2.6.1", - "ws": "^8.4.0" + "ws": "^8.6.0" }, "dependencies": { "discord-api-types": { - "version": "0.26.1" + "version": "0.30.0", + "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.30.0.tgz", + "integrity": "sha512-wYst0jrT8EJs2tVlwUTQ2xT0oWMjUrRMpFTkNY3NMleWyQNHgWaKhqFfxdLPdC2im9IuR5EsxcEgjhf/npeftw==" }, "form-data": { "version": "4.0.0", @@ -6425,7 +6467,7 @@ }, "erlpack": { "version": "git+ssh://git@github.com/discord/erlpack.git#3b793a333dd3f6a140b9168ea91e9fa9660753ce", - "from": "erlpack@github:discord/erlpack.git", + "from": "erlpack@github:discord/erlpack", "requires": { "bindings": "^1.5.0", "nan": "^2.15.0" @@ -6513,6 +6555,11 @@ "vary": "~1.1.2" } }, + "fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" + }, "fast-diff": { "version": "1.2.0", "dev": true @@ -8117,7 +8164,9 @@ "requires": {} }, "ts-mixer": { - "version": "6.0.1" + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/ts-mixer/-/ts-mixer-6.0.1.tgz", + "integrity": "sha512-hvE+ZYXuINrx6Ei6D6hz+PTim0Uf++dYbK9FFifLNwQj+RwKquhQpn868yZsCtJYiclZF1u8l6WZxxKi+vv7Rg==" }, "tsc-watch": { "version": "5.0.2", @@ -8491,7 +8540,9 @@ } }, "ws": { - "version": "8.5.0", + "version": "8.7.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.7.0.tgz", + "integrity": "sha512-c2gsP0PRwcLFzUiA8Mkr37/MI7ilIlHQxaEAtd0uNMbVMoy8puJyafRlm0bV9MbGSabUPeLrRRaqIBcFcA2Pqg==", "requires": {} }, "xdg-basedir": { diff --git a/backend/package.json b/backend/package.json index fbdac67f..348492c9 100644 --- a/backend/package.json +++ b/backend/package.json @@ -28,8 +28,8 @@ "cors": "^2.8.5", "cross-env": "^5.2.0", "deep-diff": "^1.0.2", - "discord-api-types": "^0.31.0", - "discord.js": "^13.6.0", + "discord-api-types": "^0.33.1", + "discord.js": "^13.7.0", "dotenv": "^4.0.0", "emoji-regex": "^8.0.0", "erlpack": "github:discord/erlpack", diff --git a/backend/src/plugins/InternalPoster/functions/editMessage.ts b/backend/src/plugins/InternalPoster/functions/editMessage.ts index 79165a6d..a0fc7169 100644 --- a/backend/src/plugins/InternalPoster/functions/editMessage.ts +++ b/backend/src/plugins/InternalPoster/functions/editMessage.ts @@ -1,4 +1,11 @@ -import { Message, MessageOptions, NewsChannel, TextChannel, WebhookClient } from "discord.js"; +import { + Message, + MessageEditOptions, + NewsChannel, + TextChannel, + WebhookClient, + WebhookEditMessageOptions, +} from "discord.js"; import { GuildPluginData } from "knub"; import { InternalPosterPluginType } from "../types"; import { isDiscordAPIError, noop } from "../../../utils"; @@ -9,7 +16,7 @@ import { isDiscordAPIError, noop } from "../../../utils"; export async function editMessage( pluginData: GuildPluginData, message: Message, - content: MessageOptions, + content: MessageEditOptions & WebhookEditMessageOptions, ): Promise { if (!(message.channel instanceof TextChannel || message.channel instanceof NewsChannel)) { return; diff --git a/backend/src/plugins/Utility/functions/getChannelInfoEmbed.ts b/backend/src/plugins/Utility/functions/getChannelInfoEmbed.ts index 9d050b3f..5e8e916a 100644 --- a/backend/src/plugins/Utility/functions/getChannelInfoEmbed.ts +++ b/backend/src/plugins/Utility/functions/getChannelInfoEmbed.ts @@ -70,13 +70,13 @@ export async function getChannelInfoEmbed( channelName = channel.name; } - const createdAt = moment.utc(channel.createdAt, "x"); + const createdAt = moment.utc(channel.createdAt!, "x"); const timeAndDate = pluginData.getPlugin(TimeAndDatePlugin); const tzCreatedAt = requestMemberId ? await timeAndDate.inMemberTz(requestMemberId, createdAt) : timeAndDate.inGuildTz(createdAt); const prettyCreatedAt = tzCreatedAt.format(timeAndDate.getDateFormat("pretty_datetime")); - const channelAge = humanizeDuration(Date.now() - channel.createdTimestamp, { + const channelAge = humanizeDuration(Date.now() - channel.createdTimestamp!, { largest: 2, round: true, }); @@ -134,8 +134,9 @@ export async function getChannelInfoEmbed( const memberCount = thread.memberCount ?? thread.members.cache.size; const owner = await thread.fetchOwner().catch(() => null); const ownerMention = owner?.user ? verboseUserMention(owner.user) : "Unknown#0000"; - const autoArchiveDuration = thread.autoArchiveDuration === "MAX" ? 10080 : thread.autoArchiveDuration; // TODO: Boost level check - const humanizedArchiveTime = `Archive duration: **${humanizeDuration((autoArchiveDuration ?? 0) * MINUTES)}**`; + const humanizedArchiveTime = `Archive duration: **${humanizeDuration( + (thread.autoArchiveDuration ?? 0) * MINUTES, + )}**`; embed.fields.push({ name: preEmbedPadding + "Thread information",