wyr: track real reaction votes and announce winner with counts
- 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:
@@ -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."""
|
||||
|
||||
Reference in New Issue
Block a user