From eb370f590ee4139ddd00b652d2f25a5f5aef0508 Mon Sep 17 00:00:00 2001 From: Androz2091 Date: Sun, 12 Jan 2020 19:06:44 +0100 Subject: [PATCH] Use oldState instead of oldMember --- src/Player.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Player.js b/src/Player.js index 72cd9b0..01091dd 100644 --- a/src/Player.js +++ b/src/Player.js @@ -57,12 +57,12 @@ class Player { this.options = mergeOptions(PlayerOptions, options); // Listener to check if the channel is empty - client.on('voiceStateUpdate', (oldMember, newMember) => { + client.on('voiceStateUpdate', (oldState, newState) => { if(!this.options.leaveOnEmpty) return; // If the member leaves a voice channel - if(oldMember.voice.channel && !newMember.voice.channel) return; + if(oldState.channel && !newState.channel) return; // Search for a queue for this channel - let queue = this.queues.find((g) => g.connection.channel.id === oldMember.voice.channel.id); + let queue = this.queues.find((g) => g.connection.channel.id === oldState.channel.id); if(queue){ // Disconnect from the voice channel queue.connection.channel.leave();