mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-07 14:55:40 +02:00
Show full results in sorting hat
This commit is contained in:
@@ -59,11 +59,14 @@ module.exports = class SortingHatCommand extends Command {
|
||||
for (const [house, amount] of Object.entries(answer.points)) points[house] += amount;
|
||||
++turn;
|
||||
}
|
||||
const house = Object.keys(points).sort((a, b) => points[b] - points[a])[0];
|
||||
const houseResult = Object.keys(points).sort((a, b) => points[b] - points[a]);
|
||||
this.playing.delete(msg.channel.id);
|
||||
const totalPoints = points.g + points.s + points.h + points.r;
|
||||
return msg.say(stripIndents`
|
||||
You are a member of... **${houses[house]}**!
|
||||
_${descriptions[house]}_
|
||||
You are a member of... **${houses[houseResult[0]]}**!
|
||||
_${descriptions[houseResult[0]]}_
|
||||
|
||||
${houseResult.map(house => `${houses[house]}: ${Math.round(points[house] / totalPoints)}%`).join('\n')}
|
||||
`);
|
||||
} catch (err) {
|
||||
this.playing.delete(msg.channel.id);
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xiao",
|
||||
"version": "101.10.1",
|
||||
"version": "101.10.2",
|
||||
"description": "Your personal server companion.",
|
||||
"main": "Xiao.js",
|
||||
"scripts": {
|
||||
|
||||
Reference in New Issue
Block a user