discord-player
Advanced tools
Comparing version 1.1.2 to 1.1.3
{ | ||
"name": "discord-player", | ||
"version": "1.1.2", | ||
"version": "1.1.3", | ||
"description": "Complete framework to facilitate music commands using discord.js v12", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -63,5 +63,5 @@ const ytdl = require('ytdl-core'); | ||
// If the member leaves a voice channel | ||
if(oldState.channel && !newState.channel) return; | ||
if(!oldState.channelID || newState.channelID) return; | ||
// Search for a queue for this channel | ||
let queue = this.queues.find((g) => g.connection.channel.id === oldState.channel.id); | ||
let queue = this.queues.find((g) => g.connection.channel.id === oldState.channelID); | ||
if(queue){ | ||
@@ -73,3 +73,3 @@ // Disconnect from the voice channel | ||
// Emit end event | ||
this.emit('channelEmpty'); | ||
queue.emit('channelEmpty'); | ||
} | ||
@@ -100,9 +100,7 @@ }); | ||
if(!video) reject('Song not found'); | ||
if(!voiceChannel.guild.me.voice.channel || (voiceChannel.guild.me.voice.channel.id !== voiceChannel.id)){ | ||
// Joins the voice channel | ||
await voiceChannel.join(); | ||
} | ||
// Joins the voice channel | ||
let connection = await voiceChannel.join(); | ||
// Creates a new guild with data | ||
let queue = new Queue(voiceChannel.guild.id); | ||
queue.connection = voiceChannel.guild.me.voice.connection; | ||
queue.connection = connection; | ||
let song = new Song(video, queue); | ||
@@ -109,0 +107,0 @@ queue.songs.push(song); |
25955
459