From 41eed9fef29b71045fabf794d97579b9ba45df9c Mon Sep 17 00:00:00 2001 From: Loic Bersier Date: Sun, 9 Dec 2018 02:01:27 +0100 Subject: [PATCH] tryna something else --- commands/fun/ttsvc.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/commands/fun/ttsvc.js b/commands/fun/ttsvc.js index 6967d370..d3ef168b 100644 --- a/commands/fun/ttsvc.js +++ b/commands/fun/ttsvc.js @@ -27,8 +27,6 @@ module.exports = class ttsvcCommand extends Command { if(blacklistJson[message.author.id]) return blacklist(blacklistJson[message.author.id] , message) - voiceChannel.leave(); - // Construct the request const request = { input: {text: text}, @@ -67,6 +65,10 @@ module.exports = class ttsvcCommand extends Command { } else voiceChannel.join().then(connection => { const dispatcher = connection.playStream('./tts.mp3'); + // End at then end of the audio stream + dispatcher.on('end', () => setTimeout(function(){ + voiceChannel.leave(); + }, 2000)); }); }); });