blob: 238bf3c0144e13a3bacda8a6965a16a7ab75fa54 [file] [log] [blame]
pineafan32767212022-03-14 21:27:39 +00001const {addLog} = require('../scripts/addLogs');
2const JsonDiff = require('json-diff');
3
4module.exports = {
5 name:'guildMemberUpdate',
6 once:false,
7 async execute(oldMember, newMember) {
8
9 let oMem = {
10 id: oldMember.id,
11 username: oldMember.user.username,
12 nick: oldMember.nickname,
13 roles: oldMember.roles.cache.map(r => r.id),
14 displayAvatarUrl: oldMember.displayAvatarUrl,
15 communicationDisabledUntil: oldMember.communicationDisabledUntilTimestamp
16 }
17
18 let nMem = {
19 id: newMember.id,
20 username: newMember.user.username,
21 nick: newMember.nickname,
22 roles: newMember.roles.cache.map(r => r.id),
23 displayAvatarUrl: newMember.displayAvatarUrl,
24 communicationDisabledUntil: newMember.communicationDisabledUntilTimestamp
25 }
26
27 let data = JsonDiff.diff(oMem, nMem, {full: true});
28
29 addLog(newMember.guild.id, data);
30 }
31}