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;
|
|
|
|
if (msg.partial) return;
|
|
|
|
if (msg.author.bot) return;
|
2022-11-25 04:39:22 -05:00
|
|
|
if (msg.guildId == client.config.mainServer.id) return;
|
2022-11-18 06:29:03 -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}>\nContent:\n\`\`\`\n${msg?.content}\n\`\`\`\nChannel: <#${msg.channelId}>`)
|
|
|
|
let image;
|
2022-11-15 09:06:18 -05:00
|
|
|
if (msg.attachments?.first()?.width && ['png', 'jpeg', 'jpg', 'gif', 'webp'].some(x=>((msg.attachments.first() as Discord.Attachment).name as string).endsWith(x))) {
|
2022-11-25 04:29:26 -05:00
|
|
|
image = msg.attachments?.first().proxyURL
|
2022-11-18 06:29:03 -05:00
|
|
|
embed.setImage(image)
|
2022-11-15 09:06:18 -05:00
|
|
|
}
|
2022-11-18 06:29:03 -05:00
|
|
|
channel.send({embeds: [embed]})
|
2022-11-15 09:06:18 -05:00
|
|
|
}
|
2022-11-25 04:29:26 -05:00
|
|
|
}
|