Skip to content

coslynx/discord-server-moderation-bot

Repository files navigation


discord-server-moderation-bot

Discord moderation bot with advanced features for server management.

Developed with the software and tools below.

Language: TypeScript Framework: Discord.js Database: MongoDB AI: OpenAI API

git-last-commit GitHub commit activity GitHub top language

📑 Table of Contents

  • 📍 Overview
  • 📦 Features
  • 📂 Structure
  • 💻 Installation
  • 🏗️ Usage
  • 🌐 Hosting
  • 📄 License
  • 👏 Authors

📍 Overview

This repository houses "ModerationBot," a Discord bot designed for server moderation and management. It leverages advanced features like automated message filtering, role management, moderation commands, user logging, customizable rules, and more. ModerationBot helps cultivate a positive and organized environment for your Discord communities.

📦 Features

Feature Description
⚙️ Architecture The codebase follows a modular architecture, separating different functionalities into distinct modules for improved organization and maintainability.
📄 Documentation This README provides a comprehensive overview of the bot's features, installation, usage, and development details.
🔗 Dependencies The bot utilizes essential libraries and packages like Discord.js, Mongoose, OpenAI API, and other tools for handling Discord interactions, database management, and advanced AI functionality.
🧩 Modularity Code is structured into modules for commands, utilities, events, models, and services, promoting code reusability and ease of maintenance.
🧪 Testing Unit tests are implemented using Jest to ensure the bot's functionality is correct and reliable.
⚡️ Performance The bot's design prioritizes performance, employing efficient data structures and algorithms for responsiveness.
🔐 Security Security measures include input validation, data sanitization, and secure API handling to protect user data and server integrity.
🔀 Version Control The project uses Git for version control, facilitating collaboration and managing code changes.
🔌 Integrations The bot integrates with the Discord API, MongoDB database, and OpenAI API for seamless functionality.
📶 Scalability The architecture is designed to scale efficiently, allowing for handling a large number of users and messages.

📂 Structure

├── .env
├── package.json
├── tsconfig.json
├── postcss.config.js
├── tailwind.config.js
├── Dockerfile
├── .github
│   └── workflows
│       └── main.yml
└── src
    ├── index.ts
    ├── commands
    │   ├── moderation.ts
    │   ├── roles.ts
    │   ├── logging.ts
    │   └── customRules.ts
    ├── utils
    │   ├── config.ts
    │   ├── database.ts
    │   ├── nlp.ts
    │   ├── discord.ts
    │   └── logger.ts
    ├── events
    │   ├── messageCreate.ts
    │   ├── guildMemberAdd.ts
    │   └── guildMemberRemove.ts
    ├── models
    │   ├── user.ts
    │   ├── guild.ts
    │   └── message.ts
    └── services
        ├── moderationService.ts
        ├── roleService.ts
        ├── loggingService.ts
        └── customRulesService.ts

💻 Installation

🔧 Prerequisites

  • Node.js (v18 or later)
  • npm (or yarn)
  • MongoDB

🚀 Setup Instructions

  1. Clone the repository:
    git clone https://github.com/spectra-ai-codegen/discord-server-moderation-bot.git
  2. Navigate to the project directory:
    cd discord-server-moderation-bot
  3. Install dependencies:
    npm install
  4. Set up environment variables:
    • Create a .env file in the root directory.
    • Add the following environment variables:
      DISCORD_TOKEN=your_discord_bot_token
      MONGO_URI=mongodb://your_mongodb_host:27017/your_database_name
      OPENAI_API_KEY=your_openai_api_key
      
  5. Start the bot:
    npm start

🏗️ Usage

To use ModerationBot, follow these steps:

  1. Invite the bot to your server:
  2. Grant permissions:
    • When inviting the bot, ensure you grant it the necessary permissions for moderation, such as "Kick Members," "Ban Members," "Manage Channels," and "Manage Roles."
  3. Configure settings (optional):
    • Use the bot's commands or a custom dashboard (if implemented) to set up custom rules, filtering options, and other configurations.

🌐 Hosting

🚀 Deployment Instructions

  1. Build the application:
    npm run build
  2. Deploy to a cloud platform:
    • Heroku, AWS, Google Cloud, or any other hosting platform of your choice.
  3. Set up environment variables on the hosting platform:
    • Ensure the environment variables DISCORD_TOKEN, MONGO_URI, and OPENAI_API_KEY are correctly set in the hosting environment.

📄 License

This project is licensed under the MIT License.

👏 Authors

🌐 Spectra.Codes

Why only generate Code? When you can generate the whole Repository!