fedimbed: format poll option counts
This commit is contained in:
parent
55553ada6a
commit
66aa9cc1c7
1 changed files with 4 additions and 3 deletions
|
@ -103,6 +103,7 @@ const statsFormatter = Intl.NumberFormat("en-US", {
|
|||
notation: "compact",
|
||||
maximumFractionDigits: 1,
|
||||
});
|
||||
const numberFormatter = Intl.NumberFormat("en-US");
|
||||
|
||||
const domainCache = new Map();
|
||||
domainCache.set("cohost.org", "cohost"); // no nodeinfo
|
||||
|
@ -1516,9 +1517,9 @@ async function processUrl(msg, url, spoiler = false, command = false) {
|
|||
const percent = o.count / poll.total;
|
||||
const bar = Math.round(percent * 32);
|
||||
|
||||
return `**${o.name}** (${o.count}, ${Math.round(percent * 100)}%)\n\`${"\u2588".repeat(bar)}${" ".repeat(
|
||||
32 - bar
|
||||
)}\``;
|
||||
return `**${o.name}** (${numberFormatter.format(o.count)}, ${Math.round(
|
||||
percent * 100
|
||||
)}%)\n\`${"\u2588".repeat(bar)}${" ".repeat(32 - bar)}\``;
|
||||
})
|
||||
.join("\n\n") + `\n\n${poll.total} votes \u2022 Ends <t:${Math.floor(poll.end.getTime() / 1000)}:R>`,
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue