from __future__ import annotations from typing import Any def should_auto_join(room_id: str, config: dict[str, Any]) -> bool: auto_join = config.get("autoJoin", "off") if auto_join == "always": return True if auto_join == "off": return False if auto_join == "allowlist": rooms = config.get("rooms", {}) room_cfg = rooms.get(room_id, {}) return room_cfg.get("allow", True) return False