major-domo-v2/models/current.py
Cal Corum 7b41520054 CLAUDE: Major bot enhancements - Admin commands, player stats, standings, schedules
Major Features Added:
• Admin Management System: Complete admin command suite with user moderation, system control, and bot maintenance tools
• Enhanced Player Commands: Added batting/pitching statistics with concurrent API calls and improved embed design
• League Standings: Full standings system with division grouping, playoff picture, and wild card visualization
• Game Schedules: Comprehensive schedule system with team filtering, series organization, and proper home/away indicators

New Admin Commands (12 total):
• /admin-status, /admin-help, /admin-reload, /admin-sync, /admin-clear
• /admin-announce, /admin-maintenance
• /admin-timeout, /admin-untimeout, /admin-kick, /admin-ban, /admin-unban, /admin-userinfo

Enhanced Player Display:
• Team logo positioned beside player name using embed author
• Smart thumbnail priority: fancycard → headshot → team logo fallback
• Concurrent batting/pitching stats fetching for performance
• Rich statistics display with team colors and comprehensive metrics

New Models & Services:
• BattingStats, PitchingStats, TeamStandings, Division, Game models
• StatsService, StandingsService, ScheduleService for data management
• CustomCommand system with CRUD operations and cleanup tasks

Bot Architecture Improvements:
• Admin commands integrated into bot.py with proper loading
• Permission checks and safety guards for moderation commands
• Enhanced error handling and comprehensive audit logging
• All 227 tests passing with new functionality

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-28 15:32:38 -05:00

47 lines
1.7 KiB
Python

"""
Current league state model
Represents the current state of the league including week, season, and settings.
"""
from pydantic import Field, field_validator
from models.base import SBABaseModel
class Current(SBABaseModel):
"""Model representing current league state and settings."""
week: int = Field(69, description="Current week number")
season: int = Field(69, description="Current season number")
freeze: bool = Field(True, description="Whether league is frozen")
bet_week: str = Field('sheets', description="Betting week identifier")
trade_deadline: int = Field(1, description="Trade deadline week")
pick_trade_start: int = Field(69, description="Draft pick trading start week")
pick_trade_end: int = Field(420, description="Draft pick trading end week")
playoffs_begin: int = Field(420, description="Week when playoffs begin")
@field_validator("bet_week", mode="before")
@classmethod
def cast_bet_week_to_string(cls, v):
"""Ensure bet_week is always a string."""
return str(v) if v is not None else 'sheets'
@property
def is_offseason(self) -> bool:
"""Check if league is currently in offseason."""
return self.week > 18
@property
def is_playoffs(self) -> bool:
"""Check if league is currently in playoffs."""
return self.week >= self.playoffs_begin
@property
def can_trade_picks(self) -> bool:
"""Check if draft pick trading is currently allowed."""
return self.pick_trade_start <= self.week <= self.pick_trade_end
@property
def ever_trade_picks(self) -> bool:
"""Check if draft pick trading is allowed this season at all"""
return self.pick_trade_start <= self.playoffs_begin + 4