From 7df144e107a90ecdadcf6b491827a83508ce5d49 Mon Sep 17 00:00:00 2001 From: Kumi Date: Fri, 8 Nov 2024 13:10:36 +0100 Subject: [PATCH] fix(bot): correct event content access in reactions Changed the `reaction_callback` method to access reaction event contents through `event.source["content"]` instead of `event.content`. This update addresses issues with data access during reaction handling, preventing potential errors. Added debug logging for improved tracing of reaction events. --- src/matrix_applicationbot/classes/bot.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/matrix_applicationbot/classes/bot.py b/src/matrix_applicationbot/classes/bot.py index f5c959a..763ce26 100644 --- a/src/matrix_applicationbot/classes/bot.py +++ b/src/matrix_applicationbot/classes/bot.py @@ -90,7 +90,9 @@ class ApplicationBot: await self.open_ticket(room, event.state_key) async def reaction_callback(self, room: MatrixRoom, event): - relation = event.content.get("m.relates_to", {}) + logging.debug(f"Received reaction event: {event}") + + relation = event.source["content"].get("m.relates_to", {}) message_id = relation.get("event_id") key = relation.get("key")