From d34c2d7a1978dd626dce508142ed81e25c6fae06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Bersier?= Date: Sat, 8 Sep 2018 00:39:41 +0200 Subject: [PATCH] --- commands/fun/music.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/commands/fun/music.js b/commands/fun/music.js index 8094bb37..42dfa0e2 100644 --- a/commands/fun/music.js +++ b/commands/fun/music.js @@ -23,13 +23,14 @@ module.exports = class MusicCommand extends Command { if (!voiceChannel) { return message.reply('please join a voice channel first!'); } + + if (ytblink == 'stop') { + voiceChannel.leave() + } else voiceChannel.join().then(connection => { const stream = ytdl(ytblink, { filter: 'audioonly' }); const dispatcher = connection.playStream(stream); - if (ytblink == 'stop') { - voiceChannel.leave() - } else dispatcher.on('end', () => voiceChannel.leave()); });