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