Add multi-channel support for stock updates

Bot now supports sending updates to multiple Discord channels simultaneously.

Changes:
- CHANNEL_ID accepts comma-separated list of channel IDs
- Config parses and validates multiple channel IDs
- Hourly and market close updates sent to all configured channels
- Update .env.example to show multi-channel format
- Document multi-channel configuration in README

Example: CHANNEL_ID=1442203998932304035,9876543210123456789

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Michael Simard
2025-12-03 19:01:01 -06:00
parent 584ad2a4f4
commit 327e7e0914
4 changed files with 28 additions and 14 deletions

View File

@@ -10,6 +10,7 @@ class Config:
# Discord configuration
DISCORD_TOKEN = os.getenv('DISCORD_TOKEN')
CHANNEL_ID = os.getenv('CHANNEL_ID')
CHANNEL_IDS = [id.strip() for id in os.getenv('CHANNEL_ID', '').split(',') if id.strip()]
COMMAND_PREFIX = os.getenv('COMMAND_PREFIX', '!')
# Stock configuration
@@ -36,10 +37,15 @@ class Config:
print("ERROR: CHANNEL_ID not set in environment")
return False
if not cls.CHANNEL_IDS:
print("ERROR: No valid channel IDs found in CHANNEL_ID")
return False
try:
int(cls.CHANNEL_ID)
for channel_id in cls.CHANNEL_IDS:
int(channel_id)
except ValueError:
print("ERROR: CHANNEL_ID must be a numeric Discord channel ID")
print("ERROR: CHANNEL_ID must contain numeric Discord channel IDs (comma-separated)")
return False
if cls.STOCK_API_PROVIDER == 'finnhub' and not cls.FINNHUB_API_KEY: