# FANLORANT
With the rise of the e-sports industry, we tackled fantasy e-sports, intuitively! Meet FANLORANT, where popular tactical-FPS sensation VALORANT meets the realm of fantasy e-sports. This project is a fantasy Discord bot for Valorant, similar to fantasy sports, where users can get updates on player stats such as kills, deaths, assists, and calculate points based on these stats. The bot will do this all automatically, and allows for people to do so for Valorant which does not yet have a fantasy.
## Features
- Fetch and update player stats (kills, deaths, assists) from a specified webpage.
- Calculate and update player points based on custom criteria:
- 1 point per kill
- -0.5 points per death
- 0.25 points per assist
- Store and update player stats in a SQLite database.
- Easy integration with Discord to fetch and display player stats.
## Installation
1. **Clone the repository:**
```bash
git clone https://github.com/ntnx0246/FANLORANT.git
cd fanlorant
```
2. **Create and activate a virtual environment:**
```bash
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
```
3. **Install the required dependencies:**
```bash
pip install -r requirements.txt
```
4. **Set up environment variables:**
Create a `.env` file in the root directory and add the following:
```env
BOT_TOKEN=your_discord_bot_token
GUILD_ID=your_discord_guild_id
```
5. **Run the bot:**
```bash
python bot.py
```
## Usage
1. **Fetch and update player stats:**
The bot will scrape player stats from the specified webpage and update the SQLite database with the latest information.
2. **Commands:**
- `!news <number_of_articles>`: Get the latest news about Valorant.
- `!upcoming_matches <number_of_games>`: Get information about upcoming matches.
- `!update_database`: Update the database with the latest player kills.
- `!get_kda <player_name>`: Get the KDA of a specific player.
- `!get_points <player_name>`: Get the points of a specific player.
## Database Schema
The SQLite database (`valplayers.db`) contains a table `players` with the following schema:
```sql
CREATE TABLE players (
id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT NOT NULL,
kills INTEGER DEFAULT 0,
deaths INTEGER DEFAULT 0,
assists INTEGER DEFAULT 0,
points REAL DEFAULT 0
);