From cf83e86e78571fd197b871ba7f193fdc8e8e079b Mon Sep 17 00:00:00 2001 From: Andrew Ferrazzutti Date: Sun, 10 Apr 2022 02:21:00 -0400 Subject: [PATCH] Check that relay users are connected --- matrix_appservice_kakaotalk/matrix.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/matrix_appservice_kakaotalk/matrix.py b/matrix_appservice_kakaotalk/matrix.py index b3374ad..3f6e9eb 100644 --- a/matrix_appservice_kakaotalk/matrix.py +++ b/matrix_appservice_kakaotalk/matrix.py @@ -47,7 +47,12 @@ class MatrixHandler(BaseMatrixHandler): @staticmethod async def allow_bridging_message(user: u.User, portal: po.Portal) -> bool: - return user.is_connected or (user.relay_whitelisted and portal.has_relay) + if user.is_connected: + return True + if user.relay_whitelisted and portal.has_relay: + relay_user = await portal.get_relay_user() + return relay_user and relay_user.is_connected + return False async def send_welcome_message(self, room_id: RoomID, inviter: u.User) -> None: await super().send_welcome_message(room_id, inviter)