This commit is contained in:
lilyissillyyy
2025-09-18 17:33:59 -04:00
parent 33fea2bd8b
commit fc963ff002
2 changed files with 5 additions and 3 deletions
+1 -1
View File
@@ -1285,7 +1285,7 @@
{ {
"text": "No, I agree with her.", "text": "No, I agree with her.",
"points": { "points": {
"b": 100 "b": 99999999
} }
} }
] ]
+4 -2
View File
@@ -68,13 +68,15 @@ module.exports = class SortingHatCommand extends Command {
}); });
if (!choice.size) return msg.say('Oh no, you ran out of time! Too bad.'); if (!choice.size) return msg.say('Oh no, you ran out of time! Too bad.');
if (choice.first().content.toUpperCase() === 'END') return msg.say('See you next time!'); if (choice.first().content.toUpperCase() === 'END') return msg.say('See you next time!');
const answer = answers[choices.indexOf(choice.first().content.toUpperCase())]; const answer = answers[choices.indexOf(choice.first().content.toUpperCase()) - 1];
for (const [house, amount] of Object.entries(answer.points)) points[house] += amount; for (const [house, amount] of Object.entries(answer.points)) points[house] += amount;
++turn; ++turn;
} }
const houseResult = Object.keys(points).filter(h => points[h] > 0).sort((a, b) => points[b] - points[a]); const houseResult = Object.keys(points).filter(h => points[h] > 0).sort((a, b) => points[b] - points[a]);
const totalPoints = houseResult.reduce((a, b) => a + points[b], 0); const totalPoints = houseResult.reduce((a, b) => a + points[b], 0);
const lb = houseResult.map(house => `${houses[house]}: ${Math.round((points[house] / totalPoints) * 100)}%`).join('\n'); const lb = houseResult.map(
house => `${houses[house]}: ${Math.round((points[house] / totalPoints) * 100)}%`
).join('\n');
return msg.say(stripIndents` return msg.say(stripIndents`
You are a member of... **${houses[houseResult[0]]}**! You are a member of... **${houses[houseResult[0]]}**!
_${descriptions[houseResult[0]]}_ _${descriptions[houseResult[0]]}_