From 69815dbdf26e1b6c4e144cd8f5e43469d29c9738 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20H?= Date: Wed, 22 Apr 2020 09:39:46 +0200 Subject: [PATCH] voice chat leave detection --- events/voiceStateUpdate.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 events/voiceStateUpdate.js diff --git a/events/voiceStateUpdate.js b/events/voiceStateUpdate.js new file mode 100644 index 0000000..c8118e0 --- /dev/null +++ b/events/voiceStateUpdate.js @@ -0,0 +1,13 @@ +// Copyright 2020 Emily J. / mudkipscience and contributors. Subject to the AGPLv3 license. + +const music = require('../utils/music'); + +module.exports = (client, oldState, newState) => { + if(newState.channelID != oldState.channelID) { + let guild = music.getGuild(newState.guild.id); + + if(guild.playing && guild.voiceChannel.id == oldState.channelID) { + console.log(newState.id + ' left VC, in which Woomy is playing music'); + }; + } +} \ No newline at end of file