A simple Discord bot written with discord.py
for forming teams for pickup games.
It's tailored towards Heroes of the Storm.
- Python 3.5
- A Discord bot user and client ID
- Somewhere to run it (VPS, Heroku, BlueMix, etc)
- MongoDB for persisted information
First, clone the repo:
$ git clone https://github.com/mattgreen/fogeybot.git
$ cd fogeybot
Next, install dependencies:
$ pip install -r requirements.txt
Finally, start FogeyBot, specifying login information in environment variables:
$ DISCORD_TOKEN="bot_token" MONGO_URI="uri" python -m fogeybot
You can configure the bot to only listen for commands on a certain channel by setting the DISCORD_CHANNEL
env var, as well.
Someone starts a pickup game via the !startpickup
command, players can join the pickup in progress using the !joinpickup 1700
command, where 1700
is their MMR. After ten players have joined, the MMRs specified are used to produce two teams of approximately equal skill.
You can abort the game early using the !stoppickup
command.
The balancing algorithm works by sorting players by their skill, pairing players with the closest player of approximate skill, and splitting the pair between teams. To prevent team 1 from being weighted too heavily towards better players, we alternate which team the first player of a pair is assigned to.
This is used regularly to host pickup games for Fogey League.
Prints help information
Prints uptime information. Useful for monitoring how good your hosting is.
Flips a coin
Starts a new pickup game
Adds the specified player to the current pickup game with the given MMR. If it is not specified, use a default MMR of 1500. This command is useful for quickly on-boarding new users.
If the MMR is not parsable, it is ignored. If it is outside a reasonable range, it defaults to 1500.
Adds the player to the current pickup game with the given MMR.
If the user has registered their battle tag (via !register
), and no MMR is specified, it will be retrieved from HotsLogs.
If the user has not registered their battle tag, or their HL profile is private, then use a default MMR of 1500.
If the MMR is not parsable, it is ignored. If it is outside a reasonable range, it defaults to 1500.
Prints out information about the current pickup, including who has joined and their MMR
Removes your pickup slot, freeing it up for someone else.
Stops the pickup game.
Games expire after 30 minutes of the first !startpickup
command.
Prints a random map, excluding Haunted Mines and Lost Cavern.
Associates the user's battle.net ID with the Discord account
Returns the user's battle.net ID, if any
Removes the user's battle.net ID information, if any
Files for running on BlueMix are included.