Skip to content

A lightweight, HTTP-interaction-based public modmail bot for Discord. Users can create modmail threads in their server without requiring message intents or a persistent bot connection. Built on mini-interaction for easy command and thread management.

License

Notifications You must be signed in to change notification settings

minesa-org/thread-mail-discord

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

50 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

ThreadMail Discord Bot

A Discord bot that enables seamless ticket creation and management between users and server administrators through private threads. Built with mini-interaction framework for optimal performance and reliability.

✨ Features

  • Ticket Creation: Users can create support tickets from any server the bot is in
  • Private Threads: All tickets are created as private Discord threads for secure communication
  • Staff Management: Server admins can assign staff roles for ticket notifications
  • Channel Control: Customizable ticket creation channels per server
  • OAuth Integration: Secure Discord OAuth2 for user authentication
  • Database Storage: MongoDB integration for persistent data storage
  • Real-time Updates: Instant notifications and thread management

πŸš€ Quick Start

Prerequisites

  • Node.js 18+
  • MongoDB database
  • Discord Application with bot token
  • Vercel account (for deployment)

Installation

  1. Clone the repository

    git clone https://github.com/neodevils/thread-mail-discord.git
    cd thread-mail-discord
  2. Install dependencies

    npm install
  3. Environment Setup

    cp .env.example .env

    Fill in your environment variables:

    DISCORD_APPLICATION_ID=your_app_id
    DISCORD_BOT_TOKEN=your_bot_token
    DISCORD_PUBLIC_KEY=your_public_key
    DISCORD_REDIRECT_URI=your_redirect_uri
    DATABASE_TYPE=mongodb
    MONGODB_URI=your_mongodb_connection_string

πŸ› οΈ Development

Local Development

  1. Register Discord commands

    npm run build
  2. Start development server

    npm run production

Commands

ThreadMail includes the following Discord slash commands:

  • /create - Create a new support ticket
  • /send - Send messages in active tickets
  • /close - Close and archive tickets
  • /manage - Server administration settings

πŸ“¦ Deployment

Vercel Deployment

  1. Install Vercel CLI

    npm install -g vercel
  2. Login and link project

    vercel login
    vercel link
  3. Deploy

    vercel --prod

Environment Variables

Set these in your Vercel dashboard or .env file:

Variable Description Required
DISCORD_APPLICATION_ID Your Discord application ID βœ…
DISCORD_BOT_TOKEN Bot token from Discord Developer Portal βœ…
DISCORD_PUBLIC_KEY Public key for Discord interactions βœ…
DISCORD_REDIRECT_URI OAuth2 redirect URI βœ…
MONGODB_URI MongoDB connection string βœ…
DATABASE_TYPE Database type (mongodb) βœ…

πŸ€– Bot Setup

  1. Create Discord Application

  2. Bot Permissions

    • Send Messages
    • Use Slash Commands
    • Create Private Threads
    • Manage Threads
    • Read Message History
  3. Invite Bot

    https://discord.com/oauth2/authorize?client_id=YOUR_APP_ID&permissions=268435456&scope=bot%20applications.commands
    

πŸ“‹ Usage

For Server Administrators

  1. Invite the bot to your server
  2. Set staff role (optional): /manage staff set @role
  3. Set custom channel (optional): /manage channel set #channel
  4. View settings: /manage staff view or /manage channel view

For Users

  1. Authorize: Visit the OAuth URL or use /authorize-account
  2. Create ticket: Use /create and select target server
  3. Send messages: Use /send command in DMs
  4. Close ticket: Use /close when done

πŸ“œ Legal

πŸ› Troubleshooting

Common Issues

  • Bot not responding: Check bot permissions and ensure it's online
  • Ticket creation fails: Verify bot has "Create Private Threads" permission
  • Database errors: Check MongoDB connection and credentials
  • OAuth issues: Verify redirect URI matches your domain

Debug Mode

Set NODE_ENV=development for additional logging (not recommended for production).

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature-name
  3. Make your changes and test thoroughly
  4. Submit a pull request

πŸ“„ License

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

πŸ†˜ Support

  • Issues: GitHub Issues
  • Documentation: This README and inline code comments
  • Community: Discord support channels

Built with ❀️ using mini-interaction

About

A lightweight, HTTP-interaction-based public modmail bot for Discord. Users can create modmail threads in their server without requiring message intents or a persistent bot connection. Built on mini-interaction for easy command and thread management.

Resources

License

Security policy

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published