Slackelo is a Slack bot that tracks Elo ratings for competitive games played within your Slack channels. Whether you're tracking ping pong matches, chess games, Mario Kart races, or any other competitive activity with two or more players, Slackelo makes it easy to record results and maintain a leaderboard.
- 📊 Track Elo Ratings: Automatically calculate and update Elo ratings based on game results
- 🎮 Multi-Player Support: Works with any game format, from 1v1 duels to multi-player competitions like Mario Kart
- 🏆 Channel Leaderboards: View rankings for all players in a channel
- 🤝 Support for Ties: Record games where multiple players tie for a position
- 🔢 Customizable K-Factor: Adjust how quickly ratings change based on your preferences
- 📜 Game History: View past games and rating changes for any player
- 🧪 Simulation Mode: Preview rating changes without recording actual games
- ↩️ Undo Functionality: Easily revert the most recent game if needed
- 🎲 Gambling: Option to double the rating change of your next game (win big or lose big)
- 📊 Channel Statistics: View fun statistics like highest rating, biggest comebacks, win streaks, and more
- 📈 Rating Charts: Visualize rating history over time with interactive charts
- Visit https://andri.io/slackelo
- Click "Add to Slack"
- Authorize the app for your workspace
- Invite @Slackelo to any channels where you want to use it
Do note that the official Slackelo bot relies on my server, which might not be available someday. If you want to ensure that the bot is always available, consider self-hosting it.
- Python 3.8+
- SQLite 3
- A publicly accessible URL for OAuth redirects (can use ngrok for testing)
- Go to https://api.slack.com/apps
- Click "Create New App"
- Choose "From scratch"
- Name your app (e.g., "Slackelo") and select your workspace
- Click "Create App"
-
Under "Basic Information", note your Signing Secret
-
Under "OAuth & Permissions":
- Add the following Bot Token Scopes:
channels:historychat:writecommands
- Set your Redirect URL:
https://your-domain.com/oauth/redirect
- Add the following Bot Token Scopes:
-
Under "Slash Commands", create the following commands:
/game/simulate/leaderboard/rating/history/kfactor/gamble/gamblers/stats/chart/undo/help
For each command, use
https://your-domain.com/slack/commandsas the Request URL -
Under "Interactivity & Shortcuts":
- Set the Request URL to
https://your-domain.com/events
- Set the Request URL to
-
Install the app to your workspace from the "Install App" section
-
Clone the repository:
git clone https://github.com/ndri/slackelo.git cd slackelo -
Create a virtual environment and install dependencies:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate pip install -r requirements.txt
-
Create a
.envfile based on the provided example:cp .env.example .env
-
Edit the
.envfile with your Slack app credentials and configuration:# Database configuration DB_PATH=slackelo.db INIT_SQL_FILE=init.sql # Slack API credentials SLACK_SIGNING_SECRET=your_slack_signing_secret SLACK_CLIENT_ID=your_slack_client_id SLACK_CLIENT_SECRET=your_slack_client_secret # OAuth and installation settings OAUTH_REDIRECT_URI=https://your-domain.com/oauth/redirect INSTALL_PATH=/install REDIRECT_URI_PATH=/oauth/redirect SUCCESS_URL=/slackelo/success INSTALL_SUCCESS_URL= # Server settings HOST=0.0.0.0 PORT=8080 PUBLIC_URL=https://your-domain.com
-
Start the server:
python app.py
-
Your Slackelo bot should now be running and accessible at
https://your-domain.com
For production deployment, consider serving Slackelo using a WSGI server like Gunicorn and a reverse proxy like Nginx.
Here is the guide I followed to deploy it: https://www.digitalocean.com/community/tutorials/how-to-serve-flask-applications-with-uwsgi-and-nginx-on-ubuntu-20-04
Once installed, you can use the following commands in any channel where Slackelo is present:
/game @player1 @player2 @player3- Record a game with players in ranking order (winner first)/game @player1=@player2 @player3- Record a game with ties (player1 and player2 tied for first)/game @player1 @player2=@player3 @player4- Record complex rankings (player1 first, player2 and player3 tied for second, player4 fourth)/simulate @player1 @player2 @player3- Simulate a game without saving/leaderboard [limit]- Show channel leaderboard (optional limit parameter)/rating [@player]- Show your rating or another player's rating/history [@player]- View your game history or another player's history/kfactor [value]- View or set the k-factor for this channel/gamble- Double the rating change of your next game (win big or lose big)/gamblers- Show gambling leaderboard for the channel/stats- Show channel statistics/chart- Show a rating history chart for all players/undo- Undo the last game in the channel/help- Show a help message with available commands
The Elo rating system is a method for calculating the relative skill levels of players in zero-sum games. After every game, the winning player takes points from the losing player. The number of points exchanged depends on the rating difference between players:
- When a higher-rated player beats a lower-rated player, relatively few points are exchanged
- When a lower-rated player beats a higher-rated player, more points are exchanged
The K-factor determines how dramatically ratings change after each game:
- Higher K-factor (e.g., 64): Ratings change more quickly
- Lower K-factor (e.g., 16): Ratings change more slowly
- Default K-factor: 32
Read more about the Elo rating system on Wikipedia.
Contributions are welcome! Feel free to submit a pull request.
This project is licensed under the MIT License - see the LICENSE file for details.
