blob: 2e93f5b8118d26cb99f98ab85038ef0f4b71f88b [file] [log] [blame]
pineafan32767212022-03-14 21:27:39 +00001const {addLog} = require('../scripts/addLogs');
2const JsonDiff = require('json-diff');
3
4module.exports = {
5 name:'guildUpdate',
6 once:false,
7 async execute(oldGuild, newGuild) {
8
9 if(!newGuild.available) {
10 return addLog(newGuild.id, {id:newGuild.id,unavailable:true});
11 }
12
13 let og = {
14 afkChannel: oldGuild.afkChannel ? oldGuild.afkChannel.id : null,
15 afkTimeout: oldGuild.afkTimeout,
16 available: oldGuild.available,
17 banner: oldGuild.banner,
18 description: oldGuild.description,
19 discoverySplash: oldGuild.discoverySplash,
20 explicitContentFilter: oldGuild.explicitContentFilter,
21 features: oldGuild.features,
22 icon: oldGuild.icon,
23 id: oldGuild.id,
24 large: oldGuild.large,
25 maximumBitrate: oldGuild.maximumBitrate,
26 maximumMembers: oldGuild.maximumMembers,
27 mfaLevel: oldGuild.mfaLevel,
28 name: oldGuild.name,
29 nsfwLevel: oldGuild.nsfwLevel,
30 ownerid: oldGuild.ownerId,
31 partnered: oldGuild.partnered,
32 preferredLocale: oldGuild.preferredLocale,
33 premiumProgressBarEnabled: oldGuild.premiumProgressBarEnabled,
34 premiumSubscriptionCount: oldGuild.premiumSubscriptionCount,
35 premiumTier: oldGuild.premiumTier,
36 publicUpdatesChannel: oldGuild.publicUpdatesChannel ? oldGuild.publicUpdatesChannel.id : null,
37 rulesChannel: oldGuild.rulesChannel ? oldGuild.rulesChannel.id : null,
38 splash: oldGuild.splash,
39 systemChannel: oldGuild.systemChannel ? oldGuild.systemChannel.id : null,
40 vanityURLCode: oldGuild.vanityURLCode,
41 verificationLevel: oldGuild.verificationLevel,
42 verified: oldGuild.verified,
43 widgetChannel: oldGuild.widgetChannel ? oldGuild.widgetChannel.id : null,
44 widgetEnabled: oldGuild.widgetEnabled,
45 }
46 let ng = {
47 afkChannel: newGuild.afkChannel ? newGuild.afkChannel.id : null,
48 afkTimeout: newGuild.afkTimeout,
49 available: newGuild.available,
50 banner: newGuild.banner,
51 description: newGuild.description,
52 discoverySplash: newGuild.discoverySplash,
53 explicitContentFilter: newGuild.explicitContentFilter,
54 features: newGuild.features,
55 icon: newGuild.icon,
56 id: newGuild.id,
57 large: newGuild.large,
58 maximumBitrate: newGuild.maximumBitrate,
59 maximumMembers: newGuild.maximumMembers,
60 mfaLevel: newGuild.mfaLevel,
61 name: newGuild.name,
62 nsfwLevel: newGuild.nsfwLevel,
63 ownerid: newGuild.ownerId,
64 partnered: newGuild.partnered,
65 preferredLocale: newGuild.preferredLocale,
66 premiumProgressBarEnabled: newGuild.premiumProgressBarEnabled,
67 premiumSubscriptionCount: newGuild.premiumSubscriptionCount,
68 premiumTier: newGuild.premiumTier,
69 publicUpdatesChannel: newGuild.publicUpdatesChannel ? newGuild.publicUpdatesChannel.id : null,
70 rulesChannel: newGuild.rulesChannel ? newGuild.rulesChannel.id : null,
71 splash: newGuild.splash,
72 systemChannel: newGuild.systemChannel ? newGuild.systemChannel.id : null,
73 vanityURLCode: newGuild.vanityURLCode,
74 verificationLevel: newGuild.verificationLevel,
75 verified: newGuild.verified,
76 widgetChannel: newGuild.widgetChannel ? newGuild.widgetChannel.id : null,
77 widgetEnabled: newGuild.widgetEnabled,
78 }
79
80 let data = JsonDiff.diff(og, ng, {full:true});
81 addLog(newGuild.id, data);
82 }
83}