its-matrix-bot/its_matrix_bot/config.py

26 lines
622 B
Python

import toml
class Config:
command_prefix: str
matrix_homeserver: str
matrix_user: str
matrix_access_token: str
spaceping_token: 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']