From 9a4c84b5065b8df4a8564372deec5ec3c9d9bf87 Mon Sep 17 00:00:00 2001 From: Loic Bersier Date: Sun, 9 Dec 2018 02:10:43 +0100 Subject: [PATCH] test again --- commands/fun/ttsvc.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/commands/fun/ttsvc.js b/commands/fun/ttsvc.js index 33e32b97..9ea54f37 100644 --- a/commands/fun/ttsvc.js +++ b/commands/fun/ttsvc.js @@ -63,7 +63,11 @@ module.exports = class ttsvcCommand extends Command { voiceChannel.leave() message.say('I leaved the channel'); } else - voiceChannel.join().then(connection =>{const dispatcher = connection.playFile('./tts.mp3');}).catch(err => console.log(err)); - dispatcher.on("end", end => {voiceChannel.leave();}); + const dispatcher = voiceChannel.join() + .then(connection => dispatcher = connection.play('./tts.mp3')) + dispatcher.on('finish', () => { + voiceChannel.leave() + }); + }); })}} \ No newline at end of file