pineafan | 3276721 | 2022-03-14 21:27:39 +0000 | [diff] [blame] | 1 | const {addLog} = require('../scripts/addLogs'); |
| 2 | |
| 3 | module.exports = { |
| 4 | name:'messageDeleteBulk', |
| 5 | once:false, |
| 6 | async execute(messages) { |
| 7 | |
| 8 | let logs = await messages.first().guild.fetchAuditLogs({type: 'MESSAGE_DELETE_BULK'}); |
| 9 | let entry = logs.entries.first(); |
| 10 | |
| 11 | let data = { |
| 12 | messages:messages.map(message=>{ |
| 13 | return { |
| 14 | id:message.id, |
| 15 | channel:message.channel.id, |
| 16 | content:message.content |
| 17 | } |
| 18 | }), |
| 19 | deletedBy:entry.executor.id, |
| 20 | deletedAt:entry.createdAt |
| 21 | } |
| 22 | |
| 23 | addLog(messages.first().guild.id, data); |
| 24 | } |
| 25 | } |