mirror of
https://github.com/janderedev/automod.git
synced 2024-12-22 10:45:27 +00:00
log bulk deletes in message log
This commit is contained in:
parent
587e35b44e
commit
db88b94fee
|
@ -85,8 +85,12 @@ export default {
|
||||||
.catch(console.error);
|
.catch(console.error);
|
||||||
|
|
||||||
setTimeout(async () => {
|
setTimeout(async () => {
|
||||||
await replyMsg?.delete();
|
try {
|
||||||
if (!messages.find(m => m._id == message._id)) await message.delete();
|
await message.channel?.deleteMessages([
|
||||||
|
replyMsg!._id,
|
||||||
|
message._id,
|
||||||
|
]);
|
||||||
|
} catch(e) { console.error(e) }
|
||||||
}, 6000);
|
}, 6000);
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
|
|
|
@ -106,6 +106,33 @@ client.on('packet', async (packet) => {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (packet.type == 'BulkMessageDelete') {
|
||||||
|
const channel = client.channels.get(packet.channel);
|
||||||
|
if (!channel) return;
|
||||||
|
|
||||||
|
try {
|
||||||
|
let config = await dbs.SERVERS.findOne({ id: channel.server?._id });
|
||||||
|
if (config?.logs?.messageUpdate) {
|
||||||
|
let embed: LogMessage = {
|
||||||
|
title: `Bulk delete in in ${channel.server?.name}`,
|
||||||
|
description: `${packet.ids.length} messages deleted in ` +
|
||||||
|
`[#${channel.name}](/server/${channel.server_id}/channel/${channel._id})`,
|
||||||
|
fields: [],
|
||||||
|
color: '#ff392b',
|
||||||
|
overrides: {
|
||||||
|
discord: {
|
||||||
|
description: `${packet.ids.length} messages deleted in #${channel.name}`,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
await sendLogMessage(config.logs.messageUpdate, embed);
|
||||||
|
}
|
||||||
|
} catch(e) {
|
||||||
|
console.error(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
async function logModAction(type: 'warn'|'kick'|'ban'|'votekick', server: Server, mod: Member, target: string, reason: string|null, infractionID: string, extraText?: string): Promise<void> {
|
async function logModAction(type: 'warn'|'kick'|'ban'|'votekick', server: Server, mod: Member, target: string, reason: string|null, infractionID: string, extraText?: string): Promise<void> {
|
||||||
|
|
Loading…
Reference in a new issue