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