Skip to content

Latest commit

 

History

9 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pivot - TFT Discord Bot

A modular Discord bot for Team Fight Tactics (TFT) rank tracking built with Python 3.11, discord.py v2, and riotwatcher.

Features

  • /rank command to check TFT rankings by Riot ID (Name#Tag)
  • Real-time rank data including Tier, LP, and W/L records
  • Proper error handling for "Not Found" and "Expired Key" scenarios
  • Modular architecture with separated concerns (Discord logic, API service)

Project Structure

Pivot/
├── main.py                    # Bot entry point with async setup_hook
├── cogs/
│   └── tft.py                # TFT commands cog
├── services/
│   └── riot_service.py       # Riot API service layer
├── requirements.txt          # Python dependencies
├── .env.example             # Example environment configuration
└── README.md                # This file

Setup

Prerequisites

  • Python 3.11+
  • Discord Bot Token
  • Riot Games API Key

Installation

  1. Clone the repository:
git clone https://github.com/marcoames/Pivot.git
cd Pivot
  1. Install dependencies:
pip install -r requirements.txt
  1. Create a .env file from the example:
cp .env.example .env
  1. Edit .env and add your tokens:
DISCORD_TOKEN=your_discord_bot_token_here
RIOT_API_KEY=your_riot_api_key_here
RIOT_REGION=na1  # Optional, defaults to na1

Running the Bot

python main.py

Usage

Once the bot is running and invited to your Discord server:

Commands

  • /rank <Name#Tag> - Get TFT rank information for a player
    • Example: /rank Faker#KR1
    • Returns: Tier, Rank, LP, Win Rate, and W/L record

API Flow

The bot follows this flow to retrieve player data:

  1. Account-V1 API: Get PUUID from Riot ID (Name#Tag)
  2. Summoner-V1 API: Get Summoner ID from PUUID
  3. League-V1 API: Get TFT ranked data (RANKED_TFT queue)

Error Handling

The bot handles various error scenarios:

  • Player Not Found: Returns a friendly message if the player doesn't exist
  • Unranked Players: Indicates when a player hasn't played ranked TFT
  • Expired API Key: Alerts when the Riot API key is invalid or expired
  • Invalid Format: Guides users to use the correct Name#Tag format

Development

Code Standards

  • Async/await throughout for optimal performance
  • Type hints for better code quality
  • Modular architecture for easy maintenance
  • Separation of concerns (Discord logic vs. API logic)

Dependencies

  • discord.py>=2.0.0,<3.0.0 - Discord bot framework
  • riotwatcher>=3.3.0 - Riot Games API wrapper
  • python-dotenv>=1.0.0 - Environment variable management

License

This project is open source and available under the MIT License.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages