Skip to content

PumPum7/modmail

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Modmail System

A comprehensive modmail system for Discord servers, enabling users to communicate privately with server moderators through direct messages.

Architecture Overview

The system consists of three main components:

┌─────────────────┐    ┌──────────────────┐    ┌─────────────────┐
│   Discord Bot   │    │   Backend API    │    │  Web Dashboard  │
│   (TypeScript)  │◄──►│     (Rust)       │◄──►│  (SvelteKit)    │
└─────────────────┘    └──────────────────┘    └─────────────────┘
         │                        │                        │
         ▼                        ▼                        ▼
┌─────────────────┐    ┌──────────────────┐    ┌─────────────────┐
│  Discord API    │    │   PostgreSQL     │    │ Discord OAuth   │
│                 │    │    Database      │    │                 │
└─────────────────┘    └──────────────────┘    └─────────────────┘

Components

  1. Discord Bot - Handles DMs, creates threads, manages Discord channels
  2. Backend API - REST API server for data persistence and management
  3. Web Dashboard - Moderator interface for thread and macro management

Data Flow

  1. User Interaction: User sends DM to Discord bot
  2. Thread Creation: Bot creates thread in backend and Discord channel
  3. Message Relay: Messages flow bidirectionally between user and moderators
  4. Web Management: Moderators use dashboard to view history and manage macros
  5. Thread Closure: Moderators close threads via bot commands or web interface

Quick Start

  1. Database Setup:

    # Start PostgreSQL with Docker
    docker-compose up -d postgres
  2. Backend:

    cd backend
    cargo run
  3. Discord Bot:

    cd discord
    bun install
    bun run deploy
    bun run start
  4. Frontend:

    cd frontend
    bun install
    bun run dev

Environment Configuration

Each component requires specific environment variables. See individual package READMEs for detailed configuration:

Docker Deployment

The system includes Docker configurations for containerized deployment:

docker-compose up -d

This starts all services with proper networking and database connections.

Features

  • Seamless Communication: Users DM the bot, moderators respond in dedicated channels
  • Thread Management: Automatic thread creation and organization
  • Message History: Complete conversation logs accessible via web dashboard
  • Macro System: Predefined responses for common inquiries
  • Role-based Access: Discord role integration for moderator permissions

Technology Stack

  • Backend: Rust, Actix Web, SQLx, PostgreSQL
  • Discord Bot: TypeScript, discord.js, Bun
  • Frontend: SvelteKit, TypeScript, Vite
  • Database: PostgreSQL with SQLx migrations
  • Deployment: Docker, Docker Compose

About

A discord modmail implementation with management web front end.

Topics

Resources

License

Stars

Watchers

Forks