2023-04-14 06:47:58 -04:00
|
|
|
import Discord from 'discord.js';
|
|
|
|
import TClient from '../client.js';
|
2023-10-05 07:57:07 -04:00
|
|
|
import {escapeCodeBlock} from 'discord.js';
|
2022-11-15 09:06:18 -05:00
|
|
|
export default {
|
2023-03-05 05:04:10 -05:00
|
|
|
async run(client:TClient, oldMsg:Discord.Message, newMsg:Discord.Message){
|
|
|
|
if (!client.config.botSwitches.logs) return;
|
2023-07-07 09:49:24 -04:00
|
|
|
if (oldMsg.guild?.id != client.config.mainServer.id || oldMsg.author === null || oldMsg?.author.bot || oldMsg.partial || newMsg.partial || !newMsg.member || ['548032776830582794', '541677709487505408', '949380187668242483'].includes(newMsg.channelId)) return;
|
2023-05-29 06:39:33 -04:00
|
|
|
if (await client.bannedWords._content.findOne({_id:newMsg.content.toLowerCase().replaceAll(/[!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?\n]/g, ' ').split(' ')}) && (!client.isStaff(newMsg.member))) newMsg.delete();
|
2023-05-30 04:24:24 -04:00
|
|
|
if (newMsg.content === oldMsg.content) return;
|
2023-10-05 07:57:07 -04:00
|
|
|
(client.channels.resolve(client.config.mainServer.channels.logs) as Discord.TextChannel).send({embeds: [new client.embed().setColor(client.config.embedColor).setTimestamp().setAuthor({name: `Author: ${oldMsg.author.username} (${oldMsg.author.id})`, iconURL: `${oldMsg.author.displayAvatarURL()}`}).setTitle('Message edited').setDescription(`<@${oldMsg.author.id}>\nOld content:\n\`\`\`\n${oldMsg.content.length < 1 ? '(Attachment)' : escapeCodeBlock(oldMsg.content.slice(0,2048))}\n\`\`\`\nNew content:\n\`\`\`\n${escapeCodeBlock(newMsg.content.slice(0,2048))}\`\`\`\nChannel: <#${oldMsg.channelId}>`)], components: [new Discord.ActionRowBuilder<Discord.ButtonBuilder>().addComponents(new Discord.ButtonBuilder().setStyle(5).setURL(`${oldMsg.url}`).setLabel('Jump to message'))]});
|
2023-03-05 05:04:10 -05:00
|
|
|
}
|
2022-11-25 04:52:31 -05:00
|
|
|
}
|