From 0314c1b1b4f8347f6534f1d7e38f09a69204e7b0 Mon Sep 17 00:00:00 2001 From: toast-ts <96593068+toast-ts@users.noreply.github.com> Date: Fri, 26 Jul 2024 23:16:32 +1000 Subject: [PATCH] Filter out pinned messages on delete --- src/events/messageDelete.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/events/messageDelete.ts b/src/events/messageDelete.ts index eb81b4c..5e777ce 100644 --- a/src/events/messageDelete.ts +++ b/src/events/messageDelete.ts @@ -5,7 +5,7 @@ import {disabledChannels} from '../index.js'; export default class MessageDelete { static run(client:TClient, msg:Discord.Message|Discord.PartialMessage){ if (!client.config.botSwitches.logs) return; - if (msg.guild?.id != client.config.dcServer.id || msg.partial || msg.author.bot || disabledChannels.includes(msg.channelId)) return; + if (msg.guild?.id != client.config.dcServer.id || msg.partial || msg.type === Discord.MessageType.ChannelPinnedMessage || msg.author.bot || disabledChannels.includes(msg.channelId)) return; if (Discord.DiscordAPIError.name === '10008') return Logger.console('log', 'MsgDelete', 'Caught an unexpected error returned by Discord API. (Unknown Message)'); const embed = new client.embed().setColor(client.config.embedColorRed).setTimestamp().setAuthor({name: `Author: ${msg.author.username} (${msg.author.id})`, iconURL: `${msg.author.displayAvatarURL()}`}).setTitle('Message deleted'); if (msg.content.length != 0) embed.addFields({name: 'Content', value: `\`\`\`\n${Discord.escapeCodeBlock(msg.content.slice(0,1000))}\n\`\`\``});