Update disconnect() system
This commit is contained in:
parent
ae264426c6
commit
4c835286bc
1 changed files with 5 additions and 2 deletions
|
@ -270,11 +270,14 @@ class Player {
|
||||||
// If there isn't any music in the queue
|
// If there isn't any music in the queue
|
||||||
if(queue.songs.length < 2 && !firstPlay){
|
if(queue.songs.length < 2 && !firstPlay){
|
||||||
// Leaves the voice channel
|
// Leaves the voice channel
|
||||||
if(this.options.leaveOnEnd) queue.connection.disconnect();
|
if(this.options.leaveOnEnd && !queue.stopped) queue.connection.channel.leave();
|
||||||
// Remoces the guild from the guilds list
|
// Remoces the guild from the guilds list
|
||||||
this.queues = this.queues.filter((g) => g.guildID !== guildID);
|
this.queues = this.queues.filter((g) => g.guildID !== guildID);
|
||||||
// Emits stop event
|
// Emits stop event
|
||||||
if(queue.stopped) return queue.emit('stop');
|
if(queue.stopped){
|
||||||
|
if(this.options.leaveOnStop) queue.connection.channel.leave();
|
||||||
|
return queue.emit('stop');
|
||||||
|
}
|
||||||
// Emits end event
|
// Emits end event
|
||||||
return queue.emit('end');
|
return queue.emit('end');
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue