diff --git a/package.json b/package.json index ed55f90..b083982 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "@toast/tokenservice-client": "1.3.0", "ansi-colors": "4.1.3", "dayjs": "1.11.13", - "discord.js": "14.16.1", + "discord.js": "14.16.2", "fast-xml-parser": "4.5.0", "mathjs": "13.1.1", "ms": "2.1.3", diff --git a/src/components/Automod.ts b/src/components/Automod.ts index 8ee2bc5..891e9df 100644 --- a/src/components/Automod.ts +++ b/src/components/Automod.ts @@ -40,7 +40,11 @@ export default class Automoderator { static async imageOnly(message:Discord.Message) { const io_channels = ['468896467688620032']; let deleteReason:string = 'This is an image-only channel and your message did not contain any images.'; - if (io_channels.includes(message.channelId) && message.attachments.size < 1 && message.attachments.every(x=>!x.contentType.includes('image/'))) - await message.delete().then(()=>(message.channel as Discord.TextChannel).send(deleteReason).then((msg:Discord.Message)=>setTimeout(()=>msg.delete(), 8000))); + if (io_channels.includes(message.channelId) && message.attachments.size < 1 && message.attachments.every(x=>!x.contentType.includes('image/'))) { + await message.delete().then(()=>{ + if (!message.channel.isSendable()) return; + message.channel.send(deleteReason).then((msg:Discord.Message)=>setTimeout(()=>msg.delete(), 8000)) + }); + } } } diff --git a/yarn.lock b/yarn.lock index 6abb78b..c3cf564 100644 --- a/yarn.lock +++ b/yarn.lock @@ -531,16 +531,7 @@ __metadata: languageName: node linkType: hard -"@types/node@npm:*": - version: 22.5.2 - resolution: "@types/node@npm:22.5.2" - dependencies: - undici-types: "npm:~6.19.2" - checksum: 10/c4634118abc36d1436d62e192f7088c211139165a395f1cdacca28df421d8dc8dd332b3104d72fc37764d73a205a4bbbe6e6abdc817c2c81883e147d1a96d497 - languageName: node - linkType: hard - -"@types/node@npm:22.5.4": +"@types/node@npm:*, @types/node@npm:22.5.4": version: 22.5.4 resolution: "@types/node@npm:22.5.4" dependencies: @@ -550,13 +541,13 @@ __metadata: linkType: hard "@types/pg@npm:^8.11.4": - version: 8.11.8 - resolution: "@types/pg@npm:8.11.8" + version: 8.11.9 + resolution: "@types/pg@npm:8.11.9" dependencies: "@types/node": "npm:*" pg-protocol: "npm:*" pg-types: "npm:^4.0.1" - checksum: 10/f2b9e616504d3228e93d0d3d03f1d2f364dddd7dae1351314f664674ac41c38c6a59a0284a96f4bb1a5f85f416464b934b2bd4bed943a24ac5b95e23b0d3f457 + checksum: 10/92b0844d5f5fb9a06d96824c5f9e654317687d12cd9d1310b6fe2b71bbbb5c5e3fc3bd4461be7e340b06bab1b5d4616a09029d9ac9f6441a247e734f95c0349d languageName: node linkType: hard @@ -676,7 +667,7 @@ __metadata: "@types/node-cron": "npm:3.0.11" ansi-colors: "npm:4.1.3" dayjs: "npm:1.11.13" - discord.js: "npm:14.16.1" + discord.js: "npm:14.16.2" fast-xml-parser: "npm:4.5.0" mathjs: "npm:13.1.1" ms: "npm:2.1.3" @@ -697,14 +688,14 @@ __metadata: linkType: hard "debug@npm:^4.1.1, debug@npm:^4.3.4, debug@npm:^4.3.5": - version: 4.3.6 - resolution: "debug@npm:4.3.6" + version: 4.3.7 + resolution: "debug@npm:4.3.7" dependencies: - ms: "npm:2.1.2" + ms: "npm:^2.1.3" peerDependenciesMeta: supports-color: optional: true - checksum: 10/d3adb9af7d57a9e809a68f404490cf776122acca16e6359a2702c0f462e510e91f9765c07f707b8ab0d91e03bad57328f3256f5082631cefb5393d0394d50fb7 + checksum: 10/71168908b9a78227ab29d5d25fe03c5867750e31ce24bf2c44a86efc5af041758bb56569b0a3d48a9b5344c00a24a777e6f4100ed6dfd9534a42c1dde285125a languageName: node linkType: hard @@ -729,9 +720,9 @@ __metadata: languageName: node linkType: hard -"discord.js@npm:14.16.1": - version: 14.16.1 - resolution: "discord.js@npm:14.16.1" +"discord.js@npm:14.16.2": + version: 14.16.2 + resolution: "discord.js@npm:14.16.2" dependencies: "@discordjs/builders": "npm:^1.9.0" "@discordjs/collection": "npm:1.5.3" @@ -745,7 +736,7 @@ __metadata: lodash.snakecase: "npm:4.1.1" tslib: "npm:^2.6.3" undici: "npm:6.19.8" - checksum: 10/e75d0f8dd1a8e9aae313e016ba88d0c4b75dfe502663b08edae94cc99936f634e5647022bae71f517b6233d44af2a8bd4cabbe53db398e954116178b196030c4 + checksum: 10/9da5621e88734b3cc8236de492c4fb6b78ee8c0a9a751472aa221234f66cf741f0947e81eb1842dd5ba711b95228593855a9f16453b4786455f3cb7c7cd1c381 languageName: node linkType: hard @@ -936,14 +927,7 @@ __metadata: languageName: node linkType: hard -"ms@npm:2.1.2": - version: 2.1.2 - resolution: "ms@npm:2.1.2" - checksum: 10/673cdb2c3133eb050c745908d8ce632ed2c02d85640e2edb3ace856a2266a813b30c613569bf3354fdf4ea7d1a1494add3bfa95e2713baa27d0c2c71fc44f58f - languageName: node - linkType: hard - -"ms@npm:2.1.3": +"ms@npm:2.1.3, ms@npm:^2.1.3": version: 2.1.3 resolution: "ms@npm:2.1.3" checksum: 10/aa92de608021b242401676e35cfa5aa42dd70cbdc082b916da7fb925c542173e36bce97ea3e804923fe92c0ad991434e4a38327e15a1b5b5f945d66df615ae6d @@ -1308,9 +1292,9 @@ __metadata: linkType: hard "type-fest@npm:^4.14.0": - version: 4.26.0 - resolution: "type-fest@npm:4.26.0" - checksum: 10/f5fe86d2c3db693f7154c8ab0d228a89394e4c446f2ed30ea3b61afaea9757c87c4e79475ef8d6f5fafbd7a4efd302e3b0237d9657dd425228f20a27feee3aef + version: 4.26.1 + resolution: "type-fest@npm:4.26.1" + checksum: 10/b82676194f80af228cb852e320d2ea8381c89d667d2e4d9f2bdfc8f254bccc039c7741a90c53617a4de0c9fdca8265ed18eb0888cd628f391c5c381c33a9f94b languageName: node linkType: hard