From 557fb214ca9b7104593f09e5afa41dadd90beb30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Bersier?= Date: Sat, 8 Sep 2018 22:30:50 +0200 Subject: [PATCH] Updated description --- commands/fun/music.js | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/commands/fun/music.js b/commands/fun/music.js index 81b19ae2..60a5fd12 100644 --- a/commands/fun/music.js +++ b/commands/fun/music.js @@ -19,20 +19,20 @@ module.exports = class MusicCommand extends Command { run(message, { ytblink }) { const { voiceChannel } = message.member; - - if (!voiceChannel) { - return message.reply('please join a voice channel first!'); + 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); + + + dispatcher.on('end', () => voiceChannel.leave()); + }); } - - if (ytblink == 'stop') { - voiceChannel.leave() - } else - voiceChannel.join().then(connection => { - const stream = ytdl(ytblink, { filter: 'audioonly' }); - const dispatcher = connection.playStream(stream); - - - dispatcher.on('end', () => voiceChannel.leave()); - }); } }; \ No newline at end of file