From 0f9bd6edeb4c0e1b15b051f4f90252e24b87d892 Mon Sep 17 00:00:00 2001 From: Cynthia Foxwell Date: Sat, 7 Sep 2024 18:10:37 -0600 Subject: [PATCH] codePreviews: i guess we're checking for permissions now --- src/modules/codePreviews.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/modules/codePreviews.js b/src/modules/codePreviews.js index a09a832..49e9c80 100644 --- a/src/modules/codePreviews.js +++ b/src/modules/codePreviews.js @@ -110,6 +110,7 @@ events.add("messageCreate", "codePreviews", async function (msg) { if (msg.author.id == hf.bot.user.id) return; if (!msg.guildID) return; if (!(await hasFlag(msg.guildID, "codePreviews"))) return; + if (!msg.channel.permissionsOf(hf.bot.user.id).has("sendMessages")) return; const files = []; @@ -143,8 +144,8 @@ events.add("messageCreate", "codePreviews", async function (msg) { let out = ""; const allFiles = files.join("\n").trim(); - if (allFiles !== "" && allFiles.length <= 2000) { - await msg.edit({flags: MessageFlags.SUPPRESS_EMBEDS}).catch(() => {}); + if (allFiles !== "" && allFiles.length <= 2000 && msg.channel.permissionsOf(hf.bot.user.id).has("manageMessages")) { + await msg.edit({flags: MessageFlags.SUPPRESS_EMBEDS}); } for (let i = 0; i < files.length; i++) { const file = files[i];