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 requestsBefore 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. Either this or PUUID must be provided.PUUID: The PUUID of the player you want to track. Either this or RIOT_ID must be provided.USER_REGION: The specific region the player plays in, e.g.,na1for North America.WIDE_REGION: The broad region the player is in, e.g.,americasfor 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.
Note about RIOT_ID vs PUUID: You can use either the player's Riot ID (e.g., USERNAME#TAG) or their PUUID to identify the account. PUUID is a unique identifier that is tied to your specific API token and remains constant even if the player changes their Riot ID. If you have the PUUID, it can be more reliable for tracking since it won't change when players update their username. You can obtain a player's PUUID by first looking them up with their Riot ID using the Riot API.
This script can be run with the following command:
python3 soloq.pyA path to a configuration file can optionally be passed as a command line argument:
python3 soloq.py other_config.iniYou 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.logThis 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.



