Fix akinator answers being not sorted

This commit is contained in:
Dragon Fire
2020-05-19 18:09:40 -04:00
parent 1e8d86d556
commit c68a49bf27
2 changed files with 3 additions and 3 deletions
+2 -2
View File
@@ -59,7 +59,7 @@ module.exports = class AkinatorCommand extends Command {
const answers = aki.answers.map(answer => answer.toLowerCase());
answers.push('end');
await msg.say(stripIndents`
**${++aki.currentStep + 1}.** ${aki.question} (${Math.round(Number.parseInt(aki.progress, 10))}%)
**${aki.currentStep + 1}.** ${aki.question} (${Math.round(Number.parseInt(aki.progress, 10))}%)
${aki.answers.join(' | ')} | End
`);
const filter = res => res.author.id === msg.author.id && answers.includes(res.content.toLowerCase());
@@ -77,7 +77,7 @@ module.exports = class AkinatorCommand extends Command {
if (aki.progress >= 90 || forceGuess) {
timesGuessed += 1;
await aki.win();
const guess = aki.answers[0];
const guess = aki.answers.sort((a, b) => b.proba - a.proba)[0];
const embed = new MessageEmbed()
.setColor(0xF78B26)
.setTitle(`I'm ${Math.round(guess.proba * 100)}% sure it's...`)
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiao",
"version": "114.16.4",
"version": "114.16.5",
"description": "Your personal server companion.",
"main": "Xiao.js",
"scripts": {