20 lines
		
	
	
		
			762 B
		
	
	
	
		
			Go
		
	
	
	
		
		
			
		
	
	
			20 lines
		
	
	
		
			762 B
		
	
	
	
		
			Go
		
	
	
	
| 
								 | 
							
								package main
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								import "scm.dairydemon.net/filifa/mlblive/internal/statsapi"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								type Game struct {
							 | 
						||
| 
								 | 
							
									CurrPlayDesc string
							 | 
						||
| 
								 | 
							
									HomeScore    uint
							 | 
						||
| 
								 | 
							
									AwayScore    uint
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								func (g *Game) Update(feed *statsapi.FeedResponse) {
							 | 
						||
| 
								 | 
							
									homeScore, _ := (*feed)["liveData"].(map[string]any)["linescore"].(map[string]any)["teams"].(map[string]any)["home"].(map[string]any)["runs"].(float64)
							 | 
						||
| 
								 | 
							
									awayScore, _ := (*feed)["liveData"].(map[string]any)["linescore"].(map[string]any)["teams"].(map[string]any)["away"].(map[string]any)["runs"].(float64)
							 | 
						||
| 
								 | 
							
									desc, _ := (*feed)["liveData"].(map[string]any)["plays"].(map[string]any)["currentPlay"].(map[string]any)["result"].(map[string]any)["description"].(string)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
									g.HomeScore = uint(homeScore)
							 | 
						||
| 
								 | 
							
									g.AwayScore = uint(awayScore)
							 | 
						||
| 
								 | 
							
									g.CurrPlayDesc = desc
							 | 
						||
| 
								 | 
							
								}
							 |