Watching a Game Feed
The core of the bot is watching game feeds. A feed can be started with the /startgame
command, or the Start button on the /plangame
command.
Every 10 seconds, the bot will query MLB to find new events. They will send after a configurable amount of time depending on the action.
Messages
There are 3 types of messages the bot will send during play.
Play Events
Play events are results of plate appearances. For example, a walk, a hit, etc. They only get sent after a plate appearance is over. However, messges may get re-sent whenever it changes, most commonly due to reviews.
If a ball goes more than 300 feet, the bot will check baseball savant to see how many ballparks the hit would have been a homer at. It will additionally show if it would have been one at the opponent's ballpark.
Speaking of, when a team scores, or when the 3rd out is reached, the score will be shown in the embed.
Play events are also color coded. In order of priority, blue means a player has scored, red means a player has gotten out, and green means the player has reached base via walk or hit by pitch.
Game Advisories
The bot will also post game advisories. These typically include pitching changes, mound visits, and batter timeouts, but also include game delays and state changes, such as to Warmup or In Progress. Additionally, inning state changes are also sent as well. Below are some examples.
Final Scorecard
At the end of the game, a final scorecard is sent to the channel, showing the inning breakdown, score/hits/errors/LOB, with a button to view the game on my MLB Stats website.