its-matrix-bot/its_matrix_bot/config.py
Xiretza b4e76b75e4 Add open/close notifications
Uses only polling for now, websocket support to be added later.
2022-03-29 19:27:45 +02:00

31 lines
763 B
Python

import toml
from typing import List
class Config:
command_prefix: str
matrix_homeserver: str
matrix_user: str
matrix_access_token: str
spaceping_token: str
isitopen_announce_rooms: List[str]
def __init__(self, path=None):
if path is None:
path = "/etc/itsyndikat-bot.toml"
config = toml.load(path)
self.command_prefix = config["app"]["command_prefix"]
matrix = config["matrix"]
self.matrix_homeserver = matrix["homeserver"]
self.matrix_username = matrix["username"]
self.matrix_access_token = matrix["access_token"]
self.spaceping_token = config["spaceping"]["api_token"]
self.isitopen_announce_rooms = config["isitopen"]["announce_rooms"]