delete loading message when compression is being done

This commit is contained in:
loicbersier 2019-10-16 17:49:31 +02:00
parent d7baadc512
commit c62fcb68ab

View file

@ -116,6 +116,7 @@ class DownloadCommand extends Command {
} }
let compressmsg = await message.channel.send('Video bigger than 8MB compressing now <a:loadingmin:527579785212329984> (This can take a long time!)\nWant it to go faster? Donate to the dev with the donate command, so i can get a better server and do it faster!'); let compressmsg = await message.channel.send('Video bigger than 8MB compressing now <a:loadingmin:527579785212329984> (This can take a long time!)\nWant it to go faster? Donate to the dev with the donate command, so i can get a better server and do it faster!');
loadingmsg.delete();
const options = { const options = {
input: `${os.tmpdir()}/${fileName}.mp4`, input: `${os.tmpdir()}/${fileName}.mp4`,
@ -127,7 +128,6 @@ class DownloadCommand extends Command {
let handbrake = hbjs.spawn(options); let handbrake = hbjs.spawn(options);
handbrake.on('error', err => { handbrake.on('error', err => {
console.error(err); console.error(err);
loadingmsg.delete();
compressmsg.delete(); compressmsg.delete();
return message.channel.send('An error has occured while compressing the video'); return message.channel.send('An error has occured while compressing the video');
}); });
@ -140,12 +140,10 @@ class DownloadCommand extends Command {
}); });
handbrake.on('end', async function () { handbrake.on('end', async function () {
message.delete(); message.delete();
loadingmsg.delete();
compressmsg.delete(); compressmsg.delete();
return message.channel.send(`Downloaded by ${message.author.username}`, { files: [`${os.tmpdir()}/${fileName}compressed.mp4`] }) return message.channel.send(`Downloaded by ${message.author.username}`, { files: [`${os.tmpdir()}/${fileName}compressed.mp4`] })
.catch(err => { .catch(err => {
console.error(err); console.error(err);
loadingmsg.delete();
compressmsg.delete(); compressmsg.delete();
return message.channel.send('File too big'); return message.channel.send('File too big');
}); });