fix(bot): un-reacting from a poll never un-counted the vote
wyr/acronym/nhie/hottake tracked votes only on reaction-add, using "add to bucket A, remove from bucket B" logic that self-corrects when switching reactions but not when a reaction is simply removed — nio never subscribed to RedactionEvent at all, so an un-react was invisible to the bot. Fixes LotusGuild/matrix#6 (repro: react agree and disagree, remove disagree, still counted as disagree). Adds unrecord_* counterparts to each record_* vote function, a reaction_id -> (poll_event_id, sender) index in Callbacks (only populated for reactions on messages we're actually tracking, so it stays bounded) so a later redaction can be traced back to what to un-count, and wires up RedactionEvent -> callbacks.redaction in bot.py. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -10,6 +10,7 @@ from nio import (
|
||||
InviteMemberEvent,
|
||||
LoginResponse,
|
||||
ReactionEvent,
|
||||
RedactionEvent,
|
||||
RoomMemberEvent,
|
||||
RoomMessageText,
|
||||
UnknownEvent,
|
||||
@@ -146,6 +147,7 @@ async def main():
|
||||
client.add_event_callback(callbacks.message, RoomMessageText)
|
||||
client.add_event_callback(callbacks.reaction, ReactionEvent)
|
||||
client.add_event_callback(callbacks.unknown_event, UnknownEvent)
|
||||
client.add_event_callback(callbacks.redaction, RedactionEvent)
|
||||
client.add_event_callback(callbacks.member, RoomMemberEvent)
|
||||
|
||||
# Accept invites only from trusted users, and decline the rest so they do
|
||||
|
||||
Reference in New Issue
Block a user