From 7adafd7cf902673868142e682e24ecfc2474e567 Mon Sep 17 00:00:00 2001 From: Loic Bersier Date: Sun, 30 Dec 2018 02:20:39 +0100 Subject: [PATCH] --- commands/general/ttsvc.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/commands/general/ttsvc.js b/commands/general/ttsvc.js index a561aed5..e1388019 100644 --- a/commands/general/ttsvc.js +++ b/commands/general/ttsvc.js @@ -27,11 +27,6 @@ class TtsvcCommand extends Command { let text = args.text; const { voiceChannel } = message.member; - // If user say "stop" make the bot leave voice channel - if (text == 'stop') { - voiceChannel.leave(); - message.channel.send('I leaved the channel'); - } // Construct the request @@ -63,7 +58,12 @@ class TtsvcCommand extends Command { if (!voiceChannel) { return message.reply('please join a voice channel first!'); - } else { + } else + // If user say "stop" make the bot leave voice channel + if (text == 'stop') { + voiceChannel.leave(); + message.channel.send('I leaved the channel'); + } else voiceChannel.join().then(connection => { const dispatcher = connection.playStream('./ttsvc.mp3'); // End at then end of the audio stream @@ -71,7 +71,6 @@ class TtsvcCommand extends Command { voiceChannel.leave(); }, 2000)); }); - } }); }); }