Add loading message when its run on linux
This commit is contained in:
parent
bed521c987
commit
1a0ee2091d
2 changed files with 17 additions and 4 deletions
|
@ -34,17 +34,23 @@ class dectalkCommand extends Command {
|
||||||
if (process.platform == 'win32') {
|
if (process.platform == 'win32') {
|
||||||
exec(`cd .\\dectalk && .\\say.exe -w dectalk.wav "${decMessage}"`)
|
exec(`cd .\\dectalk && .\\say.exe -w dectalk.wav "${decMessage}"`)
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
return console.error(err);
|
console.error(err);
|
||||||
|
return message.channel.send('Oh no! an error has occured!');
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
return message.channel.send({files: ['./dectalk/dectalk.wav']});
|
return message.channel.send({files: ['./dectalk/dectalk.wav']});
|
||||||
});
|
});
|
||||||
} else if (process.platform == 'linux' || process.platform == 'darwin') {
|
} else if (process.platform == 'linux' || process.platform == 'darwin') {
|
||||||
|
let loadingmsg = await message.channel.send('Processing ( this can take some time ) <a:loadingmin:527579785212329984>');
|
||||||
|
|
||||||
exec(`cd dectalk && DISPLAY=:0.0 wine say.exe -w dectalk.wav "${decMessage}"`)
|
exec(`cd dectalk && DISPLAY=:0.0 wine say.exe -w dectalk.wav "${decMessage}"`)
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
return console.error(err);
|
loadingmsg.delete();
|
||||||
|
console.error(err);
|
||||||
|
return message.channel.send('Oh no! an error has occured!');
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
|
loadingmsg.delete();
|
||||||
return message.channel.send({files: ['./dectalk/dectalk.wav']});
|
return message.channel.send({files: ['./dectalk/dectalk.wav']});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,8 @@ class dectalkvcCommand extends Command {
|
||||||
if (process.platform == 'win32') {
|
if (process.platform == 'win32') {
|
||||||
exec(`cd .\\dectalk && .\\say.exe -w dectalkvc.wav "${decMessage}"`)
|
exec(`cd .\\dectalk && .\\say.exe -w dectalkvc.wav "${decMessage}"`)
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
return console.error(err);
|
console.error(err);
|
||||||
|
return message.channel.send('Oh no! an error has occured!');
|
||||||
})
|
})
|
||||||
.then(async () => {
|
.then(async () => {
|
||||||
const voiceChannel = message.member.voice.channel;
|
const voiceChannel = message.member.voice.channel;
|
||||||
|
@ -52,14 +53,19 @@ class dectalkvcCommand extends Command {
|
||||||
});
|
});
|
||||||
|
|
||||||
} else if (process.platform == 'linux' || process.platform == 'darwin') {
|
} else if (process.platform == 'linux' || process.platform == 'darwin') {
|
||||||
|
let loadingmsg = await message.channel.send('Processing ( this can take some time ) <a:loadingmin:527579785212329984>');
|
||||||
|
|
||||||
exec(`cd dectalk && DISPLAY=:0.0 wine say.exe -w dectalkvc.wav "${decMessage}"`)
|
exec(`cd dectalk && DISPLAY=:0.0 wine say.exe -w dectalkvc.wav "${decMessage}"`)
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
return console.error(err);
|
loadingmsg.delete();
|
||||||
|
console.error(err);
|
||||||
|
return message.channel.send('Oh no! an error has occured!');
|
||||||
})
|
})
|
||||||
.then(async () => {
|
.then(async () => {
|
||||||
const voiceChannel = message.member.voice.channel;
|
const voiceChannel = message.member.voice.channel;
|
||||||
if (!voiceChannel) return message.say('Please enter a voice channel first.');
|
if (!voiceChannel) return message.say('Please enter a voice channel first.');
|
||||||
try {
|
try {
|
||||||
|
loadingmsg.delete();
|
||||||
const connection = await voiceChannel.join();
|
const connection = await voiceChannel.join();
|
||||||
const dispatcher = connection.play('./dectalk/dectalkvc.wav');
|
const dispatcher = connection.play('./dectalk/dectalkvc.wav');
|
||||||
dispatcher.once('finish', () => voiceChannel.leave());
|
dispatcher.once('finish', () => voiceChannel.leave());
|
||||||
|
@ -67,6 +73,7 @@ class dectalkvcCommand extends Command {
|
||||||
return null;
|
return null;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
voiceChannel.leave();
|
voiceChannel.leave();
|
||||||
|
loadingmsg.delete();
|
||||||
return message.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
return message.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue