mirror of
https://codeberg.org/D3M0N/thread-bot.git
synced 2025-04-11 20:58:47 +02:00
16 lines
345 B
Python
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)
|