Use oldState instead of oldMember
This commit is contained in:
parent
0c366b0529
commit
eb370f590e
1 changed files with 3 additions and 3 deletions
|
@ -57,12 +57,12 @@ class Player {
|
||||||
this.options = mergeOptions(PlayerOptions, options);
|
this.options = mergeOptions(PlayerOptions, options);
|
||||||
|
|
||||||
// Listener to check if the channel is empty
|
// Listener to check if the channel is empty
|
||||||
client.on('voiceStateUpdate', (oldMember, newMember) => {
|
client.on('voiceStateUpdate', (oldState, newState) => {
|
||||||
if(!this.options.leaveOnEmpty) return;
|
if(!this.options.leaveOnEmpty) return;
|
||||||
// If the member leaves a voice channel
|
// 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
|
// 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){
|
if(queue){
|
||||||
// Disconnect from the voice channel
|
// Disconnect from the voice channel
|
||||||
queue.connection.channel.leave();
|
queue.connection.channel.leave();
|
||||||
|
|
Loading…
Reference in a new issue