A versatile Discord bot built with Discord.js and MongoDB, featuring economy systems, moderation tools, and more. Easily deployable using Docker and customizable to fit your server's needs.
Welcome to DiscordBot, a feature-rich Discord bot designed to enhance your server with various functionalities, including moderation tools, an economy system, and interactive commands. Built with scalability and ease of deployment in mind, this bot leverages the power of Node.js, Discord.js, and MongoDB.
- Moderation Tools: Kick, ban, and timeout users with ease.
- Economy System: Implement daily rewards and track user balances.
- Leveling System: Encourage engagement by tracking and displaying user levels.
- Custom Commands: Easily add or modify commands to suit your server's needs.
- Docker Support: Simplify deployment with Docker and Docker Compose.
- Interactive Status: Dynamic bot status messages to keep your server engaged.
Before setting up the DiscordBot, ensure you have the following installed on your system:
- Node.js v18 or higher
- npm (comes with Node.js)
- MongoDB (if not using Docker)
- Docker & Docker Compose (optional, for Docker deployment)
git clone https://github.com/JavierRangel2004/DiscordBot.git
cd DiscordBotInstall the required npm packages:
npm installCreate a .env file in the root directory of the project and add the following variables:
TOKEN=your_discord_bot_token
CLIENT_ID=your_discord_client_id
GUILD_ID=your_test_guild_id
MONGODB_URI=your_mongodb_connection_stringTOKEN: Your Discord bot token.CLIENT_ID: Your Discord application's client ID.GUILD_ID: The ID of your Discord server where you want to deploy commands.MONGODB_URI: Your MongoDB connection string.
Edit the config.json file to include developer IDs and test server ID:
{
"devs": ["your_developer_id"],
"testServer": "your_test_server_id"
}devs: An array of Discord user IDs who are considered developers.testServer: The ID of the Discord server used for testing commands.
To start the bot in development mode with auto-reloading:
npm run devTo start the bot normally:
npm startBefore using the bot's commands, you need to deploy them to your Discord server.
npm run deploy-commandsThis script reads all command files and registers them with your specified guild.
Docker simplifies the deployment process. Ensure you have Docker and Docker Compose installed.
-
Build and Start the Containers:
docker-compose up --build
-
Accessing the Bot:
The bot will be running inside a Docker container and connected to a MongoDB instance also running in a container.
-
Stopping the Containers:
docker-compose down
Note: Ensure your .env file is properly configured as Docker Compose uses it to set environment variables.
-
/add: Adds two numbers together.- Options:
num1(Number, required): The first number.num2(Number, required): The second number.
- Options:
-
/ping: Replies with the bot's ping. -
/hey: Replies with "Hey!".
-
/daily: Collect your daily reward.- Description: Users can collect a daily amount of in-bot currency to encourage regular engagement.
-
/level: Displays your or someone else's level.- Options:
target_user(User, optional): The user whose level you want to see.
- Options:
-
/timeout: Timeout a user for a specified duration.- Options:
target(User, required): The user to timeout.duration(String, required): Duration of the timeout (e.g., 10m, 1h, 1d).reason(String, optional): Reason for the timeout.
- Options:
-
/kick: Kicks a member from the server.- Options:
target(User, required): The user to kick.reason(String, optional): Reason for kicking.
- Options:
-
/ban: Bans a member from the server.- Options:
target(User, required): The user to ban.reason(String, optional): Reason for banning.
- Options:
Contributions are welcome! Please follow these steps to contribute:
-
Fork the Repository
-
Create a New Branch
git checkout -b feature/YourFeature
-
Commit Your Changes
git commit -m "Add your feature" -
Push to the Branch
git push origin feature/YourFeature
-
Open a Pull Request
Please ensure your code follows the existing style and includes necessary documentation.
This project is licensed under the MIT License.
For any inquiries or support, please reach out to:
- Email: inspec_jrm@gmail.com
- GitHub: JavierRangel2004
Happy Discording! 🎉