blob: 609ce6f880689ef9a3569707ca059c04daa52515 [file] [log] [blame]
const {addLog} = require('../scripts/addLogs');
module.exports = {
name:'inviteDelete',
once:false,
async execute(invite) {
let logs = await invite.guild.fetchAuditLogs({type: 'INVITE_DELETE'});
let entry = logs.entries.find(e => e.target.code === invite.code);
let data = {
channel: invite.channel.id,
code: invite.code,
deletedAt: invite.deletedTimestamp,
deletedBy: entry.executor.id
}
addLog(invite.guild.id, data)
}
}