aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorParker <contact@pkrm.dev>2024-04-02 16:20:54 -0500
committerParker <contact@pkrm.dev>2024-04-02 16:20:54 -0500
commitf73413dee8b76da6a010b953e3699b3a51c6cc00 (patch)
treeb7a9775f65ea955b1c835b0994d5ce160619004a
parentab0063f00e460b6266a576960e7165c9b5018423 (diff)
Exit when config.ini errors are found
-rw-r--r--code/validate_config.py8
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.")