Skip to content

About

A Python bot using discord2.py library to search and display Riot League of Legends Ranked API

Resources

Stars

1 star

Watchers

1 watching

Forks

Latest commit

 

History

4 Commits

Folders and files

Repository files navigation

DiscordLoLRankBot

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.

image

Demo

/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%

Features

  • /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

How It Works

The bot chains three Riot API calls per lookup:

  1. Account API — resolves name#tag → PUUID via the Riot Account endpoint
  2. Summoner API — resolves PUUID → Summoner ID via the LoL Summoner endpoint
  3. 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.


Tech Stack

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

Setup

Prerequisites

  • Python 3.10+
  • A Discord bot token
  • A Riot Games API key (Get one here)

Install

git clone https://github.com/danhuynh1/DiscordLoLRankBot.git
cd DiscordLoLRankBot
pip install -r requirements.txt

Environment

Create a .env file:

DISCORD_API_SECRET=your_discord_bot_token
riot-key=your_riot_api_key

Run

python bot.py

The bot will sync slash commands on startup and log its guild and user ID.


Command Reference

/rank

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%

Supported Servers

NA, EUW, EUNE, BR, LA1, LA2, OCE, RU, TR, JP, KR, PH, SG, TW, TH, VN


About

A Python bot using discord2.py library to search and display Riot League of Legends Ranked API

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages