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];