MLB Game Feed Bot

From ChewWiki
Jump to navigation Jump to search

MLB Game Feed Bot is a Discord bot developed by Chew and is used to hook into the MLB (Major League Baseball) API and track live game data, much like the MLB's Gameday. It is written in JDA (Java).

Features

The bot allows you to start a live game and have the plays come in when they're posted to the endpoint. By default, in-play events have a 13 second delay, and plays that don't (strikeouts, walks, etc) have a 18 second delay. This can be configured per channel, as desired. These times were chosen as they closely line up with the play happening live on TV, to prevent spoilers. Watching a game in-person, there is a few second delay before the result is posted to the API.

Commands

The bot communicates solely though slash commands. There are currently 5 commands. None of the commands have permissions by default. This can be configured in server settings under integrations.

/startgame

Starts a game. When you run the command, auto-complete will show currently live Major League games. If a game is final, or currently experiencing a delay, it will not show up. Games appear here usually once a notification goes out (when the game goes into "warm up"). However, if you have a gamePk, you can paste that in and listen to any game. To find a gamePk, you can find a game on mlb.chew.pw, and grab the 6 digit number at the end of the URL.

/stopgame

Use this command to forcibly stop an active game. Games will stop on their own once they reach "Final."

/score

This command shows the score of the active game. It shows the current amount of outs and the inning, as well.

/setinfo

Sets info for a voice channel name. Teams will be autofilled, and, if you search, it will narrow down results. Currently, these are supported:

  • Next game, formatted as (Date: versus/at opponent, @ team's local time). Example: 10/5: vs NYY, 3:05 PM.
  • Standings, formatted as (Team abbreviation: record - rank in division abbreviation). Example: TEX: 68-94, 4th in ALW.

/config

Use these commands to get or set the channel's game config. Currently, there are 4 options:

  • In-Play Delay - Set the delay (in seconds) before a ball in-play is shown to the channel. Default: 13 seconds.
  • Out-of-play Delay - Set the delay (in seconds) before a ball not in-play is shown to the channel. Default: 18 seconds.
  • Only Scoring Plays - Only show scoring plays.
  • Game Advisories - Whether to show game advisories, such as pitching changes or substitutions.

/plangame

This command "plans" a game. Using the arguments, you can select a game to pick and it will show an embed with the game time, the teams' records, probable pitchers, and where to watch it. There are buttons below the embed to start the game, but only within 30 minutes of the start time, a refresh button to update, and buttons to view the lineup.

History

The bot started off inspired by the MLB Chat Discord server's own bot. Chew began development on June 16th, 2022[1], but the first code was committed the following day on June 17th, 2022[2]. Throughout the rest of the month, fixes and improvements were slowly made. The bot was added to a Texas Rangers fan Discord server.

At the start of the 2023 season, the bot was in 79 servers; at the end of the season, it was in nearly 600 servers.

References