Better error message for HTTP ERROR 429

This commit is contained in:
loicbersier 2020-05-14 17:01:19 +02:00
parent 295acc4ce1
commit 18193e1b78
2 changed files with 10 additions and 3 deletions

View file

@ -137,7 +137,11 @@ class ytpCommand extends Command {
if (err) {
console.error(err);
loadingmsg.delete();
return message.channel.send('An error has occured, I can\'t download from the link you provided. Is it an mp4?');
if (err.includes('HTTP Error 429')) {
return message.channel.send('An error has occured, I can\'t download from the link you provided because the website has blocked the bot. Please try again later or upload that video as mp4 on another website.');
} else {
return message.channel.send('An error has occured, I can\'t download from the link you provided. Is it an mp4?');
}
} else {
if (output[2]) {
if (output[2].includes('File is larger than max-filesize')) {

View file

@ -76,8 +76,11 @@ class DownloadCommand extends Command {
if (err) {
console.error(err);
loadingmsg.delete();
return message.channel.send('An error has occured, I can\'t download from the link you provided.');
}
if (err.includes('HTTP Error 429')) {
return message.channel.send('An error has occured, I can\'t download from the link you provided because the website has blocked the bot. Please try again later.');
} else {
return message.channel.send('An error has occured, I can\'t download from the link you provided.');
} }
let ext = 'mp4';