Use event for download

This commit is contained in:
loicbersier 2020-07-11 01:33:12 +02:00
parent e956ac6d2f
commit dcf299bcf2
3 changed files with 6 additions and 6 deletions

View file

@ -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)

View file

@ -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 {

View file

@ -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}});