blob: cc37a7339381c266ba6f689d9a6eef2797d57c41 [file] [log] [blame]
pineafan32767212022-03-14 21:27:39 +00001const {addLog} = require('../scripts/addLogs');
2const JsonDiff = require('json-diff');
3
4module.exports = {
5 name:'guildScheduledEventUpdate',
6 once:false,
7 async execute(oldEvent, newEvent) {
8 let oe = {
9 id: oldEvent.id,
10 name: oldEvent.name,
11 description: oldEvent.description,
12 channel: oldEvent.channel ? oldEvent.channel.id : null,
13 time: {
14 start: oldEvent.scheduledStartTimestamp,
15 end: oldEvent.scheduledEndTimestamp
16 },
17 date: oldEvent.date,
18 privacyLevel: oldEvent.privacyLevel,
19 entityType: oldEvent.entityType,
20 entityMetadata: oldEvent.entityMetadata,
21 status: oldEvent.status
22 }
23 let ne = {
24 id: newEvent.id,
25 name: newEvent.name,
26 description: newEvent.description,
27 channel: newEvent.channel ? newEvent.channel.id : null,
28 time: {
29 start: newEvent.scheduledStartTimestamp,
30 end: newEvent.scheduledEndTimestamp
31 },
32 date: newEvent.date,
33 privacyLevel: newEvent.privacyLevel,
34 entityType: newEvent.entityType,
35 entityMetadata: newEvent.entityMetadata,
36 status: newEvent.status
37 }
38
39 let data = JsonDiff.diff(oe, ne, {full: true});
40
41 addLog(newEvent.guild.id, data);
42 }
43}