Use event for download
This commit is contained in:
parent
e956ac6d2f
commit
dcf299bcf2
3 changed files with 6 additions and 6 deletions
|
@ -60,11 +60,11 @@ class midifyCommand extends Command {
|
||||||
|
|
||||||
if (url) {
|
if (url) {
|
||||||
downloader(url, null, input)
|
downloader(url, null, input)
|
||||||
.catch((err) => {
|
.on('error', (err) => {
|
||||||
loadingmsg.delete();
|
loadingmsg.delete();
|
||||||
return message.channel.send(err, { code: true });
|
return message.channel.send(err, { code: true });
|
||||||
})
|
})
|
||||||
.then(output => {
|
.on('end', output => {
|
||||||
// Convert to wav
|
// Convert to wav
|
||||||
ffmpeg()
|
ffmpeg()
|
||||||
.input(output)
|
.input(output)
|
||||||
|
|
|
@ -57,11 +57,11 @@ class vidshittifierCommand extends Command {
|
||||||
|
|
||||||
if (url) {
|
if (url) {
|
||||||
downloader(args.link, null, input)
|
downloader(args.link, null, input)
|
||||||
.catch((err) => {
|
.on('error', (err) => {
|
||||||
loadingmsg.delete();
|
loadingmsg.delete();
|
||||||
return message.channel.send(err, { code: true });
|
return message.channel.send(err, { code: true });
|
||||||
})
|
})
|
||||||
.then(() => {
|
.on('end', () => {
|
||||||
shittifie();
|
shittifie();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -137,11 +137,11 @@ class ytpCommand extends Command {
|
||||||
|
|
||||||
if (url) {
|
if (url) {
|
||||||
return downloader(url, ['--format=mp4'], `./asset/ytp/userVid/${message.id}.mp4`)
|
return downloader(url, ['--format=mp4'], `./asset/ytp/userVid/${message.id}.mp4`)
|
||||||
.catch((err) => {
|
.on('error', (err) => {
|
||||||
loadingmsg.delete();
|
loadingmsg.delete();
|
||||||
return message.channel.send(err, { code: true });
|
return message.channel.send(err, { code: true });
|
||||||
})
|
})
|
||||||
.then(async output => {
|
.on('end', async output => {
|
||||||
const hash = md5File.sync(output);
|
const hash = md5File.sync(output);
|
||||||
const ytphash = await ytpHash.findOne({where: {hash: hash}});
|
const ytphash = await ytpHash.findOne({where: {hash: hash}});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue