A Discord bot for NBA 2K Global Rankings system with Supabase integration.
- Player registration and account linking
- Rank checking and player statistics
- Event registration (both draft pool and BYOT formats)
- Stripe payment integration for paid events
- Admin tools for managing players and events
- Role automation based on player status
- Bot: Node.js + Discord.js v14
- Database: Supabase (Postgres)
- UI (Future): React + Discord Embedded SDK
- Auth: Supabase Auth
- Payments: Stripe Checkout
- Deploy: Railway or Render
- Clone the repository
- Install dependencies:
npm install - Create a
.envfile based on.env.exampleand fill in your credentials:DISCORD_TOKEN- Your Discord bot tokenSUPABASE_URL- Your Supabase project URLSUPABASE_ANON_KEY- Your Supabase anonymous keySTRIPE_SECRET_KEY- Your Stripe secret key (optional)STRIPE_WEBHOOK_SECRET- Your Stripe webhook secret (optional)
- Run the bot:
npm start
Set these env vars in your shell or .env:
DISCORD_TOKEN- bot tokenDISCORD_CLIENT_ID- application client IDDISCORD_GUILD_ID- (optional) target guild for fast registration; omit for global
Then deploy commands:
npm run deploy:commands
If you add or rename commands, redeploy with the same command. Global registrations can take up to an hour to propagate; guild-scoped registrations are instant.
/register- Register as a player in the Global Rankings system/link-profile- Link your Discord account to your Pro-Am Rank player profile (by gamertag)
/myrank- Check your current RP, global rank, and draft tier/stats [@user]- View detailed player statistics/playerprofile [@user] [gamertag]- View comprehensive player profile/myprofile- Show your own linked Pro-Am profile/leaderboard [tournament]- View the leaderboard for a specific tournament/top_players [limit]- View top players globally/top_teams [limit]- View top teams globally
/join_event- Join an open event/pay_event- Pay for event entry with Stripe
/teamprofile [team]- View detailed team profile with roster and stats/season_player_stats [season]- View your stats for a specific league season/season_standings- View full season standings (modal input)/season_team_results- View team standings for a league season (modal input)
/admin update_rp @user [amount]- Manually adjust a player's RP/admin award_mvp @user [tournament_id]- Award MVP to a player in a tournament/admin fetch_roster [team_id]- Fetch a team's roster
players: id, discord_id, gamertag, platform, position, team_id, rp, draft_ratingevents: id, name, type, open_statusdraft_pool: player_id, event_id, statusevent_registrations: player_id, event_id, stripe_paid (bool)player_awards: player_id, event_id, award_typeteams,team_rosters,event_results(already exists)
The bot includes role automation functionality that can be run as a daily cron job to update Discord roles based on:
- Rank tier (Tier 1, Tier 2, FA)
- Event status (Drafted, In Pool)
- Team association
To run the role automation manually:
node cron/dailyRoleUpdate.js
The bot can be deployed to platforms like Railway or Render. Make sure to set the environment variables in your deployment environment.
- Embedded Activities using Discord Embedded App SDK
- Weekly automated embeds with top rankings
- More sophisticated ranking algorithms
- Tournament bracket management