pineafan | 3276721 | 2022-03-14 21:27:39 +0000 | [diff] [blame] | 1 | const {addLog} = require('../scripts/addLogs'); |
| 2 | module.exports = { |
| 3 | name:'threadDelete', |
| 4 | once:false, |
| 5 | async execute(thread) { |
| 6 | |
| 7 | let logs = await thread.guild.fetchAuditLogs({type: 'THREAD_DELETE'}); |
| 8 | let entry = logs.entries.find(e => e.target.id === thread.id); |
| 9 | |
| 10 | let data = { |
| 11 | autoArchiveDuration: thread.autoArchiveDuration, |
| 12 | id: thread.id, |
| 13 | locked: thread.locked, |
| 14 | name: thread.name, |
| 15 | parentChannel: thread.parent.id, |
| 16 | slowmode: thread.rateLimitPerUser, |
| 17 | type: thread.type, |
| 18 | deletedAt: entry.createdTimestamp, |
| 19 | deletedBy: entry.executor.id |
| 20 | } |
| 21 | |
| 22 | addLog(thread.guild.id, data); |
| 23 | |
| 24 | } |
| 25 | } |