pineafan | 3276721 | 2022-03-14 21:27:39 +0000 | [diff] [blame^] | 1 | const {addLog} = require('../scripts/addLogs'); |
| 2 | |
| 3 | module.exports = { |
| 4 | name:'inviteDelete', |
| 5 | once:false, |
| 6 | async execute(invite) { |
| 7 | |
| 8 | let logs = await invite.guild.fetchAuditLogs({type: 'INVITE_DELETE'}); |
| 9 | let entry = logs.entries.find(e => e.target.code === invite.code); |
| 10 | |
| 11 | let data = { |
| 12 | channel: invite.channel.id, |
| 13 | code: invite.code, |
| 14 | deletedAt: invite.deletedTimestamp, |
| 15 | deletedBy: entry.executor.id |
| 16 | } |
| 17 | |
| 18 | addLog(invite.guild.id, data) |
| 19 | |
| 20 | } |
| 21 | } |