Don't error on member leave if puppet left already

This commit is contained in:
Andrew Ferrazzutti 2021-07-05 18:51:29 -04:00
parent 9e739e9908
commit e0f21ed824
1 changed files with 5 additions and 1 deletions

View File

@ -30,6 +30,7 @@ from mautrix.types import (EventID, MessageEventContent, RoomID, EventType, Mess
ContentURI, EncryptedFile, ImageInfo,
RelatesTo, RelationType)
from mautrix.errors import IntentError
from mautrix.errors.request import MatrixRequestError
from mautrix.util.simple_lock import SimpleLock
from .db import Portal as DBPortal, Message as DBMessage, Receipt as DBReceipt, ReceiptReaction as DBReceiptReaction, Media as DBMedia
@ -370,7 +371,10 @@ class Portal(DBPortal, BasePortal):
if evt.member_info.joined:
await intent.ensure_joined(self.mxid)
elif evt.member_info.left:
try:
await intent.leave_room(self.mxid)
except MatrixRequestError as e:
self.log.warn(f"Puppet for user {evt.sender.id} already left portal {self.mxid}")
event_id = None
else:
content = TextMessageEventContent(