Fix error preventing any bot from syncing

This commit is contained in:
Tulir Asokan 2019-07-09 23:08:28 +03:00
parent d32a88f3b4
commit cd43fcde4b

View File

@ -21,8 +21,7 @@ import attr
from mautrix import Client as MatrixClient from mautrix import Client as MatrixClient
from mautrix.util.formatter import parse_html from mautrix.util.formatter import parse_html
from mautrix.types import (EventType, MessageEvent, Event, EventID, RoomID, MessageEventContent, from mautrix.types import (EventType, MessageEvent, Event, EventID, RoomID, MessageEventContent,
MessageType, TextMessageEventContent, Format, RelatesTo, RelationType, MessageType, TextMessageEventContent, Format, RelatesTo)
ReactionEventContent)
class EscapeHTML(Extension): class EscapeHTML(Extension):
@ -84,12 +83,12 @@ class MaubotMatrixClient(MatrixClient):
content.relates_to = relates_to content.relates_to = relates_to
return self.send_message(room_id, content, **kwargs) return self.send_message(room_id, content, **kwargs)
async def call_handlers(self, event: Event) -> None: async def call_handlers(self, event: Event, source) -> None:
if isinstance(event, MessageEvent): if isinstance(event, MessageEvent):
event = MaubotMessageEvent(event, self) event = MaubotMessageEvent(event, self)
else: else:
event.client = self event.client = self
return await super().call_handlers(event) return await super().call_handlers(event, source)
async def get_event(self, room_id: RoomID, event_id: EventID) -> Event: async def get_event(self, room_id: RoomID, event_id: EventID) -> Event:
event = await super().get_event(room_id, event_id) event = await super().get_event(room_id, event_id)