Commit 11e18633 authored by Tulir Asokan's avatar Tulir Asokan 🐈
Browse files

Add support for encrypted events

parent 8e9bb426
Pipeline #88 passed with stage
in 18 seconds
......@@ -20,7 +20,7 @@ import magic
from mautrix.util.config import BaseProxyConfig, ConfigUpdateHelper
from mautrix.types import (EventType, UserID, RoomID, MediaMessageEventContent, ImageInfo,
ThumbnailInfo, ContentURI, MessageType)
ThumbnailInfo, ContentURI, MessageType, GenericEvent)
from maubot import Plugin, MessageEvent
from maubot.handlers import event
......@@ -122,8 +122,11 @@ class DisruptorBot(Plugin):
n += 1
self.log.info(f"{n} posts cached from {subreddit}")
@event.on(EventType.ROOM_MESSAGE)
@event.on(EventType.ROOM_ENCRYPTED)
async def encrypted_monologue_detector(self, evt: GenericEvent) -> None:
await self.monologue_detector(evt)
@event.on(EventType.ROOM_MESSAGE)
async def monologue_detector(self, evt: MessageEvent) -> None:
monologue = self.monologue_size.setdefault(evt.room_id, MonologueInfo())
if monologue.is_outdated(self.config["max_monologue_delay"]):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment