|
@@ -16,13 +16,12 @@
|
|
from typing import List, Union, TYPE_CHECKING
|
|
from typing import List, Union, TYPE_CHECKING
|
|
|
|
|
|
from mautrix.bridge import BaseMatrixHandler
|
|
from mautrix.bridge import BaseMatrixHandler
|
|
-from mautrix.types import (Event, ReactionEvent, MessageEvent, StateEvent, EncryptedEvent, RoomID,
|
|
|
|
- EventID, UserID, ReactionEventContent, RelationType, EventType,
|
|
|
|
- ReceiptEvent, TypingEvent, PresenceEvent, RedactionEvent,
|
|
|
|
- SingleReceiptEventContent)
|
|
|
|
|
|
+from mautrix.types import (Event, ReactionEvent, RoomID, EventID, UserID, ReactionEventContent,
|
|
|
|
+ RelationType, EventType, ReceiptEvent, TypingEvent, PresenceEvent,
|
|
|
|
+ RedactionEvent, SingleReceiptEventContent)
|
|
|
|
|
|
from .db import Message as DBMessage
|
|
from .db import Message as DBMessage
|
|
-from . import puppet as pu, portal as po, user as u
|
|
|
|
|
|
+from . import portal as po, user as u
|
|
|
|
|
|
if TYPE_CHECKING:
|
|
if TYPE_CHECKING:
|
|
from .__main__ import InstagramBridge
|
|
from .__main__ import InstagramBridge
|
|
@@ -37,15 +36,6 @@ class MatrixHandler(BaseMatrixHandler):
|
|
|
|
|
|
super().__init__(bridge=bridge)
|
|
super().__init__(bridge=bridge)
|
|
|
|
|
|
- def filter_matrix_event(self, evt: Event) -> bool:
|
|
|
|
- if isinstance(evt, (ReceiptEvent, TypingEvent)):
|
|
|
|
- return False
|
|
|
|
- elif not isinstance(evt, (ReactionEvent, MessageEvent, StateEvent, EncryptedEvent,
|
|
|
|
- RedactionEvent)):
|
|
|
|
- return True
|
|
|
|
- return (evt.sender == self.az.bot_mxid
|
|
|
|
- or pu.Puppet.get_id_from_mxid(evt.sender) is not None)
|
|
|
|
-
|
|
|
|
async def send_welcome_message(self, room_id: RoomID, inviter: 'u.User') -> None:
|
|
async def send_welcome_message(self, room_id: RoomID, inviter: 'u.User') -> None:
|
|
await super().send_welcome_message(room_id, inviter)
|
|
await super().send_welcome_message(room_id, inviter)
|
|
if not inviter.notice_room:
|
|
if not inviter.notice_room:
|