A Discord bot that integrates matchmaking queues into Discord channels written in TypeScript. This project runs on Node.js and uses MongoDB for persistent storage. The discord library used is discord.js.
- Player Management: Tracks players using Discord IDs with queue and match states
- Gamemode Support: Multiple gamemodes with dedicated Discord categories
- Queue System: Interactive Discord channels with join/leave buttons
- Matchmaking: Automatic match creation when enough players join
- Match Flow: Complete match lifecycle from ready-up to result voting
- Voice Channels: Automatic team voice channel creation
- Startup Reset: Automatically cancels all matches and clears player states on restart
- Database: MongoDB integration for persistent state management
-
Copy the environment file:
cp .env.example .env
-
Configure your Discord bot token and server ID in
.env:DISCORD_TOKEN=your_discord_bot_token_here GUILD_ID=your_discord_server_id_here MONGODB_URI=mongodb://localhost:27017/teeworlds-league -
Install dependencies:
npm install
-
Build the project:
npm run build
-
Start the bot:
npm start
For development:
npm run dev- index.ts: Main bot initialization and gamemode setup
- gamemode.ts: Discord category and queue management
- queue.ts: Channel creation and player interaction handling
- match_handler.ts: Complete match flow management
- players.ts: Player state management service
- matchmaking.ts: Match creation algorithms
The bot requires the following permissions:
- Manage Channels
- Send Messages
- View Channels
- Connect (Voice)
- Move Members (Voice)
- Use Slash Commands