Actually show better errors

merge-requests/5/merge
loicbersier 4 years ago
parent 18193e1b78
commit 1bbe7702d3

@ -135,9 +135,9 @@ class ytpCommand extends Command {
return youtubedl.exec(url, ['--rm-cache-dir', '--no-playlist', '--max-filesize', '50m', '--format=mp4', '-o', `./asset/ytp/userVid/${message.id}.mp4`], {}, async function(err, output) {
console.log(output);
if (err) {
console.error(err);
console.error(err.toString());
loadingmsg.delete();
if (err.includes('HTTP Error 429')) {
if (err.toString().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?');

@ -74,9 +74,9 @@ class DownloadCommand extends Command {
}
return youtubedl.exec(link, ['--rm-cache-dir', '-o', `${os.tmpdir()}/${fileName}`], {}, async function(err) {
if (err) {
console.error(err);
console.error(err.toString());
loadingmsg.delete();
if (err.includes('HTTP Error 429')) {
if (err.toString().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.');

Loading…
Cancel
Save