How j4spr/ladder_bot works
Fomranking is a Discord bot for managing game ladders, player standings, challenges, and match results. Users submit slash commands through Discord; the interaction event dispatches them to command handlers, which read and update PostgreSQL and send replies or interactive buttons back through Discord. Moderation commands manage ladder configuration and membership, while player commands cover joining, viewing rankings, challenging, and reporting wins. The tree and sampled handlers support these main flows; unsampled command behavior is represented at its enclosing directory, so finer wiring is not shown.
Main entry points: db.js Database adapter · main.js Bot startup · interactionCreate.js Interaction router · commands Slash commands
Components 12
Bot runtime
- Bot startup
main.js - Interaction router
events/interactionCreate.js - Slash commands
commands
Ladder management
- Ladder administration
commands/moderation
Player activity
- Player membership
commands/player - Standings display
commands/player/ranking.js - Challenge workflow
commands/player/challenge.js - Result confirmation
commands/player/win.js
Persistence
- Database adapter
db.js - PostgreSQL
Other components
- Discord users
- Discord platform
Connections 15
- Bot startup → Slash commands: loads handlers
- Bot startup → Interaction router: loads events
- Bot startup → Discord platform: registers and logs in
- Discord platform → Interaction router: delivers interactions
- Interaction router → Slash commands: dispatches command
- Discord users → Discord platform: submits commands
- Slash commands → Discord platform: replies to user
- Ladder administration → Database adapter: manages ladder data
- Player membership → Database adapter: updates membership
- Standings display → Database adapter: reads standings
- Challenge workflow → Database adapter: records challenge
- Challenge workflow → Discord platform: sends response buttons
- Result confirmation → Database adapter: updates match and ranks
- Result confirmation → Discord platform: requests confirmation
- Database adapter → PostgreSQL: queries and initializes