blob: 3754f0c43b494b41b6ef3085f49cf58617d7a7b9 [file] [log] [blame]
pineafan32767212022-03-14 21:27:39 +00001const {addLog} = require('../scripts/addLogs');
2const JsonDiff = require('json-diff');
3module.exports = {
4 name:'voiceStateUpdate',
5 once:false,
6 async execute(oldState, newState) {
7 let os = {
8 channel:oldState.channel ? oldState.channel.id : null,
9 serverDeaf:oldState.serverDeaf,
10 serverMute:oldState.serverMute,
11 selfDeaf:oldState.selfDeaf,
12 selfMute:oldState.selfMute,
13 selfVideo:oldState.selfVideo,
14 streaming:oldState.streaming,
15 id:oldState.id,
16 requestToSpeakTimestamp:oldState.requestToSpeakTimestamp
17 }
18
19 let ns = {
20 channel:newState.channel ? newState.channel.id : null,
21 serverDeaf:newState.serverDeaf,
22 serverMute:newState.serverMute,
23 selfDeaf:newState.selfDeaf,
24 selfMute:newState.selfMute,
25 selfVideo:newState.selfVideo,
26 streaming:newState.streaming,
27 id:newState.id,
28 requestToSpeakTimestamp:newState.requestToSpeakTimestamp
29 }
30
31 let data = JsonDiff.diff(os, ns, {full: true});
32
33 addLog(oldState.guild.id, data);
34 }
35}