There are lots of ways to keep track of close games, even other twitter bots, like WNYC's Nailbiter Bot. But this didn't exist for the most exciting moment in sports, the Major League Baseball walkoff. We wanted to make something that alerted fans when there was a potential walkoff and provide a way to get information on that game immediately. Enter Walkoff Bot.
What it does
https://twitter.com/walkoffbot monitors MLB games and tweets whenever a game has the possibility of a walkoff or after one happens, with a link to MLB.com's Gameday.
How we built it
The bot is built as a Ruby on Rails app. Scheduled jobs check for all active MLB games and analyze the game state to see if a walkoff is possible. Every time the game state changes to "POTENTIAL_WALKOFF" or from "POTENTIAL_WALKOFF" to "POSTGAME" (and the home team has won and there wasn't a tie), we tweet to @walkoffbot.
Challenges I ran into
Having to write actual logic to define what a walkoff is. We didn't have a real-world test case to determine if this will work on live data. Figuring out how to structure schedulers within Rails that work with Heroku.
Accomplishments that we're proud of
We got it to work (we think) with zero prep.
What we learned
Henry learned how to setup schedulers, and how awesome the mlb gameday api is. Teja learned about baseball. Chris learned about ruby. Dave learned about how simple the twitter api can be.
What's next for Walkoff Bot
Testing and debugging on more live games. Refactoring some not-so-great-but-functional decisions.