diff --git a/commands/fun/tts/dectalk.js b/commands/fun/tts/dectalk.js index 85a7ebe..291b83e 100644 --- a/commands/fun/tts/dectalk.js +++ b/commands/fun/tts/dectalk.js @@ -34,17 +34,23 @@ class dectalkCommand extends Command { if (process.platform == 'win32') { exec(`cd .\\dectalk && .\\say.exe -w dectalk.wav "${decMessage}"`) .catch(err => { - return console.error(err); + console.error(err); + return message.channel.send('Oh no! an error has occured!'); }) .then(() => { return message.channel.send({files: ['./dectalk/dectalk.wav']}); }); } else if (process.platform == 'linux' || process.platform == 'darwin') { + let loadingmsg = await message.channel.send('Processing ( this can take some time ) '); + exec(`cd dectalk && DISPLAY=:0.0 wine say.exe -w dectalk.wav "${decMessage}"`) .catch(err => { - return console.error(err); + loadingmsg.delete(); + console.error(err); + return message.channel.send('Oh no! an error has occured!'); }) .then(() => { + loadingmsg.delete(); return message.channel.send({files: ['./dectalk/dectalk.wav']}); }); } diff --git a/commands/fun/tts/dectalkvc.js b/commands/fun/tts/dectalkvc.js index 89726e3..2bad3b9 100644 --- a/commands/fun/tts/dectalkvc.js +++ b/commands/fun/tts/dectalkvc.js @@ -34,7 +34,8 @@ class dectalkvcCommand extends Command { if (process.platform == 'win32') { exec(`cd .\\dectalk && .\\say.exe -w dectalkvc.wav "${decMessage}"`) .catch(err => { - return console.error(err); + console.error(err); + return message.channel.send('Oh no! an error has occured!'); }) .then(async () => { const voiceChannel = message.member.voice.channel; @@ -52,14 +53,19 @@ class dectalkvcCommand extends Command { }); } else if (process.platform == 'linux' || process.platform == 'darwin') { + let loadingmsg = await message.channel.send('Processing ( this can take some time ) '); + exec(`cd dectalk && DISPLAY=:0.0 wine say.exe -w dectalkvc.wav "${decMessage}"`) .catch(err => { - return console.error(err); + loadingmsg.delete(); + console.error(err); + return message.channel.send('Oh no! an error has occured!'); }) .then(async () => { const voiceChannel = message.member.voice.channel; if (!voiceChannel) return message.say('Please enter a voice channel first.'); try { + loadingmsg.delete(); const connection = await voiceChannel.join(); const dispatcher = connection.play('./dectalk/dectalkvc.wav'); dispatcher.once('finish', () => voiceChannel.leave()); @@ -67,6 +73,7 @@ class dectalkvcCommand extends Command { return null; } catch (err) { voiceChannel.leave(); + loadingmsg.delete(); return message.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`); } });