fix: check if the channel is really empty

Closes #7
This commit is contained in:
Androz2091 2020-03-08 14:34:30 +01:00
parent 5bcbd71332
commit f61aff8ec6
2 changed files with 3 additions and 1 deletions

View file

@ -1,6 +1,6 @@
{
"name": "discord-player",
"version": "1.3.7",
"version": "1.3.8",
"description": "Complete framework to facilitate music commands using discord.js v12",
"main": "index.js",
"scripts": {

View file

@ -66,6 +66,8 @@ class Player {
// Search for a queue for this channel
let queue = this.queues.find((g) => g.connection.channel.id === oldState.channelID);
if(queue){
// If the channel is not empty
if(queue.connection.channel.members.size > 1) return;
// Disconnect from the voice channel
queue.connection.channel.leave();
// Delete the queue