await getMaxFIleSize

This commit is contained in:
Supositware 2023-04-11 20:16:07 +02:00
parent d4e3693be6
commit 3780fad9ae
3 changed files with 3 additions and 3 deletions

View file

@ -41,7 +41,7 @@ export default {
const file = fs.statSync(`${os.tmpdir()}/${args.audio.name}.png`); const file = fs.statSync(`${os.tmpdir()}/${args.audio.name}.png`);
const fileSize = (file.size / 1000000.0).toFixed(2); const fileSize = (file.size / 1000000.0).toFixed(2);
if (fileSize > utils.getMaxFileSize(interaction.guild)) return interaction.editReply('error'); if (fileSize > await utils.getMaxFileSize(interaction.guild)) return interaction.editReply('error');
interaction.editReply({ content: `Image file is ${fileSize} MB` }); interaction.editReply({ content: `Image file is ${fileSize} MB` });
return interaction.followUp({ files: [`${os.tmpdir()}/${args.audio.name}.png`] }); return interaction.followUp({ files: [`${os.tmpdir()}/${args.audio.name}.png`] });
}, },

View file

@ -40,7 +40,7 @@ export default {
const file = fs.statSync(`${os.tmpdir()}/${args.img.name}.mp3`); const file = fs.statSync(`${os.tmpdir()}/${args.img.name}.mp3`);
const fileSize = (file.size / 1000000.0).toFixed(2); const fileSize = (file.size / 1000000.0).toFixed(2);
if (fileSize > utils.getMaxFileSize(interaction.guild)) return interaction.editReply('error'); if (fileSize > await utils.getMaxFileSize(interaction.guild)) return interaction.editReply('error');
interaction.editReply({ content: `Audio file is ${fileSize} MB` }); interaction.editReply({ content: `Audio file is ${fileSize} MB` });
return interaction.followUp({ files: [`${os.tmpdir()}/${args.img.name}.mp3`] }); return interaction.followUp({ files: [`${os.tmpdir()}/${args.img.name}.mp3`] });
}, },

View file

@ -46,7 +46,7 @@ export default {
await interaction.deleteReply(); await interaction.deleteReply();
await interaction.followUp('❌ Uh oh! The video once converted is too big!', { ephemeral: true }); await interaction.followUp('❌ Uh oh! The video once converted is too big!', { ephemeral: true });
} }
else if (fileSize > utils.getMaxFileSize(interaction.guild)) { else if (fileSize > await utils.getMaxFileSize(interaction.guild)) {
const fileURL = await utils.upload(gifsicleOutput) const fileURL = await utils.upload(gifsicleOutput)
.catch(err => { .catch(err => {
console.error(err); console.error(err);