2022-11-15 09:06:18 -05:00
|
|
|
import Discord from 'discord.js';
|
2023-04-14 06:47:58 -04:00
|
|
|
import TClient from '../client.js';
|
2022-11-15 09:06:18 -05:00
|
|
|
export default {
|
2023-03-05 05:04:10 -05:00
|
|
|
run(client:TClient, msg:Discord.Message){
|
|
|
|
if (!client.config.botSwitches.logs) return;
|
|
|
|
const channel = client.channels.resolve(client.config.mainServer.channels.logs) as Discord.TextChannel;
|
2023-06-22 21:28:45 -04:00
|
|
|
const disabledChannels = ['548032776830582794', '541677709487505408', '949380187668242483']
|
2023-03-05 05:04:10 -05:00
|
|
|
if (msg.guild?.id != client.config.mainServer.id || msg.partial || msg.author.bot || disabledChannels.includes(msg.channelId)) return;
|
2023-04-15 17:55:09 -04:00
|
|
|
if (Discord.DiscordAPIError.name === '10008') return console.log(client.logTime(), 'Caught an unexpected error returned by Discord API. (Unknown Message)');
|
2023-06-09 21:11:19 -04:00
|
|
|
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').setDescription(`<@${msg.author.id}>\n\`${msg.author.id}\``);
|
2023-03-05 05:04:10 -05:00
|
|
|
if (msg.content.length != 0) embed.addFields({name: 'Content', value: `\`\`\`\n${msg.content.slice(0,1000)}\n\`\`\``});
|
|
|
|
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>` }
|
|
|
|
)
|
|
|
|
const attachments: Array<string> = [];
|
2023-05-23 01:14:17 -04:00
|
|
|
msg.attachments.forEach(x=>attachments.push(x.url));
|
2023-03-05 05:04:10 -05:00
|
|
|
channel.send({embeds: [embed], files: attachments})
|
|
|
|
}
|
2022-11-25 04:29:26 -05:00
|
|
|
}
|