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)