forked from Supositware/Haha-Yes
if there is an error making a ytp try again
Signed-off-by: loicbersier <loic.bersier1@gmail.com>
This commit is contained in:
parent
d73ce41a47
commit
70b4b6402e
1 changed files with 14 additions and 5 deletions
|
@ -321,11 +321,20 @@ class ytpCommand extends Command {
|
|||
.catch(err => {
|
||||
console.error(err);
|
||||
loadingmsg.delete();
|
||||
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);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue