mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-26 06:42:50 +02:00
Fix
This commit is contained in:
@@ -36,7 +36,6 @@ module.exports = class AkinatorCommand extends Command {
|
|||||||
let ans = null;
|
let ans = null;
|
||||||
let win = false;
|
let win = false;
|
||||||
let wentBack = false;
|
let wentBack = false;
|
||||||
let gameOver = false;
|
|
||||||
let timesGuessed = 0;
|
let timesGuessed = 0;
|
||||||
const initialRow = new ActionRowBuilder().addComponents(
|
const initialRow = new ActionRowBuilder().addComponents(
|
||||||
new ButtonBuilder().setCustomId('true').setLabel('Ready!').setStyle(ButtonStyle.Primary),
|
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: [] });
|
return gameMsg.edit({ content: 'Guess you didn\'t want to play after all...', components: [] });
|
||||||
}
|
}
|
||||||
await this.sendLoadingMessage(buttonPress, [initialRow]);
|
await this.sendLoadingMessage(buttonPress, [initialRow]);
|
||||||
while (aki.akiWin === null && !gameOver) {
|
while (aki.akiWin === null) {
|
||||||
if (ans === null) {
|
if (ans === null) {
|
||||||
await aki.start();
|
await aki.start();
|
||||||
} else if (wentBack) {
|
} else if (wentBack) {
|
||||||
wentBack = false;
|
wentBack = false;
|
||||||
} else {
|
} else {
|
||||||
try {
|
await aki.step(ans);
|
||||||
await aki.step(ans);
|
|
||||||
} catch {
|
|
||||||
await aki.step(ans);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (aki.guessed) {
|
if (aki.guessed) {
|
||||||
const guess = 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'));
|
sRow.addComponents(new ButtonBuilder().setCustomId('end').setStyle(ButtonStyle.Danger).setLabel('End'));
|
||||||
await buttonPress.editReply({
|
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],
|
components: [row, sRow],
|
||||||
embeds: []
|
embeds: []
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ class Akinator {
|
|||||||
};
|
};
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
this.step++;
|
this.currentStep++;
|
||||||
this.progress = body.progression;
|
this.progress = body.progression;
|
||||||
this.question = body.question;
|
this.question = body.question;
|
||||||
return this;
|
return this;
|
||||||
@@ -70,7 +70,7 @@ class Akinator {
|
|||||||
session: this.session,
|
session: this.session,
|
||||||
signature: this.signature
|
signature: this.signature
|
||||||
});
|
});
|
||||||
this.step--;
|
this.currentStep--;
|
||||||
this.progress = body.progression;
|
this.progress = body.progression;
|
||||||
this.question = body.question;
|
this.question = body.question;
|
||||||
return this;
|
return this;
|
||||||
|
|||||||
Reference in New Issue
Block a user