From f797af8bf843673d1915273b90a4a308eb555ad4 Mon Sep 17 00:00:00 2001
From: loicbersier <loic.bersier1@gmail.com>
Date: Mon, 20 May 2019 00:14:24 +0200
Subject: [PATCH] testing fix

---
 commands/fun/tts/dectalkvc.js | 29 +++++++++++++++--------------
 1 file changed, 15 insertions(+), 14 deletions(-)

diff --git a/commands/fun/tts/dectalkvc.js b/commands/fun/tts/dectalkvc.js
index 821f8f6..6b2e59a 100644
--- a/commands/fun/tts/dectalkvc.js
+++ b/commands/fun/tts/dectalkvc.js
@@ -37,20 +37,21 @@ class dectalkvcCommand extends Command {
 			},
 		}).then(async (result) => {
 			const outputFilename = './dectalkvc.wav';
-			fs.writeFileSync(outputFilename, result.data);
-
-			const voiceChannel = message.member.voice.channel;
-			if (!voiceChannel) return message.say('Please enter a voice channel first.');
-			try {
-				const connection = await voiceChannel.join();
-				const dispatcher = connection.play('./dectalkvc.wav');
-				dispatcher.once('finish', () => voiceChannel.leave());
-				dispatcher.once('error', () => voiceChannel.leave());
-				return null;
-			} catch (err) {
-				voiceChannel.leave();
-				return message.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
-			}
+			fs.writeFileSync(outputFilename, result.data)
+				.then(async () => {
+					const voiceChannel = message.member.voice.channel;
+					if (!voiceChannel) return message.say('Please enter a voice channel first.');
+					try {
+						const connection = await voiceChannel.join();
+						const dispatcher = connection.play('./dectalkvc.wav');
+						dispatcher.once('finish', () => voiceChannel.leave());
+						dispatcher.once('error', () => voiceChannel.leave());
+						return null;
+					} catch (err) {
+						voiceChannel.leave();
+						return message.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
+					}
+				});
 		});
 
 	}