Skip to content

A Discord bot built with Python and discord.py, designed for handling direct messages, and enabling moderators to reply to users through a dedicated channel.

License

Notifications You must be signed in to change notification settings

w3nabil/discord-modmail

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Discord Mod Mail Bot

A Discord bot built with Python and discord.py, designed for handling direct messages, and enabling moderators to reply to users through a dedicated channel.

Python Version 3.8.x DiscordPy Version 2.3.2 License

Features

  • Listens for direct messages and forwards them to a moderation channel.
  • Allows moderators to reply to users from a specific channel.

Installation

Prerequisites

  • Python 3.8+
  • discord.py library
  • python-dotenv for environment variable management
  • json for configuration management

Setup

  1. Clone the repository:

    git clone https://github.com/w3nabil/discord-modmail.git
    cd discord-modmail
  2. Install dependencies:

    pip install -r requirements.txt
  3. Set up environment variables:

  4. Configure config.json:

    • Modify the config.json file in the project root and structure it like this:
      {
        "server_id": 123456789012345678, // This is your SERVER ID
        "mod_channel_id": 123456789012345678, // This is the channel where dms messages will be forwarded
        "mod_role_id": 123456789012345678 // Moderator Role, so that they can send messages
      }
  5. Run the bot:

    python bot.py

Usage

  • Listening to DMs: Any DM sent to the bot will be forwarded to the moderation channel.
  • Moderator Replies: Mods can reply using:
    reply <user_id> <message>
  • Bot Presence: The bot will display "Listening to People!" as its status.

Error Handling

  • If config.json is missing or has incorrect values, the bot will print an error message and exit.
  • If the bot lacks permissions to message a user, it will notify the moderator in the channel.

Limitations

  • Uses lower python and discord.py version (Maybe it will be outdated soon).
  • Things need to be monitored manually, for example, you need to find the text.
  • Not good for servers which planning to serve 20+ users using my modmail.
  • Poor Error handling, and I did not effort much for this project.
  • Can not send direct images, use image cdn instead with vanity.

License

This project is licensed under the MIT License. See LICENSE for details.

Contact

For questions, feedback, or collaboration opportunities, feel free to reach out at [email protected].


About

A Discord bot built with Python and discord.py, designed for handling direct messages, and enabling moderators to reply to users through a dedicated channel.

Topics

Resources

License

Stars

Watchers

Forks

Languages