fedimbed: poll time awareness
This commit is contained in:
parent
66aa9cc1c7
commit
9f5ebe42fa
1 changed files with 4 additions and 1 deletions
|
@ -1509,6 +1509,8 @@ async function processUrl(msg, url, spoiler = false, command = false) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (poll) {
|
if (poll) {
|
||||||
|
const pollTime = poll.end.getTime();
|
||||||
|
const now = Date.now();
|
||||||
baseEmbed.fields.push({
|
baseEmbed.fields.push({
|
||||||
name: "Poll",
|
name: "Poll",
|
||||||
value:
|
value:
|
||||||
|
@ -1521,7 +1523,8 @@ async function processUrl(msg, url, spoiler = false, command = false) {
|
||||||
percent * 100
|
percent * 100
|
||||||
)}%)\n\`${"\u2588".repeat(bar)}${" ".repeat(32 - bar)}\``;
|
)}%)\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>`,
|
.join("\n\n") +
|
||||||
|
`\n\n${poll.total} votes \u2022 End${pollTime > now ? "s" : "ed"} <t:${Math.floor(pollTime / 1000)}:R>`,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue