thread-bot/config.py
2025-01-10 20:20:31 +05:00

16 lines
345 B
Python

import tomllib
from dataclasses import dataclass
@dataclass
class Config:
homeserver: str
user_id: str
password: str
help_message: str
required_power_level: int
log_level: str
def load_config(path: str = "config.toml") -> Config:
with open(path, "rb") as f:
data = tomllib.load(f)
return Config(**data)