forked from Supositware/Haha-Yes
Use the guild max file size
This commit is contained in:
parent
d926931e37
commit
d4e3693be6
4 changed files with 5 additions and 5 deletions
|
@ -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`] });
|
||||
},
|
||||
|
|
|
@ -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`] });
|
||||
},
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue