An open API service indexing awesome lists of open source software.

https://github.com/suvodeep12/rift-herald

A Discord bot built with Node.js and the Riot Games API to track and announce daily League of Legends ranked LP changes with interactive slash commands.
https://github.com/suvodeep12/rift-herald

cron discord-bot discordjs javascript league-of-legends lol-stats nodejs riot-api sqlite

Last synced: about 2 months ago
JSON representation

A Discord bot built with Node.js and the Riot Games API to track and announce daily League of Legends ranked LP changes with interactive slash commands.

Awesome Lists containing this project

README

          

# ๐Ÿ‘พ Rift Herald

![License](https://img.shields.io/badge/license-MIT-blue.svg)
![Node](https://img.shields.io/badge/node-v16.9.0+-green.svg)
![Discord.js](https://img.shields.io/badge/discord.js-v14-5865F2.svg)

**Rift Herald** is a professional-grade Discord bot designed to track League of Legends ranked progress. It provides automated daily LP updates, live server leaderboards, and detailed profile lookups with a focus on visual elegance and reliability.

Unlike basic bots, Rift Herald tracks players by their **PUUID**, meaning it never breaksโ€”even if a player changes their Riot ID.

---

## โœจ Key Features

- **๐Ÿ”„ Automated Daily Updates:** Automatically posts LP gains/losses, promotions, and demotions to a configured channel every day.
- **๐Ÿ† Live Leaderboard:** A real-time, sorted leaderboard for your server, complete with rank icons and win rates.
- **๐Ÿ†” PUUID Tracking:** Tracks the _account_, not the name. Handles name changes automatically.
- **๐Ÿข Multi-Guild Support:** Works across multiple Discord servers with independent tracking lists.
- **๐ŸŽจ Visual Elegance:** Uses custom server emojis for Rank Icons (Iron - Challenger) and dynamic color-coded embeds.
- **โšก Rate Limit Handling:** Smart queuing system to respect Riot API limits.

---

## ๐Ÿ› ๏ธ Prerequisites

- **Node.js** (v16.9.0 or higher)
- **NPM** or **Yarn**
- **Discord Bot Token** ([Get it here](https://discord.com/developers/applications))
- **Riot Games API Key** ([Get it here](https://developer.riotgames.com/))

---

## ๐Ÿš€ Installation & Setup

### 1. Clone the Repository

```bash
git clone https://github.com/yourusername/rift-herald.git
cd rift-herald
```

### 2. Install Dependencies

```bash
npm install
```

### 3. Configure Environment

Create a `.env` file in the root directory:

```bash
touch .env
```

Open it and paste the following configuration:

```env
# Discord Configuration
DISCORD_TOKEN=your_discord_bot_token
CLIENT_ID=your_discord_application_id

# Riot Games Configuration
RIOT_API_KEY=your_riot_api_key

# Cron Schedule (Default: Daily at 8:00 PM Asia/Kolkata)
CRON_SCHEDULE=0 20 * * *
CRON_TIMEZONE=Asia/Kolkata
```

### 4. Deploy Slash Commands

Register the commands with Discord:

```bash
node deploy-commands.js
```

### 5. Start the Bot

```bash
node src/index.js
```

_(For production, use PM2: `pm2 start src/index.js --name "rift-herald"`)_

---

## ๐ŸŽจ Visual Setup (Important)

For the **Leaderboard** and **Rank Updates** to look 10/10, you must upload custom emojis to your Discord server.

1. Go to **Server Settings > Emoji**.
2. Upload rank icons (download them from the LoL Wiki or similar).
3. **Name them exactly like this:**
- `iron`, `bronze`, `silver`, `gold`, `platinum`, `emerald`, `diamond`, `master`, `grandmaster`, `challenger`.

The bot automatically detects these emojis and renders them in the embeds.

---

## ๐ŸŽฎ Commands

| Command | Description |
| :---------------------------------------------- | :---------------------------------------------------- |
| `/setup channel:<#channel>` | **(Admin)** Configure where daily updates are posted. |
| `/track riot_id: region:` | Start tracking a player's ranked progress. |
| `/untrack player:` | Stop tracking a player (Autocomplete supported). |
| `/lolranking` | Show the server's live ranked leaderboard. |
| `/lolprofile riot_id:` | Lookup a player's current rank and stats instantly. |

---

## ๐Ÿ“‚ Project Structure

```text
rift-herald/
โ”œโ”€โ”€ data/ # SQLite Database storage
โ”œโ”€โ”€ src/
โ”‚ โ”œโ”€โ”€ commands/ # Slash Command definitions
โ”‚ โ”œโ”€โ”€ core/ # Database & Riot API Logic
โ”‚ โ”œโ”€โ”€ events/ # Discord Event Handlers
โ”‚ โ”œโ”€โ”€ tasks/ # Cron Jobs (Daily LP Check)
โ”‚ โ”œโ”€โ”€ utils/ # Embed builders & helpers
โ”‚ โ””โ”€โ”€ index.js # Entry point
โ”œโ”€โ”€ .env # Secrets
โ””โ”€โ”€ deploy-commands.js # Command registration script
```

---

## โš ๏ธ Maintenance Note

If you are using a standard **Riot Development Key**, it expires every **24 hours**.
If the bot starts throwing `403 Forbidden` errors:

1. Go to [Riot Developer Portal](https://developer.riotgames.com/).
2. Regenerate Key.
3. Update `.env`.
4. Restart Bot.

---

## ๐Ÿ“„ License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

---

**Built with โค๏ธ by Suvodeep Ghosh**

```

```