codePreviews: i guess we're checking for permissions now

This commit is contained in:
Cynthia Foxwell 2024-09-07 18:10:37 -06:00
parent 37f550ac1e
commit 0f9bd6edeb

View file

@ -110,6 +110,7 @@ events.add("messageCreate", "codePreviews", async function (msg) {
if (msg.author.id == hf.bot.user.id) return; if (msg.author.id == hf.bot.user.id) return;
if (!msg.guildID) return; if (!msg.guildID) return;
if (!(await hasFlag(msg.guildID, "codePreviews"))) return; if (!(await hasFlag(msg.guildID, "codePreviews"))) return;
if (!msg.channel.permissionsOf(hf.bot.user.id).has("sendMessages")) return;
const files = []; const files = [];
@ -143,8 +144,8 @@ events.add("messageCreate", "codePreviews", async function (msg) {
let out = ""; let out = "";
const allFiles = files.join("\n").trim(); const allFiles = files.join("\n").trim();
if (allFiles !== "" && allFiles.length <= 2000) { if (allFiles !== "" && allFiles.length <= 2000 && msg.channel.permissionsOf(hf.bot.user.id).has("manageMessages")) {
await msg.edit({flags: MessageFlags.SUPPRESS_EMBEDS}).catch(() => {}); await msg.edit({flags: MessageFlags.SUPPRESS_EMBEDS});
} }
for (let i = 0; i < files.length; i++) { for (let i = 0; i < files.length; i++) {
const file = files[i]; const file = files[i];