Added Test Mode

This commit is contained in:
2026-01-31 14:42:08 -06:00
parent d0de47bdd7
commit c5e3fd33c4
4 changed files with 32 additions and 1 deletions

18
.env.testing Normal file
View File

@@ -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

1
.gitignore vendored
View File

@@ -117,6 +117,7 @@ dmypy.json
.venv .venv
env/ env/
venv/ venv/
linux_venv/
ENV/ ENV/
env.bak/ env.bak/
venv.bak/ venv.bak/

9
bot.py
View File

@@ -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 numba_config
import asyncio import asyncio
import io import io

View File

@@ -1,7 +1,10 @@
import os import os
from dotenv import load_dotenv 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: class Config: