From 889cef0f8f1469eae0a0729cc2200532731460fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Bersier?= Date: Sat, 8 Sep 2018 00:22:32 +0200 Subject: [PATCH] Music now work, bot can leave the channel --- commands/fun/{music => music.js} | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) rename commands/fun/{music => music.js} (88%) diff --git a/commands/fun/music b/commands/fun/music.js similarity index 88% rename from commands/fun/music rename to commands/fun/music.js index 91c23c1..42dfa0e 100644 --- a/commands/fun/music +++ b/commands/fun/music.js @@ -10,7 +10,7 @@ module.exports = class MusicCommand extends Command { args: [ { key: 'ytblink', - prompt: 'Wich Youtube link would you like to play?', + prompt: 'Wich Youtube link would you like to play? (stop to make the bot leave the channel)', type: 'string', } ] @@ -24,6 +24,9 @@ module.exports = class MusicCommand extends Command { 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);