Retry once if akinator fails a step

This commit is contained in:
Dragon Fire
2020-05-19 14:46:23 -04:00
parent 954b1a7631
commit 3847c0f687
2 changed files with 10 additions and 3 deletions
+9 -2
View File
@@ -46,8 +46,15 @@ module.exports = class AkinatorCommand extends Command {
let forceGuess = false;
this.client.games.set(msg.channel.id, { name: this.name });
while (timesGuessed < 3) {
if (ans === null) await aki.start();
else await aki.step(ans);
if (ans === null) {
await aki.start();
} else {
try {
await aki.step(ans);
} catch {
await aki.step(ans);
}
}
if (!aki.answers || aki.currentStep >= 78) forceGuess = true;
const answers = aki.answers.map(answer => answer.toLowerCase());
answers.push('end');
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiao",
"version": "114.16.3",
"version": "114.16.4",
"description": "Your personal server companion.",
"main": "Xiao.js",
"scripts": {