Fix the stupid huge mistake i made

This commit is contained in:
Supositware 2024-01-26 18:33:57 +01:00
parent 44a629c7fc
commit ff8c6c29b0

View file

@ -206,21 +206,21 @@ async function download(url, interaction, originalInteraction, format = undefine
}); });
await interaction.editReply({ content: `File was bigger than ${maxFileSize} mb. It has been uploaded to an external site.`, embeds: [Embed], ephemeral: false }); await interaction.editReply({ content: `File was bigger than ${maxFileSize} mb. It has been uploaded to an external site.`, embeds: [Embed], ephemeral: false });
if (interaction.isMessage) { if (interaction.isMessage && message) {
await message.reply({ content: fileurl }); await message.reply({ content: fileurl });
cleanUp();
} }
else { else {
await interaction.followUp({ content: fileurl, ephemeral: false }); await interaction.followUp({ content: fileurl, ephemeral: false });
} }
} }
else if (interaction.isMessage) { else if (interaction.isMessage && message) {
await message.reply({ embeds: [Embed], files: [output] }); await message.reply({ embeds: [Embed], files: [output] });
cleanUp();
} }
else { else {
await interaction.editReply({ embeds: [Embed], files: [output], ephemeral: false }); await interaction.editReply({ embeds: [Embed], files: [output], ephemeral: false });
} }
if (interaction.isMessage) cleanUp();
}) })
.catch(async err => { .catch(async err => {
console.error(err); console.error(err);
@ -259,6 +259,7 @@ async function checkSize(url, format, args, interaction, tries = 0) {
while (tries < 4) { while (tries < 4) {
format = `bestvideo[height<=?${resolutions[resolutions.indexOf(ytdlpMaxResolution) - tries]}]+bestaudio/best`; format = `bestvideo[height<=?${resolutions[resolutions.indexOf(ytdlpMaxResolution) - tries]}]+bestaudio/best`;
const aproxFileSize = await utils.getVideoSize(url, format); const aproxFileSize = await utils.getVideoSize(url, format);
if (isNaN(aproxFileSize)) return format;
if (format || tries >= 4) { if (format || tries >= 4) {
if (aproxFileSize > 100 && !args.compress && tries > 4) { if (aproxFileSize > 100 && !args.compress && tries > 4) {