Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 54 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,21 @@ A Discord bot that automatically tracks CS2 players and roasts them based on the

## Features

- **Slash Commands**: Modern Discord UI with autocomplete and inline help
- **Automatic Command Deployment**: Commands automatically register per server
- **Multi-Server Support**: Works across unlimited Discord servers
- **Auto-Onboarding**: Automatically sets up new servers with welcome messages
- **Per-Server Configuration**: Each server sets its own roast channel
- **Fully Automated Match Tracking**: Checks all linked players every hour
- **Cross-Server User Support**: Users can link in multiple servers
- **Smart API Caching**: Fetches Leetify data once, sends to all relevant servers
- **Stat Comparison**: Compares performance between matches
- **Performance-Based Roasts**: Roasts based on stat degradation
- **Cooldown System**: 3-hour cooldown per user after match detection
- **Intelligent Cooldown**: Only applies when no new matches detected (allows consecutive games)
- **Offline Guild Detection**: Detects servers joined while bot was offline
- **Auto-Cleanup**: Removes all data when bot leaves a server
- **State Persistence**: Restores previous state on startup
- **Configurable Timers**: Adjust check intervals via environment variables

## Installation

Expand All @@ -32,52 +37,61 @@ npm install

## Initial Setup (Server Admins)

### 1. Configure the Bot
After adding the bot to your server, an admin must set up the roast channel:
### 1. Add the Bot
When you add the bot to your server, it will:
- Automatically deploy slash commands
- Send a welcome message with setup instructions
- Be ready to use immediately

### 2. Configure the Bot
An admin must set up the roast channel using:
```
!setup #roasts
/setup channel #roasts
```

This sets where automatic roasts will be posted.

### 2. Check Setup Status
### 3. Check Setup Status
```
!setup status
/setup status
```

## Commands

All commands are **slash commands** - start typing `/` in Discord to see them with autocomplete!

### User Commands

**Link your Steam account:**
```
!link <steam64_id>
/link steam64_id:76561198123456789
```
Find your Steam64 ID at [steamid.io](https://steamid.io/)

**View your stats:**
```
!stats
!stats @user
/stats
/stats user:@username
```

**Check tracker status:**
```
!tracker status
!tracker check [@user]
/tracker status
/tracker check
/tracker check user:@username
```

### Admin Commands

**Setup roast channel (requires Manage Server permission):**
```
!setup #channel
!setup status
/setup channel #roasts
/setup status
```

**Link other users (admin only):**
**Link other users (requires Administrator permission):**
```
!link @user <steam64_id>
/link steam64_id:76561198123456789 user:@username
```

## Multi-Server Behavior
Expand All @@ -88,16 +102,37 @@ Find your Steam64 ID at [steamid.io](https://steamid.io/)
- API is called only **once per user**, not once per server (efficient!)
- When bot leaves a server, all data for that server is automatically deleted
- Users linked in other servers remain unaffected
- Commands are automatically deployed per server when bot joins
- If bot was offline when added to a server, it detects and deploys commands on startup

## Cooldown System

The bot uses an intelligent cooldown system:
- **Match detected**: No cooldown applied (allows players to play consecutive games)
- **No match detected**: 3-hour cooldown applied (prevents API spam for inactive players)

This means players can play multiple CS2 games in a row and get roasted after each one!

## Configuration

Edit `services/matchTracker.js` to adjust timing:
Create a `.env` file with the following variables:

```javascript
const CHECK_INTERVAL = 60 * 60 * 1000; // How often to check for new matches
const USER_COOLDOWN = 3 * 60 * 60 * 1000; // Cooldown after detecting a match
```bash
# Discord Bot Configuration
DISCORD_TOKEN=your_discord_bot_token_here
CLIENT_ID=your_discord_client_id_here

# Leetify API Configuration
LEETIFY_API_KEY=your_leetify_api_key_here
LEETIFY_API_BASE_URL=https://api-public.cs-prod.leetify.com

# Match Tracker Settings
CHECK_INTERVAL_MINUTES=60 # How often to check for new matches (default: 60 minutes)
USER_COOLDOWN_HOURS=3 # Cooldown period after no new match detected (default: 3 hours)
```

You can adjust the timing by changing the environment variables in `.env`.

## Requirements

- Node.js v16.9.0+
Expand Down
1 change: 0 additions & 1 deletion config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ module.exports = {
// Discord Configuration
token: process.env.DISCORD_TOKEN,
clientId: process.env.CLIENT_ID,
prefix: process.env.PREFIX || '!',

// Leetify API Configuration
leetifyApiKey: process.env.LEETIFY_API_KEY,
Expand Down
Loading