its-matrix-bot/its_matrix_bot/config.py

27 lines
622 B
Python
Raw Normal View History

2022-03-27 19:17:21 +02:00
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']