1
0
mirror of https://github.com/toast-ts/Daggerbot-TS.git synced 2024-11-18 00:31:00 -05:00
Daggerbot-TS/src/events/messageDelete.ts

17 lines
998 B
TypeScript
Raw Normal View History

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.guild?.id != client.config.mainServer.id) return;
if (msg.partial) return;
if (msg.author.bot) return;
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}>`)
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-25 04:29:26 -05:00
}