From c47c95eaf6f0b3437f18c3dc85038ebc3e9db4a3 Mon Sep 17 00:00:00 2001 From: Loic Bersier Date: Tue, 11 Sep 2018 15:57:32 +0200 Subject: [PATCH] added comment --- commands/fun/music | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/commands/fun/music b/commands/fun/music index 928d0f1e..be6762f6 100644 --- a/commands/fun/music +++ b/commands/fun/music @@ -20,11 +20,12 @@ module.exports = class MusicCommand extends Command { async run(message, { ytblink }) { const { voiceChannel } = message.member; +// If not in voice channel ask user to join if (!voiceChannel) { return message.reply('please join a voice channel first!'); } else - +// If user say "stop" make the bot leave voice channel if (ytblink == 'stop') { voiceChannel.leave() } else @@ -32,7 +33,7 @@ module.exports = class MusicCommand extends Command { const stream = ytdl(ytblink, { filter: 'audioonly' }); const dispatcher = connection.playStream(stream); - +// End at then end of the audio stream dispatcher.on('end', () => voiceChannel.leave()); });