pineafan | 3276721 | 2022-03-14 21:27:39 +0000 | [diff] [blame^] | 1 | const {addLog} = require('../scripts/addLogs'); |
| 2 | const JsonDiff = require('json-diff'); |
| 3 | |
| 4 | module.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 | } |