Actually show better errors
This commit is contained in:
parent
18193e1b78
commit
1bbe7702d3
2 changed files with 4 additions and 4 deletions
|
@ -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) {
|
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);
|
console.log(output);
|
||||||
if (err) {
|
if (err) {
|
||||||
console.error(err);
|
console.error(err.toString());
|
||||||
loadingmsg.delete();
|
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.');
|
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 {
|
} else {
|
||||||
return message.channel.send('An error has occured, I can\'t download from the link you provided. Is it an mp4?');
|
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) {
|
return youtubedl.exec(link, ['--rm-cache-dir', '-o', `${os.tmpdir()}/${fileName}`], {}, async function(err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
console.error(err);
|
console.error(err.toString());
|
||||||
loadingmsg.delete();
|
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.');
|
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 {
|
} else {
|
||||||
return message.channel.send('An error has occured, I can\'t download from the link you provided.');
|
return message.channel.send('An error has occured, I can\'t download from the link you provided.');
|
||||||
|
|
Loading…
Reference in a new issue