This commit is contained in:
parent
ab4ad14d2c
commit
94edcb7bb6
1 changed files with 7 additions and 4 deletions
|
@ -26,13 +26,16 @@ module.exports = class downloadCommand extends Command {
|
||||||
if(blacklist[message.author.id])
|
if(blacklist[message.author.id])
|
||||||
return message.channel.send("You are blacklisted")
|
return message.channel.send("You are blacklisted")
|
||||||
if(link.includes("http") || link.includes("www")) {
|
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}`])
|
let video = youtubedl(link, [`--username=${fbuser}`,`--password=${fbpasswd}`])
|
||||||
video.pipe(fs.createWriteStream('video.mp4'))
|
video.pipe(fs.createWriteStream('video.mp4'))
|
||||||
video.on('end', function() {
|
video.on('end', function() {
|
||||||
message.channel.bulkDelete(2);
|
message.delete();
|
||||||
message.say(`Download by ${message.author.username}`)
|
message.channel.send(`Downloaded by ${message.author.username}`, {files: ["./video.mp4"]})
|
||||||
message.channel.send({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'))
|
.catch(error => message.say('An error has occured, the file might be too big or i cant download the link you provided'))
|
||||||
})
|
})
|
||||||
} else
|
} else
|
||||||
|
|
Loading…
Reference in a new issue