blob: 609ce6f880689ef9a3569707ca059c04daa52515 [file] [log] [blame]
pineafan32767212022-03-14 21:27:39 +00001const {addLog} = require('../scripts/addLogs');
2
3module.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}