Skip to content

anxlz/PTB

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

147 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ† PTBP - Discord Gaming Leaderboard Bot

A feature-rich Discord bot for tracking player performance, managing leaderboards, and recording match statistics with AI-powered scoreboard recognition.

โœจ Features

๐Ÿ“Š Leaderboard Management

  • Dynamic Leaderboards - Automatically updated leaderboards with real-time player rankings
  • Multiple Sort Options - Sort by Points, K/D Ratio, Total Kills, Objective Time, Assists, or MVP count
  • Animated GIFs - Toggle between static images and animated GIFs with glowing avatar effects
  • Tier System - Organize players into custom tiers based on point thresholds
  • Pagination - Navigate through large leaderboards with easy-to-use controls

๐ŸŽฎ Match Recording

  • AI-Powered OCR - Automatic scoreboard recognition using Tesseract or Google Cloud Vision
  • Manual Tagging - Tag players manually when automatic recognition needs assistance
  • Match History - Complete history of all matches with detailed statistics
  • Point System - Customizable points allocation based on performance

๐ŸŽจ Visual Effects

  • Glowing Avatars - Top 3 players get animated glowing effects in GIF mode
    • ๐Ÿฅ‡ Gold glow for 1st place
    • ๐Ÿฅˆ Silver glow for 2nd place
    • ๐Ÿฅ‰ Bronze glow for 3rd place
  • Profile Cards - Beautiful player profile cards with stats and achievements
  • Custom Backgrounds - Support for default, URL, or uploaded leaderboard backgrounds

๐Ÿ‘ฅ Player Management

  • IGN Linking - Link Discord accounts to in-game names
  • Auto-Detection - Automatically match Discord users to game statistics
  • Profile Commands - View detailed player statistics and rankings

๐Ÿ”ง Admin Controls

  • Channel Configuration - Set results and log channels via commands
  • Tier Role Management - Automatic Discord role assignment based on performance
  • OCR Provider Selection - Choose between Tesseract and Google Cloud Vision
  • Auto-Record Toggle - Enable/disable automatic match recording

๐Ÿš€ Quick Start

Prerequisites

  • Node.js 18+
  • Discord Bot Token (Create one here)
  • (Optional) Google Cloud Vision API credentials for enhanced OCR

Installation

  1. Clone the repository

    git clone <repository-url>
    cd ptbp
  2. Install dependencies

    npm install
  3. Configure environment variables

    cp .env.example .env

    Edit .env and add your credentials:

    DISCORD_TOKEN=your_discord_bot_token
    BOT_CLIENT_ID=your_bot_client_id
  4. Start the bot

    npm start

๐Ÿ“ Configuration

Environment Variables

Variable Required Description
DISCORD_TOKEN โœ… Your Discord bot token
BOT_CLIENT_ID โœ… Your bot's client ID
LOG_CHANNEL_ID โŒ Channel for logging invalid scoreboards
RESULTS_CHANNEL_ID โŒ Channel for posting results
GOOGLE_APPLICATION_CREDENTIALS โŒ Path to Google Cloud credentials
GROQ_API_KEY โŒ Groq API key for AI features
UPDATE_INTERVAL_SECONDS โŒ Leaderboard update interval (default: 60)

Discord Commands

User Commands

  • /leaderboard [sort_by] - View the current leaderboard
  • /setign <ign> - Link your Discord account to an in-game name
  • /profile [@user] - View player profile and statistics

Admin Commands

  • /setresults <channel> - Set the results channel
  • /setlog <channel> - Set the log channel
  • /setmanager <role> - Set the manager role
  • /settierroles - Configure tier roles and point requirements
  • /setocr <provider> - Choose OCR provider (tesseract/google)
  • /toggleanimation <mode> - Toggle between static/animated leaderboards
  • /toggleautorecord - Enable/disable auto-recording

๐ŸŽฏ How It Works

  1. Scoreboard Upload - Users post game scoreboard screenshots in the designated channel
  2. AI Recognition - The bot uses OCR to extract player names and statistics
  3. Point Allocation - Points are automatically calculated and distributed
  4. Leaderboard Update - Rankings update in real-time
  5. Role Assignment - Players automatically receive tier roles based on performance

๐Ÿ–ผ๏ธ Leaderboard Modes

Static Mode

Clean, crisp PNG images with:

  • Player avatars with rank-colored frames
  • Tier group headers
  • Detailed statistics
  • Pagination controls

Animated Mode

Engaging GIF animations featuring:

  • โœจ Pulsing glow effects on top 3 avatars
  • ๐ŸŽจ Color-coded glows (Gold, Silver, Bronze)
  • ๐Ÿ”„ Smooth animation loop
  • All features from static mode

๐Ÿ“Š Tier System

Configure up to 5 tiers with custom:

  • Role assignments
  • Point thresholds
  • Custom colors for visual grouping

Players automatically receive roles and are grouped in the leaderboard based on their points.

๐Ÿ”„ Deployment

Production Build

npm run build
npm run start:prod

24/7 Uptime

The bot includes a health endpoint for monitoring services like UptimeRobot:

https://your-domain.com/health

Procfile (for Heroku/Railway)

web: npm run start:prod

๐Ÿ› ๏ธ Technology Stack

  • Runtime: Node.js with TypeScript
  • Framework: NestJS
  • Discord Library: discord.js v14
  • OCR: Tesseract.js / Google Cloud Vision
  • Image Processing: node-canvas
  • Animation: gifencoder
  • AI: Groq SDK (optional)

๐Ÿ“ˆ Statistics Tracked

  • Points - Total points earned
  • Kills - Total eliminations
  • Deaths - Times eliminated
  • K/D Ratio - Kill/Death ratio
  • Assists - Team assists
  • Objective Time - Time on objective
  • MVP - MVP awards count

๐Ÿค Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

๐Ÿ“„ License

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

๐Ÿ†˜ Support

For issues, questions, or suggestions:

  1. Check the documentation
  2. Review existing issues
  3. Create a new issue with detailed information

๐ŸŽ‰ Acknowledgments

Built with โค๏ธ for gaming communities who want professional leaderboard tracking.


Made with NestJS and Discord.js | Powered by AI | Built for Gamers

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages