Starter scaffold for a Discord bot that provides PUBG PC stats and match notifications.
Quick start
- Copy
.env.exampleto.envand set values.- Set
DISCORD_APP_IDto your bot application ID to enable global slash command registration.
- Set
- Install dependencies:
npm install- Run in dev mode:
npm run devRun the telemetry worker:
npm run workerBuild & run:
npm run build
npm startFeatures
Use /register <username> [platform] to link your PUBG account to your Discord user and start using the bot.
- username (required): Your exact PUBG player name
- platform (optional):
steam,xbox,psn, ormobile(default:steam)
Example: /register PlayerName steam
After successful registration, you'll see your current stats displayed. Use /unregister to unlink your account.
Check your PUBG profile with key stats like kills, wins, K/D ratio and more using /profile.
- player (optional): Player name (default: your registered account)
Examples:
/profile— Get your profile/profile player:PlayerName— Get another player's profile
View the last 5 matches with details on map, mode, kills, final position and duration using /history.
- player (optional): Player name (default: your registered account)
Example: /history or /history player:PlayerName
Access complete and specific info about your last match with /match.
- player (optional): Player name (default: your registered account)
Example: /match or /match player:PlayerName
Check the top players by region and mode, with real-time data and filters via /ranking.
- region (optional): Region to filter by, e.g.
global,na,eu - mode (optional):
solo,duo, orsquad - season (optional): Season identifier, or leave blank for current season
Compare stats between two players to see who dominates using /compare.
- player1 (optional): First player name (defaults to your registered account if available)
- player2 (optional): Second player name
Example: /compare player1:PlayerA player2:PlayerB
Get detailed PUBG breakdowns with /stats.
- player (optional): Player name (default: your registered account)
Example: /stats
Stay up to date with active maps and ongoing events using /maps and /events.
/maps— Current map rotation and active rewards/events— Active PUBG events and seasonal challenges
With BattleCoins you can enjoy a unique system within the PUBG Monitor bot, designed to reward your activity. Check your balance with /coins.
Full support for Steam, Console (Xbox/PlayStation), and Mobile platforms.
Check the latest changes, improvements and new features using /updates.
Files of interest
src/bot/index.ts— Discord bot entrysrc/api/pubgClient.ts— PUBG API client skeletonsrc/workers/telemetryWorker.ts— worker skeletonsrc/db/mongo.ts— MongoDB helper.env.example— environment variables
Below is a concise reference for available slash commands and examples.
-
/ping— Bot health check. -
/register username:<name> [platform:<steam|xbox|psn|mobile>]— Link your PUBG account to Discord.- Example:
/register PlayerName steam
- Example:
-
/unregister— Unlink your PUBG account. -
/profile [player:<name>]— Show overall player stats (K/D, wins, damage).- Example:
/profile(uses your registered account) - Example:
/profile player:OtherPlayer
- Example:
-
/history [player:<name>]— Show last 5 matches with summary per match. -
/match [player:<name>]— Detailed view of the most recent match (DPM, survival time, final position). -
/compare [player1:<name>] [player2:<name>]— Side-by-side player comparison; defaults to your registered account if one name is omitted. -
/ranking [region:<code>] [mode:<solo|duo|squad>] [season:<id>]— Leaderboard view for region/mode/season. -
/stats [player:<name>]— Advanced stats and mode breakdown (uses last 20 matches for breakdown). -
/maps— Current map rotation and active map rewards. -
/events— Active PUBG events and seasonal information. -
/coins— Your BattleCoins wallet: balance, totals, and recent transactions. -
/updates— Summary of recent bot updates and feature highlights.
- The telemetry worker processes match telemetry and awards BattleCoins to registered users based on match completion, kills, top-10 finishes and wins. The worker subscribes to a Redis channel and expects messages with the shape
{"matchId":"...","platform":"steam"}. - Run the telemetry worker locally with:
npm run worker- BattleCoins rules (current implementation):
- Base reward: 10 coins per processed match per registered player
- Win bonus: +20 coins for 1st place
- Top-10 bonus: +10 coins for finishing in top 10
- Kill bonus: +2 coins per kill
- Duplicate rewards are prevented via transaction checks
Start the bot (after setting environment variables in .env):
npm install
npm run build
npm startStart the telemetry worker (separate process):
npm run workerSee .env.example for required values. At minimum you should set DISCORD_TOKEN, DISCORD_APP_ID, PUBG_API_KEY, MONGO_URI and REDIS_URL.