24 lines
726 B
Python
24 lines
726 B
Python
from __future__ import annotations
|
|
|
|
from typing import Any
|
|
|
|
|
|
def get_room_config(room_id: str, config: dict[str, Any]) -> dict[str, Any]:
|
|
rooms = config.get("rooms", {})
|
|
return rooms.get(room_id, {})
|
|
|
|
|
|
def get_room_users(room_id: str, config: dict[str, Any]) -> list[str]:
|
|
room_cfg = get_room_config(room_id, config)
|
|
return room_cfg.get("users", [])
|
|
|
|
|
|
def is_room_allowed(room_id: str, config: dict[str, Any]) -> bool:
|
|
room_cfg = get_room_config(room_id, config)
|
|
return room_cfg.get("allow", True)
|
|
|
|
|
|
def get_room_require_mention(room_id: str, config: dict[str, Any]) -> bool:
|
|
room_cfg = get_room_config(room_id, config)
|
|
return room_cfg.get("requireMention", config.get("requireMention", True))
|