Add poll chat command with reaction voting

This commit is contained in:
Fisto
2026-09-11 15:59:08 +02:00
parent 8e8c15e8bc
commit ace0bb18ff
16 changed files with 291 additions and 9 deletions
+10
View File
@@ -17,6 +17,7 @@ import {
hasTier,
isTrusted,
parseCommand,
parsePoll,
parseTier,
randomActionDelay,
redactSecrets,
@@ -176,4 +177,13 @@ function entry(id: number, trusted: boolean): PuppetMessage {
assert.equal(log.find("nope"), undefined);
}
// poll parser
{
assert.deepEqual(parsePoll("Lunch? | Pizza | Sushi"), { question: "Lunch?", options: ["Pizza", "Sushi"] });
assert.deepEqual(parsePoll("Q | A | B | C | D"), { question: "Q", options: ["A", "B", "C", "D"] });
assert.equal(parsePoll("Q | A"), undefined);
assert.equal(parsePoll("Q | A | B | C | D | E"), undefined);
assert.equal(parsePoll(`Q | ${"x".repeat(100)} | B`), undefined);
}
console.log("all communication tests passed");