fix: wyr votes never counted — reactions arrive as ReactionEvent not UnknownEvent
Lint / Shell (shellcheck) (push) Successful in 12s
Lint / JS (eslint) (push) Successful in 8s
Lint / Python (ruff) (push) Successful in 11s
Lint / Python deps (pip-audit) (push) Successful in 49s
Lint / Secret scan (gitleaks) (push) Successful in 5s

nio has a dedicated ReactionEvent type with .reacts_to and .key attributes.
The callback was registered for UnknownEvent so reaction events were silently
dropped. Register for ReactionEvent and use its native attributes; keep the
UnknownEvent fallback for edge cases.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-22 14:00:03 -04:00
parent 126979f5cb
commit 80d77a8a0f
2 changed files with 23 additions and 23 deletions
+3 -1
View File
@@ -9,6 +9,7 @@ from nio import (
AsyncClientConfig,
InviteMemberEvent,
LoginResponse,
ReactionEvent,
RoomMemberEvent,
RoomMessageText,
UnknownEvent,
@@ -143,7 +144,8 @@ async def main():
callbacks = Callbacks(client)
client.add_event_callback(callbacks.message, RoomMessageText)
client.add_event_callback(callbacks.reaction, UnknownEvent)
client.add_event_callback(callbacks.reaction, ReactionEvent)
client.add_event_callback(callbacks.unknown_event, UnknownEvent)
client.add_event_callback(callbacks.member, RoomMemberEvent)
# Auto-accept room invites