Some refactoring of the new external files

This commit is contained in:
Marc Di Luzio 2024-08-10 10:55:09 +01:00
parent c44f16dd8f
commit 96fb77f71f
3 changed files with 35 additions and 25 deletions

View file

@ -2,7 +2,7 @@
from schema import Schema, And, Use
import matching
CONFIG = "config.json"
FILE = "config.json"
class Config():
@ -16,11 +16,15 @@ class Config():
@property
def owners(self) -> list[int]:
return self.__dict__["owners"]
def reload(self) -> None:
"""Reload the config back into the dict"""
self.__dict__ = load().__dict__
def load() -> Config:
"""Load the config and validate it"""
config = matching.load(CONFIG)
config = matching.load(FILE)
Schema(
{
# Discord bot token