Skip to content

mpc-ou/discord-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

32 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿค– MPC Discord Bot

TypeScript Node.js Discord.js React Fastify PostgreSQL

A powerful, full-featured Discord bot with a modern web dashboard. Built for MPC Club with stability, performance, and ease of use in mind.

โœจ Features

๐ŸŽต Advanced Music System

  • High-quality playback from YouTube, Spotify, SoundCloud
  • Real-time lyrics with auto-scroll
  • Queue management, loop, shuffle, and previous track
  • Volume control and DJ role permissions
  • Web dashboard control

๐Ÿ“Š Leveling & XP System

  • Customizable XP rates for messages and voice activity
  • Level-up announcements with custom channels
  • Interactive leaderboard
  • Role rewards for reaching levels

๐ŸŽฎ Mini Games

  • Rock Paper Scissors with streak tracking
  • Dice rolling
  • Interactive meme commands (hug, pat, kiss, etc.)

๐Ÿ‘ฅ Meeting Tracker

  • Voice channel attendance tracking
  • Automatic session recording
  • Detailed participation reports
  • Export meeting summaries

๐ŸŒ Web Dashboard

  • Real-time bot statistics
  • Guild management
  • Music player control
  • User profiles and leaderboards
  • Mobile-responsive design
  • Dark/Light mode support

๐Ÿ”ง Utilities

  • Multi-language support (English, Vietnamese)
  • Server and user information
  • Avatar display
  • GitHub integration

๐Ÿš€ Quick Start

Prerequisites

  • Node.js v20 or higher
  • PostgreSQL database
  • Discord Bot Token (Create one here)
  • FFmpeg (for voice/music features)

Local Development

  1. Clone and install dependencies

    git clone https://github.com/mpc-ou/discord-bot.git
    cd discord-bot
    npm install --legacy-peer-deps
    cd web && npm install && cd ..
  2. Environment setup

    Copy .env.example to .env and fill in your values:

    # Discord
    DISCORD_TOKEN=your_bot_token
    DISCORD_CLIENT_ID=your_client_id
    DEVELOPER_ID=["your_discord_id"]
    
    # Database
    DATABASE_URL=postgresql://user:password@localhost:5432/dbname
    
    # OAuth (for Web Dashboard)
    OAUTH_CLIENT_ID=your_client_id
    OAUTH_CLIENT_SECRET=your_client_secret
    OAUTH_REDIRECT_URI=http://localhost:3000/api/auth/callback
    
    # JWT
    JWT_SECRET=your_random_secret_key
    
    # Server
    SERVER_HOST=0.0.0.0
    SERVER_PORT=3000
  3. Setup database

    npm run db:push
  4. Build frontend and start bot

    npm run build  # Builds web dashboard
    npm start      # Starts the bot

    For development with hot reload:

    npm run dev      # Bot with auto-restart
    npm run dev:web  # Web dashboard dev server (http://localhost:5173)

๐Ÿณ Docker Deployment

  1. Build and run

    docker build -t discord-bot .
    docker run -d \
      --name discord-bot \
      -p 3000:3000 \
      --env-file .env \
      discord-bot

โ˜๏ธ Deploy to Railway

Railway is the recommended deployment platform.

  1. Connect your GitHub repository to Railway
  2. Add environment variables from .env.example
  3. Deploy! Railway will automatically:
    • Install dependencies
    • Build the web dashboard
    • Start the bot

No additional configuration needed - Railway auto-detects package.json scripts.

๐Ÿ› ๏ธ Project Structure

discord-bot/
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ bot/              # Discord.js bot
โ”‚   โ”‚   โ”œโ”€โ”€ commands/     # Slash commands
โ”‚   โ”‚   โ”œโ”€โ”€ events/       # Event handlers
โ”‚   โ”‚   โ””โ”€โ”€ utils/        # Bot utilities
โ”‚   โ”œโ”€โ”€ api/              # Fastify API server
โ”‚   โ”‚   โ”œโ”€โ”€ routes/       # API endpoints
โ”‚   โ”‚   โ””โ”€โ”€ middleware/   # Auth & validation
โ”‚   โ”œโ”€โ”€ database/         # Drizzle ORM
โ”‚   โ”‚   โ””โ”€โ”€ schema/       # Database schemas
โ”‚   โ”œโ”€โ”€ services/         # Business logic
โ”‚   โ”œโ”€โ”€ i18n/             # Translations (en, vi)
โ”‚   โ””โ”€โ”€ shared/           # Shared types
โ”œโ”€โ”€ web/                  # React dashboard
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ pages/        # Dashboard pages
โ”‚   โ”‚   โ”œโ”€โ”€ components/   # UI components
โ”‚   โ”‚   โ””โ”€โ”€ lib/          # Frontend utilities
โ””โ”€โ”€ .github/
    โ””โ”€โ”€ workflows/        # CI/CD (linting)

๐Ÿ“ Available Scripts

npm run dev          # Start bot in development mode
npm run dev:web      # Start web dashboard dev server
npm run build        # Build web dashboard
npm start            # Start bot in production mode
npm run lint         # Run ESLint
npm run db:push      # Push database schema
npm run db:studio    # Open Drizzle Studio (DB GUI)
npm run deploy-commands # Deploy slash commands to Discord

๐Ÿ” Environment Variables

See .env.example for all available configuration options.

Key variables:

  • DISCORD_TOKEN - Your bot token
  • DATABASE_URL - PostgreSQL connection string
  • DEVELOPER_ID - Array of Discord IDs with admin access
  • JWT_SECRET - Secret for web dashboard authentication

๐Ÿค Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

๐Ÿ“„ License

This project is licensed under the GPL-2.0 License - see the LICENSE file for details.

๐Ÿ™ Acknowledgments


Made with โค๏ธ by MPC Club

About

A powerful, full-featured Discord bot with a modern web dashboard. Built for MPC Club with stability, performance, and ease of use in mind.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages