A Discord slash command bot that looks up live League of Legends ranked stats for any player using the Riot Games API. Supports all major servers and both Solo/Duo and Flex queue types.
/rank id:Faker tag:T1 queue_type:Solo server:Korea
@Dan Faker#T1: Ranked Solo/Duo : CHALLENGER I 1547 LP
Wins: 312, Losses: 198 W/L: 61%
- /rank slash command — looks up any player by Riot ID (
name#tag) with full autocomplete dropdowns for server and queue type - Multi-region support — 16 servers including NA, EUW, EUNE, KR, JP, OCE, BR, and more
- Queue type selection — Solo/Duo or Flex
- Full rank display — tier, division, LP, wins, losses, and win rate percentage
- Graceful error handling — clear messages for invalid Riot IDs, unranked players, and failed API calls
- Structured logging — all API requests and errors logged via Python's logging module
The bot chains three Riot API calls per lookup:
- Account API — resolves
name#tag→ PUUID via the Riot Account endpoint - Summoner API — resolves PUUID → Summoner ID via the LoL Summoner endpoint
- League Entries API — fetches ranked data by Summoner ID, filtered by queue type
This three-step chain reflects how Riot's modern API is structured — Riot IDs are account-level identifiers that must be resolved before accessing game-specific data.
| Layer | Technology |
|---|---|
| Language | Python |
| Discord Integration | discord.py (discord.ext.commands, app_commands) |
| API | Riot Games API (Account, Summoner, League Entries) |
| HTTP | requests |
| Config | python-dotenv |
| Logging | Python logging module |
- Python 3.10+
- A Discord bot token
- A Riot Games API key (Get one here)
git clone https://github.com/danhuynh1/DiscordLoLRankBot.git
cd DiscordLoLRankBot
pip install -r requirements.txtCreate a .env file:
DISCORD_API_SECRET=your_discord_bot_token
riot-key=your_riot_api_key
python bot.pyThe bot will sync slash commands on startup and log its guild and user ID.
| Parameter | Description |
|---|---|
id |
Riot ID (summoner name portion) |
tag |
Tagline (e.g. NA1, EUW, custom tag) |
queue_type |
Solo (Ranked Solo/Duo) or Flex (Ranked Flex) |
server |
Any of 16 supported regions |
Output:
@User GameName#TAG: Ranked Solo/Duo : GOLD II 45 LP
Wins: 87, Losses 73 W/L: 54%
NA, EUW, EUNE, BR, LA1, LA2, OCE, RU, TR, JP, KR, PH, SG, TW, TH, VN
