Show file size

This commit is contained in:
loicbersier 2020-02-27 19:47:56 +01:00
parent 195465c0d4
commit f4dca21e82
2 changed files with 8 additions and 5 deletions

View file

@ -72,10 +72,11 @@ class audio2imageCommand extends Command {
.on('end', () => {
console.log('finished');
loadingmsg.delete();
return message.channel.send({files: [`${os.tmpdir()}/a2i${message.id}.png`]})
let file = fs.statSync(`${os.tmpdir()}/a2i${message.id}.png`);
let fileSize = (file.size / 1000000.0).toFixed(2);
return message.channel.send(`Image is ${fileSize} MB for ${args.video_size} resolution`, {files: [`${os.tmpdir()}/a2i${message.id}.png`]})
.catch(() => {
return message.channel.send('End result is too big to fit on discord!');
});
return message.channel.send(`End result is too big to fit on discord! File is ${fileSize} MB`); });
})
.run();
})

View file

@ -62,9 +62,11 @@ class image2audioCommand extends Command {
.on('end', () => {
console.log('finished');
loadingmsg.delete();
return message.channel.send({files: [`${os.tmpdir()}/i2a_${message.id}.mp3`]})
let file = fs.statSync(`${os.tmpdir()}/i2a_${message.id}.mp3`);
let fileSize = (file.size / 1000000.0).toFixed(2);
return message.channel.send(`Audio file is ${fileSize} MB`, {files: [`${os.tmpdir()}/i2a_${message.id}.mp3`]})
.catch(() => {
return message.channel.send('End result is too big to fit on discord!');
return message.channel.send(`End result is too big to fit on discord! File is ${fileSize} MB`);
});
})
.run();