diff --git a/bot/src/bot/commands/moderation/purge.ts b/bot/src/bot/commands/moderation/purge.ts index 6cc7e0a..66dbb7b 100644 --- a/bot/src/bot/commands/moderation/purge.ts +++ b/bot/src/bot/commands/moderation/purge.ts @@ -85,8 +85,12 @@ export default { .catch(console.error); setTimeout(async () => { - await replyMsg?.delete(); - if (!messages.find(m => m._id == message._id)) await message.delete(); + try { + await message.channel?.deleteMessages([ + replyMsg!._id, + message._id, + ]); + } catch(e) { console.error(e) } }, 6000); } catch(e) { console.error(e); diff --git a/bot/src/bot/modules/mod_logs.ts b/bot/src/bot/modules/mod_logs.ts index 0abe445..c23adcb 100644 --- a/bot/src/bot/modules/mod_logs.ts +++ b/bot/src/bot/modules/mod_logs.ts @@ -106,6 +106,33 @@ client.on('packet', async (packet) => { 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 {