mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
Fix
This commit is contained in:
@@ -30,9 +30,10 @@ module.exports = class AkinatorCommand extends Command {
|
||||
const aki = new Aki('en');
|
||||
let ans = null;
|
||||
let win = false;
|
||||
let timesGuessed = 0;
|
||||
let forceGuess = false;
|
||||
this.client.games.set(msg.channel.id, { name: this.name });
|
||||
while (!aki.guessCount || aki.guessCount < 3) {
|
||||
while (timesGuessed < 3) {
|
||||
if (ans === null) await aki.start();
|
||||
else await aki.step(ans);
|
||||
if (!aki.answers || aki.currentStep >= 80) {
|
||||
@@ -58,6 +59,7 @@ module.exports = class AkinatorCommand extends Command {
|
||||
if (msgs.first().content.toLowerCase() === 'end') forceGuess = true;
|
||||
else ans = answers.indexOf(msgs.first().content.toLowerCase());
|
||||
if (aki.progress >= 90 || forceGuess) {
|
||||
timesGuessed += 1;
|
||||
await aki.win();
|
||||
const guess = aki.answers[0];
|
||||
const embed = new MessageEmbed()
|
||||
@@ -74,9 +76,9 @@ module.exports = class AkinatorCommand extends Command {
|
||||
win = false;
|
||||
break;
|
||||
} else {
|
||||
const exMsg = aki.guessCount >= 3 || forceGuess ? 'I give up.' : 'I can keep going!';
|
||||
const exMsg = timesGuessed >= 3 || forceGuess ? 'I give up.' : 'I can keep going!';
|
||||
await msg.say(`Hmm... Is that so? ${exMsg}`);
|
||||
if (aki.guessCount >= 3 || forceGuess) {
|
||||
if (timesGuessed >= 3 || forceGuess) {
|
||||
win = true;
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user