From 8de3c6ccade29ed43c766d06f2859fe3e30a4a87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20H?= Date: Sat, 6 Jun 2020 10:14:56 +0200 Subject: [PATCH] Music debugs, cant reproduce locally --- src/modules/music.js | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/modules/music.js b/src/modules/music.js index 6a44857..763d643 100644 --- a/src/modules/music.js +++ b/src/modules/music.js @@ -189,13 +189,23 @@ exports.play = async function (client, message, query, playNext, ignoreQueue) { guild.channel = message.channel } + console.log('[MUSIC DEBUG] joining vc'); + const connection = await vc.join() + console.log('[MUSIC DEBUG] joined vc'); + const v = guild.queue[0] + console.log('[MUSIC DEBUG] got v'); + try { guild.dispatcher = connection.play(await ytdl(exports.getLinkFromID(v.video.videoId), { highWaterMark: 1024 * 1024 * 32 }), { type: 'opus' }) + + console.log('[MUSIC DEBUG] got dispatcher') } catch (err) { + console.error(err); + if (playNext && playNext === true) { guild.queue.splice(1, 1) } else { @@ -206,14 +216,20 @@ exports.play = async function (client, message, query, playNext, ignoreQueue) { return message.channel.send(`<:error:466995152976871434> An error has occured: \n\`${err}\``) // return message.channel.send('<:error:466995152976871434> YouTube have made changes to their site that break Woomy\'s music module. An announcement will be made in the development server when this issue is resolved.') } + console.log('[MUSIC DEBUG] setting volume'); guild.dispatcher.setVolume(0.25) + console.log('[MUSIC DEBUG] set volume'); guild.channel.send('<:player:467216674622537748> Now playing: **' + v.video.title + '** `[' + exports.createTimestamp(v.video.lengthSeconds) + ']`') // play next in queue on end - guild.dispatcher.on('error', console.error); + guild.dispatcher.on('error', (err) => { + console.error('[MUSIC ERROR] ' + String(err)); + }); guild.dispatcher.once('finish', () => { + console.log('[MUSIC DEBUG] dispatcher finish'); + guild.queue.shift() guild.playing = false