From 94edcb7bb69dd7794ffa97a0c97c206148b4f68e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Bersier?= Date: Sun, 18 Nov 2018 18:28:27 +0100 Subject: [PATCH] --- commands/utility/download.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/commands/utility/download.js b/commands/utility/download.js index cec86f8..d9d915c 100644 --- a/commands/utility/download.js +++ b/commands/utility/download.js @@ -26,13 +26,16 @@ module.exports = class downloadCommand extends Command { if(blacklist[message.author.id]) return message.channel.send("You are blacklisted") if(link.includes("http") || link.includes("www")) { - message.say('Downloading...') + message.say('Downloading...').then(msg => { + video.on('end', function() { + msg.delete() + }) + }) let video = youtubedl(link, [`--username=${fbuser}`,`--password=${fbpasswd}`]) video.pipe(fs.createWriteStream('video.mp4')) video.on('end', function() { - message.channel.bulkDelete(2); - message.say(`Download by ${message.author.username}`) - message.channel.send({files: ["./video.mp4"]}) + message.delete(); + message.channel.send(`Downloaded by ${message.author.username}`, {files: ["./video.mp4"]}) .catch(error => message.say('An error has occured, the file might be too big or i cant download the link you provided')) }) } else