From c68a49bf277856e8d8e10b89545b269bef5f15b3 Mon Sep 17 00:00:00 2001 From: Dragon Fire Date: Tue, 19 May 2020 18:09:40 -0400 Subject: [PATCH] Fix akinator answers being not sorted --- commands/games-sp/akinator.js | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/commands/games-sp/akinator.js b/commands/games-sp/akinator.js index fe17a32a..7325b719 100644 --- a/commands/games-sp/akinator.js +++ b/commands/games-sp/akinator.js @@ -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...`) diff --git a/package.json b/package.json index 9d6d0361..bbc8f6ec 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "114.16.4", + "version": "114.16.5", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": {