Fix cleanup
This commit is contained in:
parent
38b8f80c43
commit
fd7ca30e1c
1 changed files with 3 additions and 7 deletions
|
@ -5,7 +5,6 @@ import os from 'node:os';
|
||||||
import utils from '../../utils/videos.js';
|
import utils from '../../utils/videos.js';
|
||||||
|
|
||||||
let client;
|
let client;
|
||||||
let cleanUp;
|
|
||||||
let maxFileSize;
|
let maxFileSize;
|
||||||
|
|
||||||
let { ytdlpMaxResolution } = process.env;
|
let { ytdlpMaxResolution } = process.env;
|
||||||
|
@ -38,10 +37,6 @@ export default {
|
||||||
maxFileSize = await utils.getMaxFileSize(interaction.guild);
|
maxFileSize = await utils.getMaxFileSize(interaction.guild);
|
||||||
interaction.doCompress = args.compress;
|
interaction.doCompress = args.compress;
|
||||||
|
|
||||||
if (interaction.cleanUp) {
|
|
||||||
cleanUp = interaction.cleanUp;
|
|
||||||
}
|
|
||||||
|
|
||||||
await interaction.deferReply({ ephemeral: false });
|
await interaction.deferReply({ ephemeral: false });
|
||||||
|
|
||||||
if (interaction.isMessage) {
|
if (interaction.isMessage) {
|
||||||
|
@ -168,7 +163,7 @@ async function download(url, interaction, originalInteraction, format = undefine
|
||||||
if (interactionMenu.customId === `preset${interaction.user.id}${interaction.id}`) {
|
if (interactionMenu.customId === `preset${interaction.user.id}${interaction.id}`) {
|
||||||
await interactionMenu.deferReply({ ephemeral: false });
|
await interactionMenu.deferReply({ ephemeral: false });
|
||||||
compress(file, interactionMenu, Embed);
|
compress(file, interactionMenu, Embed);
|
||||||
if (interaction.isMessage) cleanUp();
|
if (interaction.isMessage) interaction.cleanUp();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
|
@ -189,6 +184,7 @@ async function download(url, interaction, originalInteraction, format = undefine
|
||||||
|
|
||||||
Embed.setAuthor({ name: `${Embed.data.author.name} (${fileSize.toFixed(2)} MB)`, iconURL: Embed.data.author.icon_url, url: Embed.data.author.url });
|
Embed.setAuthor({ name: `${Embed.data.author.name} (${fileSize.toFixed(2)} MB)`, iconURL: Embed.data.author.icon_url, url: Embed.data.author.url });
|
||||||
|
|
||||||
|
|
||||||
let message = null;
|
let message = null;
|
||||||
if (interaction.isMessage && interaction.reference !== null) {
|
if (interaction.isMessage && interaction.reference !== null) {
|
||||||
const channel = client.channels.resolve(interaction.reference.channelId);
|
const channel = client.channels.resolve(interaction.reference.channelId);
|
||||||
|
@ -220,7 +216,7 @@ async function download(url, interaction, originalInteraction, format = undefine
|
||||||
await interaction.editReply({ embeds: [Embed], files: [output], ephemeral: false });
|
await interaction.editReply({ embeds: [Embed], files: [output], ephemeral: false });
|
||||||
}
|
}
|
||||||
|
|
||||||
if (interaction.isMessage) cleanUp();
|
if (interaction.isMessage) interaction.cleanUp();
|
||||||
})
|
})
|
||||||
.catch(async err => {
|
.catch(async err => {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
|
|
Loading…
Reference in a new issue