From c5e3fd33c4d16e4625df707efa1c829b6fbc10d2 Mon Sep 17 00:00:00 2001 From: Spencer Grimes Date: Sat, 31 Jan 2026 14:42:08 -0600 Subject: [PATCH] Added Test Mode --- .env.testing | 18 ++++++++++++++++++ .gitignore | 1 + bot.py | 9 +++++++++ config.py | 5 ++++- 4 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 .env.testing diff --git a/.env.testing b/.env.testing new file mode 100644 index 0000000..668b268 --- /dev/null +++ b/.env.testing @@ -0,0 +1,18 @@ +# Discord Bot Configuration +# Testing environment configuration +# This file is used when running: python bot.py testing + +# Your Discord bot token (from Discord Developer Portal) - use a DIFFERENT bot for testing! +DISCORD_TOKEN=MTQyNDU3MjA4MjI1MTEwODQyNQ.GJ8iyw.B2O1nlAsw6AlRz3YR5eSN-OcHm4j1l7lEHzxY0 + +# The text channel ID to monitor for messages +# (Right-click channel with Developer Mode enabled -> Copy ID) +# Use a DIFFERENT channel for testing! +TEXT_CHANNEL_ID=1424585470616146061 + +# Directory containing voice .wav files +VOICES_DIR=./voices + +# Default voice name (optional - uses first found voice if not set) +# This should match the filename without .wav extension (case-insensitive) +# DEFAULT_VOICE=masterchief diff --git a/.gitignore b/.gitignore index 598432b..11263b6 100644 --- a/.gitignore +++ b/.gitignore @@ -117,6 +117,7 @@ dmypy.json .venv env/ venv/ +linux_venv/ ENV/ env.bak/ venv.bak/ diff --git a/bot.py b/bot.py index dc3c10d..e1df671 100644 --- a/bot.py +++ b/bot.py @@ -1,3 +1,12 @@ +import sys +import os + +# Parse command line arguments before loading any config +if len(sys.argv) > 1 and sys.argv[1] == "testing": + os.environ["ENV_MODE"] = "testing" + # Remove the argument so it doesn't interfere with other parsing + sys.argv.pop(1) + import numba_config import asyncio import io diff --git a/config.py b/config.py index 92175e4..49250f2 100644 --- a/config.py +++ b/config.py @@ -1,7 +1,10 @@ import os from dotenv import load_dotenv -load_dotenv() +# Load appropriate .env file based on ENV_MODE +env_mode = os.getenv("ENV_MODE", "production") +env_file = ".env.testing" if env_mode == "testing" else ".env" +load_dotenv(env_file) class Config: