diff --git a/AUTHORS.md b/AUTHORS.md index 86fc4014..afaa6172 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -6,6 +6,7 @@ The following wonderful people contributed directly or indirectly to this project: +- [divadsn](https://github.com/divadsn) - [imlonghao](https://github.com/imlonghao) - [Iuri Guilherme](https://github.com/iuriguilherme) - [JuniorJPDJ](https://github.com/JuniorJPDJ) diff --git a/config.py b/config.py index c58c663e..80ec0732 100644 --- a/config.py +++ b/config.py @@ -23,15 +23,26 @@ try: with open("config.json", "r") as f: - config = json.loads(f.read()) + config = json.load(f) except FileNotFoundError: config = {} TOKEN = os.getenv("TOKEN", config.get("token")) WORKERS = int(os.getenv("WORKERS", config.get("workers", 32))) ADMIN_LIST = os.getenv("ADMIN_LIST", config.get("admin_list", None)) -OPEN_LOBBY = os.getenv("OPEN_LOBBY", config.get("open_lobby", True)) == "True" -ENABLE_TRANSLATIONS = os.getenv("ENABLE_TRANSLATIONS", config.get("enable_translations", False)) == "True" + +if isinstance(ADMIN_LIST, str): + ADMIN_LIST = set(int(x) for x in ADMIN_LIST.split()) + +OPEN_LOBBY = os.getenv("OPEN_LOBBY", config.get("open_lobby", True)) +ENABLE_TRANSLATIONS = os.getenv("ENABLE_TRANSLATIONS", config.get("enable_translations", False)) + +if isinstance(OPEN_LOBBY, str): + OPEN_LOBBY = OPEN_LOBBY.lower() in ("yes", "true", "t", "1") + +if isinstance(ENABLE_TRANSLATIONS, str): + ENABLE_TRANSLATIONS = ENABLE_TRANSLATIONS.lower() in ("yes", "true", "t", "1") + DEFAULT_GAMEMODE = os.getenv("DEFAULT_GAMEMODE", config.get("default_gamemode", "fast")) WAITING_TIME = int(os.getenv("WAITING_TIME", config.get("waiting_time", 120))) TIME_REMOVAL_AFTER_SKIP = int(os.getenv("TIME_REMOVAL_AFTER_SKIP", config.get("time_removal_after_skip", 20)))