Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/coslynx/discord-server-moderation-bot

Project: Discord Server Moderation Bot. Created at https://spectra.codes, which is owned by @Drix10
https://github.com/coslynx/discord-server-moderation-bot

automated-moderation code-generation code-quality community-management custom-rules developer-tools devops discord-api discord-bot discord-js hugging-face javascript machine-learning mongodb natural-language-processing openai-api server-moderation software-development typescript user-roles

Last synced: about 1 month ago
JSON representation

Project: Discord Server Moderation Bot. Created at https://spectra.codes, which is owned by @Drix10

Awesome Lists containing this project

README

        




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:
```bash
git clone https://github.com/spectra-ai-codegen/discord-server-moderation-bot.git
```
2. Navigate to the project directory:
```bash
cd discord-server-moderation-bot
```
3. Install dependencies:
```bash
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:
```bash
npm start
```

## ๐Ÿ—๏ธ Usage

To use ModerationBot, follow these steps:

1. Invite the bot to your server:
- Obtain the bot's invite link from the Discord developer portal (see the [Discord Developer Portal](https://discord.com/developers/applications) for instructions).
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:
```bash
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](https://choosealicense.com/licenses/mit/).

## ๐Ÿ‘ Authors

- Author Name - [Spectra.codes](https://spectra.codes)
- Creator Name - [DRIX10](https://github.com/Drix10)


๐ŸŒ Spectra.Codes




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