A sophisticated Discord bot built with TypeScript that provides comprehensive PUBG (PlayerUnknown's Battlegrounds) match analysis, performance tracking, and AI-powered coaching recommendations. The bot automatically monitors player matches, performs detailed telemetry analysis, and delivers strategic insights to help players improve their gameplay.
- Real-time Match Monitoring - Automatic detection and processing of new matches
- Comprehensive Telemetry Analysis - Deep dive into match data with strategic insights
- Performance Scoring - 0-100 scoring system across multiple categories
- Critical Mistake Identification - Pinpoint high-impact errors with specific fixes
- Strategic Recommendations - Priority-based advice for immediate and long-term improvement
- Personalized Coaching Tips - Tailored recommendations based on individual performance
- Categorized Improvement Plans - Immediate, short-term, and long-term development paths
- Difficulty-Based Learning - Easy, medium, and hard skill development tracks
- Role-Specific Analysis - Individual player contribution assessment
- Engagement Analysis - Combat effectiveness, weapon optimization, positioning strategies
- Zone Management - Rotation timing, blue zone damage analysis, path efficiency
- Team Coordination - Revive efficiency, spacing analysis, communication effectiveness
- Weapon Effectiveness - Kill/shot ratios, optimal range analysis, loadout recommendations
- Slash Commands - Easy-to-use Discord commands for bot management
- Rich Embeds - Beautiful, detailed match summaries with color-coded performance
- Automatic Analysis - Seamless integration with match monitoring for instant insights
- Multi-Category Reports - Comprehensive breakdowns across all performance areas
- โ Positioning Patterns - Zone management, rotation efficiency, compound holding
- โ Combat Effectiveness - Engagement outcomes, weapon performance, range optimization
- โ Team Coordination - Revive success rates, spacing, communication indicators
- โ Decision Making - Timing patterns, strategic choices, risk assessment
- โ Resource Management - Looting efficiency, healing management, throwable usage
- โ Third-Party Detection - Multi-team encounter analysis and vulnerability assessment
- 90-100: Excellent performance - Minor optimizations only
- 80-89: Good performance with minor improvement areas
- 70-79: Average performance with clear development opportunities
- 60-69: Below average - Requires focused attention
- <60: Poor performance - Significant improvement needed
The bot supports the following slash commands:
/add playername:YourPlayerName- Add a PUBG player to monitoring list/remove playername:YourPlayerName- Remove a player from monitoring/list- Display all currently monitored players/removelastmatch- Remove the last processed match from tracking
- Add Players: Use
/addcommand to start monitoring players - Automatic Detection: Bot detects new matches for monitored players
- Telemetry Analysis: Comprehensive analysis runs automatically on new matches
- Discord Results: Detailed analysis embeds sent to Discord automatically
Before you begin, ensure you have the following:
- Node.js (v16 or higher)
- npm (Node Package Manager)
- MongoDB database
- Discord bot token and application
- PUBG Developer API key
- Docker and Docker Compose (optional, for containerized deployment)
- Clone the repository:
git clone https://github.com/yourusername/pubg-tracker-bot.git
cd pubg-tracker-bot- Install dependencies:
npm install- Build the project:
npm run buildCreate a .env file in the root directory with the following variables:
DISCORD_TOKEN=your_discord_bot_token
DISCORD_CLIENT_ID=your_discord_client_id
DISCORD_CHANNEL_ID=your_discord_channel_id
PUBG_API_KEY=your_pubg_api_key
PUBG_API_URL=https://api.pubg.com/shards/
DEFAULT_SHARD=steam
MONGODB_URI=your_mongodb_connection_string.env file or sensitive credentials to version control.
- Discord Bot Setup:
- Go to Discord Developer Portal
- Create a new application and bot, copy the token and client ID
- Enable necessary bot permissions (Send Messages, Read Message History, Use Slash Commands)
- Use the OAuth2 URL generator to invite the bot to your server
- Discord Channel ID:
- Enable Developer Mode in Discord (User Settings > Advanced)
- Right-click the desired channel and select "Copy ID"
- PUBG API Key:
- Visit PUBG Developer Portal
- Create an account and generate an API key
- Select the appropriate platform shard (e.g., 'steam')
npm run devnpm start- Build and start the container:
docker-compose up --build- Run in detached mode:
docker-compose up --build -d- Stop the container:
docker-compose down- Build the Docker image:
docker build -t pubg-tracker-bot .- Run the container:
docker run -d --name pubg-tracker-bot \
-e DISCORD_TOKEN=your_discord_bot_token \
-e DISCORD_CLIENT_ID=your_discord_client_id \
-e DISCORD_CHANNEL_ID=your_discord_channel_id \
-e PUBG_API_KEY=your_pubg_api_key \
-e PUBG_API_URL=https://api.pubg.com/shards/ \
-e DEFAULT_SHARD=steam \
-e MONGODB_URI=your_mongodb_connection_string \
--restart unless-stopped \
pubg-tracker-bot# Using Docker Compose
docker-compose logs -f
# Using Docker directly
docker logs -f pubg-tracker-botpubg-tracker-bot/
โโโ src/
โ โโโ config/ # Configuration files
โ โโโ constants/ # Application constants and mappings
โ โโโ data/ # Data models and repositories
โ โ โโโ models/ # MongoDB data models
โ โ โโโ repositories/ # Data access layer
โ โโโ services/ # Core business logic
โ โ โโโ analyzers/ # Specialized analysis services
โ โ โโโ coaching-tips.service.ts # AI coaching system
โ โ โโโ discord-bot.service.ts # Discord integration
โ โ โโโ match-monitor.service.ts # Match monitoring
โ โ โโโ pubg-api.service.ts # PUBG API client
โ โ โโโ pubg-storage.service.ts # Database operations
โ โ โโโ telemetry-analyzer.service.ts # Match analysis engine
โ โโโ types/ # TypeScript type definitions
โ โโโ utils/ # Utility functions and helpers
โ โโโ index.ts # Main entry point
โโโ test/ # Test files
โ โโโ integration/ # Integration tests
โ โโโ unit/ # Unit tests
โโโ docker-compose.yml # Docker Compose configuration
โโโ Dockerfile # Docker build configuration
โโโ package.json # Project dependencies and scripts
โโโ tsconfig.json # TypeScript configuration
- discord.js (v14.16.3) - Discord bot framework with slash command support
- typescript (v5.6.3) - Programming language with strong typing
- jest (v29.7.0) - Testing framework for unit and integration tests
- nodemon (v3.1.7) - Development auto-reload for faster iteration
The project includes comprehensive testing with both unit and integration tests following best practices:
# Run unit tests
npm test
# Run integration tests
npm run test:integration
# Run tests in watch mode
npm run test:watch
# Run formatting/import checks and typechecking
npm run check:all- Unit Tests: Follow Arrange-Act-Assert convention
- Integration Tests: Use Given-When-Then approach
- Coverage: Aim for comprehensive test coverage of core functionality
- Test Data: Use realistic PUBG match data for accurate testing
When a new match is detected, the bot automatically sends detailed analysis including:
- Overview Embed - Match details, team performance, combat summary
- Player Performance - Individual stats with kill/knock details and 2D replay links
- Critical Mistakes - High-impact errors with specific improvement recommendations
- Strategic Analysis - Engagement, positioning, and team coordination breakdowns
- Coaching Tips - Personalized improvement plans categorized by timeframe and difficulty
- Positioning Score (0-100) - Zone management, rotation timing, compound holding
- Engagement Score (0-100) - Combat effectiveness, weapon choice, range optimization
- Teamwork Score (0-100) - Coordination, revives, communication indicators
- Decision Making Score (0-100) - Strategic choices, timing, risk assessment
This project uses automated semantic versioning with GitHub Actions for CI/CD:
# Create patch release (bug fixes)
npm run release:patch
# Create minor release (new features)
npm run release:minor
# Create major release (breaking changes)
npm run release:majorProduction-ready Docker images are automatically built and published:
# Latest stable release
docker pull your-username/pubg-tracker-bot:latest
# Specific version
docker pull your-username/pubg-tracker-bot:v1.2.0
# Development builds
docker pull your-username/pubg-tracker-bot:devFor detailed release information, see VERSIONING.md.
- Development Roadmap - Planned features and implementation timeline
- Telemetry Analyzer Guide - Detailed analysis system documentation
- Telemetry Analyzer Summary - Implementation overview and capabilities
- Docker Guide - Comprehensive Docker deployment instructions
- Versioning Guide - Release process and version management
- Monitor Active Players - Add players who play regularly for consistent data
- Analyze Recent Matches - PUBG telemetry data expires after ~14 days
- Include Full Teams - Add all squad members for accurate team coordination analysis
- Review Regularly - Check analysis results weekly for consistent improvement tracking
- Prioritize HIGH Impact Recommendations - Focus on these first for maximum improvement
- Start with IMMEDIATE Category Tips - Quick wins that can be applied in the next game
- Track Progress Over Time - Monitor improvement in specific categories across multiple matches
- Address Consistent Weaknesses - Focus on patterns that appear across multiple matches
We welcome contributions to improve the PUBG Tracker Bot! Here's how to get started:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Follow the TypeScript coding standards defined in
.cursorrules - Write comprehensive tests for new features
- Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Follow existing TypeScript patterns and naming conventions
- Implement unit tests for all new services and functions
- Add integration tests for new Discord commands or API endpoints
- Update documentation for new features
- Ensure all tests pass before submitting PR
This project is licensed under the MIT License - see the LICENSE file for details.
- Bot Not Responding: Check Discord token and permissions
- No Match Data: Verify PUBG API key and player names
- Database Errors: Ensure MongoDB connection string is correct
- Analysis Not Working: Check that telemetry URLs are accessible
- Check existing issues in the GitHub repository
- Review the documentation files for detailed guides
- Create a new issue with:
- Detailed description of the problem
- Relevant logs and error messages
- Environment details (Node.js version, OS, etc.)
- Steps to reproduce the issue
- Environment Variables: Never commit
.envfiles or sensitive credentials - Production Deployment: Use Docker secrets or secure environment variable management
- API Keys: Regularly rotate PUBG API keys and Discord tokens
- Updates: Keep dependencies updated to patch security vulnerabilities
- Access Control: Limit Discord bot permissions to only what's necessary
Transform your PUBG gameplay with AI-powered analysis and coaching! ๐ฎ๐