This script is a simple tool to track League of Legends games of a specific player and send notifications about their games to a Discord channel. It utilizes Riot Games API to fetch game data and uses webhooks to send messages to Discord.
- Sends a Discord message whenever the player starts a new game
- Sends a Discord message whenever the player finishes a game
Below are a few examples of messages sent using this script:
Lost unranked game |
Lost ranked game |
Won ranked game |
New game message |
This script was tested on Python 3.10 and requires the requests
library. You can install it with pip:
pip3 install requests
Before running the script, a config.ini
file needs to be created in the same directory as the script. The file should
contain a section SOLOQ
with the following keys:
RIOT_API_KEY
: Your Riot Games API Key.WEBHOOK_URL
: The Discord webhook URL you want to use to send notifications.RIOT_ID
: The Riot ID of the player you want to track, e.g.,USER#TAG
.USER_REGION
: The specific region the player plays in, e.g.,na1
for North America.WIDE_REGION
: The broad region the player is in, e.g.,americas
for North America.DATA_FILE
: The name of the data file to store game and error information. This file should be unique for each username (when using multiple config files).ERROR_URL
: (OPTIONAL) The Discord webhook URL where errors will be posted. Errors won't be posted if this is not specified. Errors may contain sensitive data.
You can get your Riot Games API key here. User and wide regions should match Riot Games API routing values. Information on how to generate a Discord channel webhook is provided in this article.
This script can be run with the following command:
python3 soloq.py
A path to a configuration file can optionally be passed as a command line argument:
python3 soloq.py other_config.ini
You can setup a cron job to run the script automatically every few minutes. To do
that run crontab -e
to open the cron
table editor and add a new line at the bottom:
*/1 * * * * cd /path-to-your-script && python3 soloq.py 2>> soloq.log
This will run the script once every minute. Errors will be saved in soloq.log
file.
This script makes between 4 and 8 requests to different Riot APIs each time it's run. Riot Games API has strict rate limits. If your application exceeds those limits, your IP may be temporarily blacklisted. Always ensure you are within the API usage limits to prevent this from happening.
This script is not endorsed by Riot Games and does not reflect the views or opinions of Riot Games or anyone officially involved in producing or managing Riot Games properties. Riot Games, and all associated properties, are trademarks or registered trademarks of Riot Games, Inc.
This script uses the Discord API but is not endorsed or certified by Discord. Discord, the Discord logo, and any associated marks and logos are trademarks or registered trademarks of Discord, Inc., in the U.S. and other countries.