2023-01-02 04:45:05 -05:00
|
|
|
import Discord from 'discord.js';
|
2023-04-14 06:47:58 -04:00
|
|
|
import TClient from '../client.js';
|
2023-12-24 10:21:40 -05:00
|
|
|
export default class MessageDeleteBulk {
|
|
|
|
static run(client:TClient, messages:Discord.Collection<string, Discord.Message<boolean>>, channel:Discord.GuildTextBasedChannel){
|
|
|
|
if (!client.config.botSwitches.logs || channel.guildId != client.config.dcServer.id) return;
|
2024-02-01 15:12:15 -05:00
|
|
|
if (messages.some(msg=>{
|
|
|
|
msg.author?.username === undefined ?? null;
|
|
|
|
msg.content === undefined ?? null;
|
|
|
|
})) return;
|
|
|
|
|
|
|
|
(client.channels.resolve(client.config.dcServer.channels.logs) as Discord.TextChannel).send({embeds: [
|
|
|
|
new client.embed().setColor(client.config.embedColorRed).setTimestamp()
|
|
|
|
.setTitle(`${messages.size} messages were purged`)
|
|
|
|
.setDescription(`\`\`\`${messages.map(msgs=>`${msgs.author?.username}: ${msgs.content}`).reverse().join('\n').slice(0,3900)}\`\`\``)
|
|
|
|
.addFields({name: 'Channel', value: `<#${messages.first().channel.id}>`})
|
|
|
|
]});
|
2023-03-05 05:04:10 -05:00
|
|
|
}
|
|
|
|
}
|