Fix empty choice list in akinator

This commit is contained in:
Daniel Odendahl Jr
2018-10-18 17:19:35 +00:00
parent 5d79b3feae
commit aab1ec59dc
2 changed files with 4 additions and 2 deletions
+3 -1
View File
@@ -45,12 +45,13 @@ module.exports = class AkinatorCommand extends Command {
ans = answers.indexOf(msgs.first().content.toLowerCase());
}
const guess = await this.guess(msg.channel);
if (guess === 0) return msg.say('I don\'t have any guesses. Bravo.');
if (!guess) return msg.reply('Hmm... I seem to be having a bit of trouble. Check back soon!');
const embed = new MessageEmbed()
.setColor(0xF78B26)
.setTitle(`I'm ${Math.round(guess.proba * 100)}% sure it's...`)
.setDescription(`${guess.name}${guess.description ? `\n_${guess.description}_` : ''}`)
.setThumbnail(guess.absolute_picture_path);
.setThumbnail(guess.absolute_picture_path || null);
await msg.embed(embed);
const verification = await verify(msg.channel, msg.author);
this.sessions.delete(msg.channel.id);
@@ -123,6 +124,7 @@ module.exports = class AkinatorCommand extends Command {
duel_allowed: 1,
mode_question: 0
});
if (body.completion === 'KO - ELEM LIST IS EMPTY') return 0;
if (body.completion !== 'OK') return null;
return body.parameters.elements[0].element;
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiao",
"version": "95.1.7",
"version": "95.1.8",
"description": "Your personal server companion.",
"main": "Xiao.js",
"scripts": {