wyr: track real reaction votes and announce winner with counts
Lint / Shell (shellcheck) (push) Successful in 27s
Lint / JS (eslint) (push) Successful in 14s
Lint / Python (ruff) (push) Successful in 11s
Lint / Python deps (pip-audit) (push) Successful in 45s
Lint / Secret scan (gitleaks) (push) Successful in 5s

- Add _WYR_POLLS dict keyed by poll event_id to accumulate votes
- record_wyr_vote() called from callbacks.reaction() on every reaction
- reveal() reads actual vote counts and announces winner with percentage
- Handles tie and zero-vote cases
- Remove the useless 'check the reactions above' message

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-22 01:02:25 -04:00
parent 6c00e8b4fd
commit c9d9febbe0
2 changed files with 53 additions and 16 deletions
+2 -1
View File
@@ -4,7 +4,7 @@ from functools import wraps
from nio import AsyncClient
from config import BOT_PREFIX, MATRIX_USER_ID
from commands import COMMANDS, metrics, check_scramble_answer, check_riddle_answer
from commands import COMMANDS, metrics, check_scramble_answer, check_riddle_answer, record_wyr_vote
from welcome import handle_welcome_reaction, handle_space_join, SPACE_ROOM_ID
logger = logging.getLogger("matrixbot")
@@ -94,6 +94,7 @@ class Callbacks:
await handle_welcome_reaction(
self.client, room.room_id, event.sender, reacted_event_id, key
)
record_wyr_vote(reacted_event_id, event.sender, key)
async def member(self, room, event):
"""Handle m.room.member events — watch for Space joins."""