update sports command for baseball to show top/bottom of inning

This commit is contained in:
agessaman
2025-10-10 22:29:19 -07:00
parent 93180dc7ac
commit d2152fac41
2 changed files with 13 additions and 2 deletions

1
.gitignore vendored
View File

@@ -2,6 +2,7 @@
__pycache__/
*.py[cod]
*$py.class
.cache.sqlite
# C extensions
*.so

View File

@@ -903,7 +903,12 @@ class SportsCommand(BaseCommand):
period_str = f"{period}H" # Fallback to half
formatted = f"@{home_name} {home_score}-{away_score} {away_name} ({clock} {period_str})"
elif sport == 'baseball':
period_str = f"{period}I" # Innings - no clock needed
# Use shortDetail for ongoing baseball games to show top/bottom of inning
short_detail = status.get('type', {}).get('shortDetail', '')
if short_detail and ('Top' in short_detail or 'Bottom' in short_detail):
period_str = short_detail # e.g., "Top 14th", "Bottom 9th"
else:
period_str = f"{period}I" # Fallback to inning number only
formatted = f"{away_name} {away_score}-{home_score} @{home_name} ({period_str})"
elif sport == 'football':
period_str = f"Q{period}" # Quarters
@@ -1142,7 +1147,12 @@ class SportsCommand(BaseCommand):
period_str = f"{period}H" # Fallback to half
formatted = f"@{home_name} {home_score}-{away_score} {away_name} ({clock} {period_str})"
elif sport == 'baseball':
period_str = f"{period}I" # Innings - no clock needed
# Use shortDetail for ongoing baseball games to show top/bottom of inning
short_detail = status.get('type', {}).get('shortDetail', '')
if short_detail and ('Top' in short_detail or 'Bottom' in short_detail):
period_str = short_detail # e.g., "Top 14th", "Bottom 9th"
else:
period_str = f"{period}I" # Fallback to inning number only
formatted = f"{away_name} {away_score}-{home_score} @{home_name} ({period_str})"
elif sport == 'football':
period_str = f"Q{period}" # Quarters