2022-11-15 09:06:18 -05:00
|
|
|
import Discord from 'discord.js';
|
|
|
|
import { TClient } from '../client';
|
|
|
|
export default {
|
|
|
|
name: 'messageDelete',
|
|
|
|
execute: async(client:TClient, msg:Discord.Message)=>{
|
|
|
|
if (!client.config.botSwitches.logs) return;
|
|
|
|
const channel = client.channels.resolve(client.config.mainServer.channels.logs) as Discord.TextChannel;
|
2022-11-25 04:41:45 -05:00
|
|
|
if (msg.guild?.id != client.config.mainServer.id) return;
|
2022-11-15 09:06:18 -05:00
|
|
|
if (msg.partial) return;
|
|
|
|
if (msg.author.bot) return;
|
2022-12-24 06:13:22 -05:00
|
|
|
const embed = new client.embed().setColor(client.config.embedColorRed).setTimestamp().setAuthor({name: `Author: ${msg.author.tag} (${msg.author.id})`, iconURL: `${msg.author.displayAvatarURL()}`}).setTitle('Message deleted').setDescription(`<@${msg.author.id}>\n\`${msg.author.id}\``);
|
2022-12-26 12:44:37 -05:00
|
|
|
if (msg.content.length != 0) embed.addFields({name: 'Content', value: `\`\`\`\n${msg.content.slice(0,1000)}\n\`\`\``});
|
2022-12-24 06:13:22 -05:00
|
|
|
embed.addFields(
|
|
|
|
{ name: 'Channel', value: `<#${msg.channelId}>` },
|
|
|
|
{ name: 'Sent at', value: `<t:${Math.round(msg.createdTimestamp/1000)}>\n<t:${Math.round(msg.createdTimestamp/1000)}:R>` }
|
|
|
|
)
|
2022-11-26 16:00:41 -05:00
|
|
|
const attachments: Array<string> = [];
|
|
|
|
msg.attachments.forEach((x) => attachments.push(x.url));
|
|
|
|
channel.send({embeds: [embed], files: attachments})
|
2022-11-15 09:06:18 -05:00
|
|
|
}
|
2022-11-25 04:29:26 -05:00
|
|
|
}
|