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