From fd7ca30e1c51599a75fe5d2109fdfc13aa34244a Mon Sep 17 00:00:00 2001 From: Supositware Date: Fri, 26 Jan 2024 18:39:22 +0100 Subject: [PATCH] Fix cleanup --- commands/utility/download.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/commands/utility/download.js b/commands/utility/download.js index c5323428..22644772 100644 --- a/commands/utility/download.js +++ b/commands/utility/download.js @@ -5,7 +5,6 @@ import os from 'node:os'; import utils from '../../utils/videos.js'; let client; -let cleanUp; let maxFileSize; let { ytdlpMaxResolution } = process.env; @@ -38,10 +37,6 @@ export default { maxFileSize = await utils.getMaxFileSize(interaction.guild); interaction.doCompress = args.compress; - if (interaction.cleanUp) { - cleanUp = interaction.cleanUp; - } - await interaction.deferReply({ ephemeral: false }); if (interaction.isMessage) { @@ -168,7 +163,7 @@ async function download(url, interaction, originalInteraction, format = undefine if (interactionMenu.customId === `preset${interaction.user.id}${interaction.id}`) { await interactionMenu.deferReply({ ephemeral: false }); compress(file, interactionMenu, Embed); - if (interaction.isMessage) cleanUp(); + if (interaction.isMessage) interaction.cleanUp(); } }); 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 }); + let message = null; if (interaction.isMessage && interaction.reference !== null) { 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 }); } - if (interaction.isMessage) cleanUp(); + if (interaction.isMessage) interaction.cleanUp(); }) .catch(async err => { console.error(err);