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()); });