diff options
author | Parker <contact@pkrm.dev> | 2024-04-02 16:20:54 -0500 |
---|---|---|
committer | Parker <contact@pkrm.dev> | 2024-04-02 16:20:54 -0500 |
commit | f73413dee8b76da6a010b953e3699b3a51c6cc00 (patch) | |
tree | b7a9775f65ea955b1c835b0994d5ce160619004a | |
parent | ab0063f00e460b6266a576960e7165c9b5018423 (diff) |
Exit when config.ini errors are found
-rw-r--r-- | code/validate_config.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/code/validate_config.py b/code/validate_config.py index b6e5484..d4d9786 100644 --- a/code/validate_config.py +++ b/code/validate_config.py @@ -32,15 +32,19 @@ def validate_config(file_contents): # Validate FEEDBACK_CHANNEL_ID if not config["BOT_INFO"]["FEEDBACK_CHANNEL_ID"]: LOG.critical("FEEDBACK_CHANNEL_ID has not been set.") + errors += 1 elif len(config["BOT_INFO"]["FEEDBACK_CHANNEL_ID"]) != 19: LOG.critical("FEEDBACK_CHANNEL_ID is not a valid Discord channel ID.") + errors += 1 # Validate BUG_CHANNEL_ID if not config["BOT_INFO"]["BUG_CHANNEL_ID"]: LOG.critical("BUG_CHANNEL_ID has not been set.") + errors += 1 elif len(config["BOT_INFO"]["BUG_CHANNEL_ID"]) != 19: LOG.critical("BUG_CHANNEL_ID is not a valid Discord channel ID.") + errors += 1 # Validate LAVALINK # Validate HOST @@ -56,6 +60,10 @@ def validate_config(file_contents): LOG.critical("HOST has not been set.") errors += 1 + if errors > 0: + LOG.critical("Configuration checks failed. Correct your config.ini file and run again.") + exit() + else: LOG.info("Configuration checks passed. Starting bot.") |