Fix proxy thigny for good ( i hope )

Signed-off-by: loicbersier <loic.bersier1@gmail.com>
This commit is contained in:
loicbersier 2020-08-25 03:32:58 +02:00
parent 2169614e89
commit fdd60047d1

View file

@ -79,6 +79,9 @@ class DownloadCommand extends Command {
if (!proxy[args.proxy]) args.proxy = 0;
}
console.log(args.proxy);
console.log(proxy[args.proxy].ip);
if (args.spoiler) {
filename = `SPOILER_${message.id}_video`;
}
@ -89,7 +92,7 @@ class DownloadCommand extends Command {
.setDescription(args.caption ? args.caption : '')
.setFooter(`You can get the original video by clicking on the "downloaded by ${message.author.username}" message!`);
downloader(args.link.href, args.proxy ? ['--proxy', proxy[args.proxy].ip] : null, `${os.tmpdir()}/${filename}.mp4`)
downloader(args.link.href, args.proxy != null ? ['--proxy', proxy[args.proxy].ip] : null, `${os.tmpdir()}/${filename}.mp4`)
.on('error', async err => {
if (err.includes('HTTP Error 429: Too Many Requests')) return message.channel.send('`HTTP Error 429: Too Many Requests.`\nThe website you tried to download from probably has the bot blocked, you can try again with the `--proxy` option and hope it work.');
return message.channel.send(err, { code: true });