From 18193e1b782de6858b55054a8cd21a31b1099d8f Mon Sep 17 00:00:00 2001 From: loicbersier Date: Thu, 14 May 2020 17:01:19 +0200 Subject: [PATCH] Better error message for HTTP ERROR 429 --- commands/fun/ytp.js | 6 +++++- commands/utility/download.js | 7 +++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/commands/fun/ytp.js b/commands/fun/ytp.js index 7af38323..0ce78c01 100644 --- a/commands/fun/ytp.js +++ b/commands/fun/ytp.js @@ -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')) { diff --git a/commands/utility/download.js b/commands/utility/download.js index d26a0320..2e962b86 100644 --- a/commands/utility/download.js +++ b/commands/utility/download.js @@ -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';