if there is an error making a ytp try again

Signed-off-by: loicbersier <loic.bersier1@gmail.com>
This commit is contained in:
loicbersier 2020-09-18 16:40:06 +02:00
parent d73ce41a47
commit 70b4b6402e

View file

@ -321,11 +321,20 @@ class ytpCommand extends Command {
.catch(err => {
console.error(err);
loadingmsg.delete();
return message.reply({files: [Math.random() < 0.5 ? './asset/ytp/error1.mp4' : './asset/ytp/error2.mp4']})
.catch(err => { // In case it can't send the video for some reason
console.error(err);
return message.channel.send('Oh no, an error has occurred! please try again. If this happens alot, you should report this to the developers.');
});
if (!args.retry)
args.retry = 0;
else
args.retry += 1;
if (args.retry === 3) {
return message.reply({files: [Math.random() < 0.5 ? './asset/ytp/error1.mp4' : './asset/ytp/error2.mp4']})
.catch(err => { // In case it can't send the video for some reason
console.error(err);
return message.channel.send('Oh no, an error has occurred! please try again. If this happens alot, you should report this to the developers.');
});
}
return this.client.commandHandler.runCommand(message, this.client.commandHandler.findCommand('ytp'), args);
});
}
}