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
/register- Register as a player in the Global Rankings system/link_account- Link your existing player account to your Discord user
/myrank- Check your current RP, global rank, and draft tier/stats [@user]- View detailed player statistics/leaderboard [event_id]- View the leaderboard for a specific event
/join_event- Join an open event/pay_event- Pay for event entry with Stripe
/admin update_rp @user [amount]- Manually adjust a player's RP/admin award_mvp @user [event_id]- Award MVP to a player in an event/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