Makes all application constants (except baseball positions) configurable via environment variables for greater deployment flexibility. Changes: - config.py: Added 18 new configurable fields to BotConfig * Discord limits (embed/field/description limits) * League settings (weeks, games, modern stats era) * Current season constants (SBA/PD) * API configuration (version, timeout, retries) * Draft settings (pick minutes, rounds) * Special team IDs (free agent team) * Role/channel names (help editor, players, news channel) * Base URLs (SBA website) - constants.py: Refactored to load from config * All constants now read from get_config() * Position sets remain static (PITCHER_POSITIONS, etc.) * Added documentation about configurability - .env.example: Added all new environment variables * Organized into logical sections with headers * Includes default values from config.py * Clear documentation for each setting Benefits: - Environment-specific configuration without code changes - Easy deployment across dev/staging/production - Season rollover requires only env variable updates - Team-specific customization (channels, roles, URLs) - Docker-friendly configuration management Backward Compatible: All defaults match previous hardcoded values 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
54 lines
1.7 KiB
Python
54 lines
1.7 KiB
Python
"""
|
|
Application constants for Discord Bot v2.0
|
|
|
|
Most constants are now configurable via environment variables.
|
|
See config.py for default values and .env.example for configuration options.
|
|
"""
|
|
from config import get_config
|
|
|
|
# Load configuration
|
|
_config = get_config()
|
|
|
|
# Discord Limits (configurable)
|
|
DISCORD_EMBED_LIMIT = _config.discord_embed_limit
|
|
DISCORD_FIELD_VALUE_LIMIT = _config.discord_field_value_limit
|
|
DISCORD_EMBED_DESCRIPTION_LIMIT = _config.discord_embed_description_limit
|
|
|
|
# League Constants (configurable)
|
|
WEEKS_PER_SEASON = _config.weeks_per_season
|
|
GAMES_PER_WEEK = _config.games_per_week
|
|
MODERN_STATS_START_SEASON = _config.modern_stats_start_season
|
|
|
|
# Current Season Constants (configurable)
|
|
SBA_CURRENT_SEASON = _config.sba_current_season
|
|
PD_CURRENT_SEASON = _config.pd_current_season
|
|
|
|
# API Constants (configurable)
|
|
API_VERSION = _config.api_version
|
|
DEFAULT_TIMEOUT = _config.default_timeout
|
|
MAX_RETRIES = _config.max_retries
|
|
|
|
# Baseball Positions (static)
|
|
PITCHER_POSITIONS = {"SP", "RP", "P"}
|
|
POSITION_FIELDERS = {"C", "1B", "2B", "3B", "SS", "LF", "CF", "RF", "OF", "DH"}
|
|
ALL_POSITIONS = PITCHER_POSITIONS | POSITION_FIELDERS
|
|
|
|
# Draft Constants (configurable)
|
|
DEFAULT_PICK_MINUTES = _config.default_pick_minutes
|
|
DRAFT_ROUNDS = _config.draft_rounds
|
|
|
|
# Special Team IDs (configurable)
|
|
FREE_AGENT_TEAM_ID = _config.free_agent_team_id
|
|
|
|
# Role Names (configurable)
|
|
HELP_EDITOR_ROLE_NAME = _config.help_editor_role_name
|
|
SBA_PLAYERS_ROLE_NAME = _config.sba_players_role_name
|
|
|
|
# Channel Names (configurable)
|
|
SBA_NETWORK_NEWS_CHANNEL = _config.sba_network_news_channel
|
|
|
|
# Base URLs (configurable)
|
|
SBA_BASE_URL = _config.sba_base_url
|
|
|
|
# Note: Google Sheets credentials path is managed via config.py
|
|
# Access it with: get_config().sheets_credentials_path |