start support for redaction events

This commit is contained in:
HgO 2022-07-10 14:49:01 +02:00
parent 56eb1e82b1
commit e1d1b7aba5

View file

@ -185,6 +185,12 @@ class Callbacks:
if reacted_to_event.sender != self.config.user_id:
return
self.cache.set(
event.event_id,
reacted_to_event.event_id,
expire=self.config.cache_expire_time,
)
# Send a message acknowledging the reaction
command = Command(
self.client,
@ -229,8 +235,11 @@ class Callbacks:
if event.sender == self.config.user_id:
return
redacted_event = await self.client.room_get_event(room.room_id, event.redacts)
print(redacted_event.source)
reacted_to_event_id = self.cache[event.redacts]
reacted_to_event = await self.client.room_get_event(
room.room_id, reacted_to_event_id
)
print(reacted_to_event.source)
async def unknown(self, room: MatrixRoom, event: UnknownEvent) -> None:
"""Callback for when an event with a type that is unknown to matrix-nio is received.