hangman: edit board in place + fix ASCII art rendering; wyr: debug reaction logging
Lint / Shell (shellcheck) (push) Successful in 9s
Lint / JS (eslint) (push) Successful in 7s
Lint / Python (ruff) (push) Successful in 5s
Lint / Python deps (pip-audit) (push) Successful in 44s
Lint / Secret scan (gitleaks) (push) Successful in 6s

- Add edit_html() to utils using m.replace so messages can be updated
- Hangman board now edits in place on every guess — shows progressing
  ASCII figure as wrong guesses accumulate instead of spamming new messages
- Extract _hangman_board_html() helper for consistent board rendering
- wyr: add INFO-level logging to reaction callback to diagnose vote tracking

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-22 13:30:46 -04:00
parent 3405ab8b32
commit 126979f5cb
3 changed files with 90 additions and 87 deletions
+13 -3
View File
@@ -81,19 +81,29 @@ class Callbacks:
# m.reaction events come as UnknownEvent with type "m.reaction"
if not hasattr(event, "source"):
logger.info("reaction: event has no source attr, type=%s sender=%s", type(event).__name__, event.sender)
return
event_type = event.source.get("type", "")
content = event.source.get("content", {})
relates_to = content.get("m.relates_to", {})
if relates_to.get("rel_type") != "m.annotation":
return
rel_type = relates_to.get("rel_type", "")
reacted_event_id = relates_to.get("event_id", "")
key = relates_to.get("key", "")
logger.info(
"reaction: type=%s rel_type=%s key=%r target=%s sender=%s",
event_type, rel_type, key, reacted_event_id[:16] if reacted_event_id else "", event.sender,
)
if rel_type != "m.annotation":
return
await handle_welcome_reaction(
self.client, room.room_id, event.sender, reacted_event_id, key
)
from commands import _WYR_POLLS
logger.info("reaction: wyr polls active=%s matched=%s", list(_WYR_POLLS.keys()), reacted_event_id in _WYR_POLLS)
record_wyr_vote(reacted_event_id, event.sender, key)
async def member(self, room, event):