This commit is contained in:
Dragon Fire
2021-04-17 22:05:35 -04:00
parent 4ceb27e71e
commit c6996cccdf
+10 -1
View File
@@ -72,7 +72,7 @@ module.exports = class TwentyQuestionsCommand extends Command {
this.client.games.delete(msg.channel.id); this.client.games.delete(msg.channel.id);
if (win === 'time') return msg.say('Game ended due to forfeit.'); if (win === 'time') return msg.say('Game ended due to forfeit.');
return msg.say(stripIndents` return msg.say(stripIndents`
**${question.win ? 'You won!' : '20Q won!'}** **${question.winText}**
${question.result} ${question.result}
`); `);
} catch (err) { } catch (err) {
@@ -130,15 +130,24 @@ module.exports = class TwentyQuestionsCommand extends Command {
if (win === '20Q won!') { if (win === '20Q won!') {
return { return {
win: false, win: false,
winText: win,
result: $('big').first().children().first().text() result: $('big').first().children().first().text()
}; };
} }
if (win === 'You won!') { if (win === 'You won!') {
return { return {
win: true, win: true,
winText: win,
result: 'I was unable to guess what you were thinking. Nice job!' result: 'I was unable to guess what you were thinking. Nice job!'
}; };
} }
if (win === 'You won, but 20Q guessed it eventually') {
return {
win: true,
winText: win,
result: $('big').first().children().first().text()
};
}
const resultText = $('big').first().children().first(); const resultText = $('big').first().children().first();
const answers = []; const answers = [];
$(resultText).find('a').each((i, elem) => { $(resultText).find('a').each((i, elem) => {