The shit I do for w00t4me

This commit is contained in:
2024-11-11 13:04:55 -05:00
parent 551f077158
commit c1a20533da
2 changed files with 33 additions and 21 deletions

View File

@ -40,7 +40,7 @@ func GetGameInfo(teamName, date string) string {
// Check if the last 5 characters are in MM/DD format for date input
if len(date) == 5 && unicode.IsDigit(rune(date[0])) && unicode.IsDigit(rune(date[1])) && date[2] == '/' &&
unicode.IsDigit(rune(date[3])) && unicode.IsDigit(rune(date[4])) {
date = fmt.Sprintf("2024/%s", strings.ReplaceAll(date, "/", "/")) // Add the year and reformat
date = fmt.Sprintf("2024/%s", date) // Add the year and format
} else {
return "Invalid date format. Please use MM/DD."
}
@ -89,8 +89,16 @@ func fetchAndParseGames(apiURL, teamName string) string {
game.Game.Home.Names.Short, game.Game.Home.Score,
currentPeriod, game.Game.ContestClock)
} else if game.Game.GameState == "pre" {
gameInfo = fmt.Sprintf("Upcoming: %s @ %s on %s at %s ET",
game.Game.Away.Names.Short, game.Game.Home.Names.Short, game.Game.StartDate, game.Game.StartTime)
startTime, err := time.Parse("03:04PM ET", game.Game.StartTime)
if err == nil {
startTime = startTime.Add(-1 * time.Hour) // Subtract 1 hour for Central Time
formattedTime := startTime.Format("03:04 PM CT")
gameInfo = fmt.Sprintf("Upcoming: %s @ %s on %s at %s",
game.Game.Away.Names.Short, game.Game.Home.Names.Short, game.Game.StartDate, formattedTime)
} else {
gameInfo = fmt.Sprintf("Upcoming: %s @ %s on %s at %s",
game.Game.Away.Names.Short, game.Game.Home.Names.Short, game.Game.StartDate, game.Game.StartTime)
}
} else if game.Game.GameState == "final" {
gameInfo = fmt.Sprintf("Final: %s: **%s** %s: **%s**",
game.Game.Away.Names.Short, game.Game.Away.Score,