From ab29d885116eba1f9c9ddb9513e71a181da31bd4 Mon Sep 17 00:00:00 2001 From: Dragon Fire Date: Mon, 22 Apr 2024 15:28:13 -0400 Subject: [PATCH] Fix --- commands/games-sp/akinator.js | 11 +++-------- structures/Akinator.js | 4 ++-- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/commands/games-sp/akinator.js b/commands/games-sp/akinator.js index 6f4329fb..14d3a38e 100644 --- a/commands/games-sp/akinator.js +++ b/commands/games-sp/akinator.js @@ -36,7 +36,6 @@ module.exports = class AkinatorCommand extends Command { let ans = null; let win = false; let wentBack = false; - let gameOver = false; let timesGuessed = 0; const initialRow = new ActionRowBuilder().addComponents( new ButtonBuilder().setCustomId('true').setLabel('Ready!').setStyle(ButtonStyle.Primary), @@ -58,17 +57,13 @@ module.exports = class AkinatorCommand extends Command { return gameMsg.edit({ content: 'Guess you didn\'t want to play after all...', components: [] }); } await this.sendLoadingMessage(buttonPress, [initialRow]); - while (aki.akiWin === null && !gameOver) { + while (aki.akiWin === null) { if (ans === null) { await aki.start(); } else if (wentBack) { wentBack = false; } else { - try { - await aki.step(ans); - } catch { - await aki.step(ans); - } + await aki.step(ans); } if (aki.guessed) { const guess = aki.guessed; @@ -116,7 +111,7 @@ module.exports = class AkinatorCommand extends Command { } sRow.addComponents(new ButtonBuilder().setCustomId('end').setStyle(ButtonStyle.Danger).setLabel('End')); await buttonPress.editReply({ - content: `**${aki.currentStep}.** ${aki.question} (${Math.round(Number.parseInt(aki.progress, 10))}%)`, + content: `**${aki.currentStep + 1}.** ${aki.question} (${Math.round(Number.parseInt(aki.progress, 10))}%)`, components: [row, sRow], embeds: [] }); diff --git a/structures/Akinator.js b/structures/Akinator.js index b1476e5c..272cf502 100644 --- a/structures/Akinator.js +++ b/structures/Akinator.js @@ -53,7 +53,7 @@ class Akinator { }; return this; } - this.step++; + this.currentStep++; this.progress = body.progression; this.question = body.question; return this; @@ -70,7 +70,7 @@ class Akinator { session: this.session, signature: this.signature }); - this.step--; + this.currentStep--; this.progress = body.progression; this.question = body.question; return this;