How kanishkiiitd/discord-gambling-bot works
Playdex is a guild-scoped gambling, economy, and collection platform with a React dashboard, Discord bot, and Express API backed by MongoDB. Users interact through either the web app or Discord; requests reach API routes that handle authentication, games, bets, user economy, Pokémon battles, and item systems, then persist domain state. The README documents additional games and collection capabilities whose individual implementations were not sampled. Edges below are limited to relationships visible in excerpts, the source index, or README; unsampled feature links are omitted.
Main entry points: discord-bot/index.js Command runtime · userRoutes.js User and economy API · backend/index.js API server · useQueryHooks.js Queries and mutations
Components 25
Web dashboard
- Web application
frontend/src/App.js - Queries and mutations
frontend/src/hooks/useQueryHooks.js - API client
frontend/src/services/api.js - Guild state
frontend/src/store/useGuildStore.js
Discord bot
- Command runtime
discord-bot/index.js - Economy commands
discord-bot/commands/work.js - Collection commands
discord-bot/commands/pokedex.js - Game commands
discord-bot/commands/duel.js
Backend API
- API server
backend/index.js - Authentication
backend/middleware/auth.js - User and economy API
backend/routes/userRoutes.js - Betting API
backend/routes/betRoutes.js - Gambling API
backend/routes/gamblingRoutes.js - Discord guild lookup
backend/utils/discordClient.js
Game domains
- Pokémon battle API
backend/routes/battleRoutes.js - CS2 case service
backend/services/cs2Service.js - CS2 data service
backend/services/cs2DataService.js - Pokémon data lookup
backend/utils/pokeApi.js
Persistent data
- Battle sessions
backend/models/BattleSession.js - User records
backend/models/User.js - Wallet records
backend/models/Wallet.js - Bet records
backend/models/Bet.js - Transactions
backend/models/Transaction.js
Other components
- Dashboard user
- Discord member
Connections 27
- Dashboard user → Web application: uses
- Web application → Queries and mutations: loads data
frontend/src/App.js - Queries and mutations → Guild state: reads guild
frontend/src/hooks/useQueryHooks.js - Queries and mutations → API client: requests data
frontend/src/hooks/useQueryHooks.js - Queries and mutations → User and economy API: calls user endpoints
frontend/src/hooks/useQueryHooks.js - Discord member → Command runtime: uses commands
- Command runtime → Economy commands: dispatches
discord-bot/index.js - Command runtime → Collection commands: dispatches
discord-bot/index.js - Command runtime → Game commands: dispatches
discord-bot/index.js - Command runtime → User and economy API: requests profile
discord-bot/index.js - Command runtime → Gambling API: plays blackjack
discord-bot/index.js - API server → User and economy API: mounts routes
backend/index.js - API server → Betting API: mounts routes
backend/index.js - API server → Gambling API: mounts routes
backend/index.js - API server → Pokémon battle API: mounts routes
backend/index.js - Authentication → User records: loads user
backend/middleware/auth.js - Authentication → Discord guild lookup: checks guilds
backend/middleware/auth.js - User and economy API → User records: reads and writes
backend/routes/userRoutes.js - User and economy API → Wallet records: reads wallets
backend/routes/userRoutes.js - Betting API → Bet records: manages bets
backend/routes/betRoutes.js - Betting API → Wallet records: updates balance
backend/routes/betRoutes.js - Betting API → Transactions: records activity
backend/routes/betRoutes.js - Gambling API → Wallet records: updates balance
backend/routes/gamblingRoutes.js - Gambling API → User records: loads player
backend/routes/gamblingRoutes.js - Pokémon battle API → Battle sessions: persists sessions
backend/routes/battleRoutes.js - Pokémon battle API → Pokémon data lookup: looks up Pokémon
backend/routes/battleRoutes.js - CS2 case service → CS2 data service: uses data service
backend/services/cs2Service.js