fedimbed: quick poll fix

This commit is contained in:
Cynthia Foxwell 2025-04-18 18:27:17 -06:00
parent e3a0eca03f
commit 5419caa553
Signed by: Cynosphere
SSH key fingerprint: SHA256:H3SM8ufP/uxqLwKSH7xY89TDnbR9uOHzjLoBr0tlajk

View file

@ -1398,12 +1398,13 @@ async function processUrl(msg, url, spoiler = false, command = false) {
container.components.push({ container.components.push({
type: 10, type: 10,
content: content:
"> " +
poll.options poll.options
.map((o) => { .map((o) => {
const percent = o.count / poll.total; const percent = o.count / poll.total;
const bar = Math.round(percent * 32); const bar = Math.round(percent * 32);
return `> **${o.name}** (${numberFormatter.format(o.count)}, ${Math.round( return `**${o.name}** (${numberFormatter.format(o.count)}, ${Math.round(
percent * 100 percent * 100
)}%\n> \`${"\u2588".repeat(bar)}${" ".repeat(32 - bar)}\``; )}%\n> \`${"\u2588".repeat(bar)}${" ".repeat(32 - bar)}\``;
}) })