From d4e3693be659409f015946054350e32549273829 Mon Sep 17 00:00:00 2001 From: Supositware Date: Tue, 11 Apr 2023 14:44:37 +0200 Subject: [PATCH] Use the guild max file size --- commands/fun/audio2image.js | 2 +- commands/fun/image2audio.js | 2 +- commands/utility/download.js | 4 ++-- commands/utility/vid2gif.js | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/commands/fun/audio2image.js b/commands/fun/audio2image.js index 5e19c95..6a1a7c9 100644 --- a/commands/fun/audio2image.js +++ b/commands/fun/audio2image.js @@ -41,7 +41,7 @@ export default { const file = fs.statSync(`${os.tmpdir()}/${args.audio.name}.png`); const fileSize = (file.size / 1000000.0).toFixed(2); - if (fileSize > 8) return interaction.editReply('error'); + if (fileSize > utils.getMaxFileSize(interaction.guild)) return interaction.editReply('error'); interaction.editReply({ content: `Image file is ${fileSize} MB` }); return interaction.followUp({ files: [`${os.tmpdir()}/${args.audio.name}.png`] }); }, diff --git a/commands/fun/image2audio.js b/commands/fun/image2audio.js index 283f69b..ce7638a 100644 --- a/commands/fun/image2audio.js +++ b/commands/fun/image2audio.js @@ -40,7 +40,7 @@ export default { const file = fs.statSync(`${os.tmpdir()}/${args.img.name}.mp3`); const fileSize = (file.size / 1000000.0).toFixed(2); - if (fileSize > 8) return interaction.editReply('error'); + if (fileSize > utils.getMaxFileSize(interaction.guild)) return interaction.editReply('error'); interaction.editReply({ content: `Audio file is ${fileSize} MB` }); return interaction.followUp({ files: [`${os.tmpdir()}/${args.img.name}.mp3`] }); }, diff --git a/commands/utility/download.js b/commands/utility/download.js index 56438eb..f96b96e 100644 --- a/commands/utility/download.js +++ b/commands/utility/download.js @@ -182,7 +182,7 @@ async function download(url, interaction, originalInteraction) { await interaction.deleteReply(); await interaction.followUp('Uh oh! The video you tried to download is too big!', { ephemeral: true }); } - else if (fileSize > 8) { + else if (fileSize > utils.getMaxFileSize(interaction.guild)) { const fileurl = await utils.upload(output) .catch(err => { console.error(err); @@ -212,7 +212,7 @@ async function compress(input, interaction, embed) { const fileStat = fs.statSync(`${os.tmpdir()}/${output}`); const fileSize = fileStat.size / 1000000.0; - if (fileSize > 8) { + if (fileSize > utils.getMaxFileSize(interaction.guild)) { await interaction.editReply({ content: 'File was bigger than 8 mb. but due to the compression it is not being uploaded externally.', ephemeral: true }); } else { diff --git a/commands/utility/vid2gif.js b/commands/utility/vid2gif.js index 7eb85a5..fb77b4a 100644 --- a/commands/utility/vid2gif.js +++ b/commands/utility/vid2gif.js @@ -46,7 +46,7 @@ export default { await interaction.deleteReply(); await interaction.followUp('❌ Uh oh! The video once converted is too big!', { ephemeral: true }); } - else if (fileSize > 8) { + else if (fileSize > utils.getMaxFileSize(interaction.guild)) { const fileURL = await utils.upload(gifsicleOutput) .catch(err => { console.error(err);