mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-26 14:19:11 +02:00
Fix Back
This commit is contained in:
@@ -44,6 +44,7 @@ module.exports = class AkinatorCommand extends Command {
|
|||||||
let win = false;
|
let win = false;
|
||||||
let timesGuessed = 0;
|
let timesGuessed = 0;
|
||||||
let guessResetNum = 0;
|
let guessResetNum = 0;
|
||||||
|
let wentBack = false;
|
||||||
let forceGuess = false;
|
let forceGuess = false;
|
||||||
const guessBlacklist = [];
|
const guessBlacklist = [];
|
||||||
this.client.games.set(msg.channel.id, { name: this.name });
|
this.client.games.set(msg.channel.id, { name: this.name });
|
||||||
@@ -51,6 +52,8 @@ module.exports = class AkinatorCommand extends Command {
|
|||||||
if (guessResetNum > 0) guessResetNum--;
|
if (guessResetNum > 0) guessResetNum--;
|
||||||
if (ans === null) {
|
if (ans === null) {
|
||||||
await aki.start();
|
await aki.start();
|
||||||
|
} else if (wentBack) {
|
||||||
|
wentBack = false;
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
await aki.step(ans);
|
await aki.step(ans);
|
||||||
@@ -77,13 +80,16 @@ module.exports = class AkinatorCommand extends Command {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
const choice = msgs.first().content.toLowerCase();
|
const choice = msgs.first().content.toLowerCase();
|
||||||
if (choice === 'end') forceGuess = true;
|
if (choice === 'end') {
|
||||||
if (choice === 'back') {
|
forceGuess = true;
|
||||||
|
} else if (choice === 'back') {
|
||||||
if (guessResetNum > 0) guessResetNum++;
|
if (guessResetNum > 0) guessResetNum++;
|
||||||
|
wentBack = true;
|
||||||
await aki.back();
|
await aki.back();
|
||||||
continue;
|
continue;
|
||||||
|
} else {
|
||||||
|
ans = answers.indexOf(choice);
|
||||||
}
|
}
|
||||||
else ans = answers.indexOf(choice);
|
|
||||||
if ((aki.progress >= 90 && !guessResetNum) || forceGuess) {
|
if ((aki.progress >= 90 && !guessResetNum) || forceGuess) {
|
||||||
timesGuessed++;
|
timesGuessed++;
|
||||||
guessResetNum += 10;
|
guessResetNum += 10;
|
||||||
|
|||||||
Reference in New Issue
Block a user