This repository contains an open-source Discord bot built with Discord.js and MongoDB. The bot is designed to manage tasks on different boards within a guild. Below are the instructions to run the bot locally on your machine.
Before you begin, ensure you have the following installed on your system:
-
Clone the repository to your local machine:
git clone https://github.com/haith2m/taskbot.git
-
Navigate to the project directory:
cd taskbot
-
Install dependencies using npm:
npm install
-
Create a .env file in the root directory and add the following environment variables:
DISCORD_BOT_TOKEN=YOUR_DISCORD_BOT_TOKEN MONGO_URI=YOUR_MONGO_DB_CONNECTION_STRING GUILD_ID=YOUR_DISCORD_GUILD_ID CLIENT_ID=YOUR_DISCORD_CLIENT_ID
Replace YOUR_DISCORD_BOT_TOKEN, YOUR_MONGO_DB_CONNECTION_STRING, YOUR_DISCORD_GUILD_ID, and YOUR_DISCORD_CLIENT_ID with your own values.
-
Ensure your MongoDB server is running.
-
The bot uses a MongoDB database to store board and task information. Make sure to configure your MongoDB connection string in the .env file as MONGO_URI.
-
Run the registerCommands.js script to register slash commands with Discord API:
node registerCommands.js
This script reads commands from the commands
directory and registers them with the specified guild.
-
Start the bot by running the following command:
node index.js
The bot will log its status once it's successfully connected to Discord and MongoDB.
Use /help
to view all commands in the bot.
Use /command-name
to interact with the bot. Replace command-name with the name of the command you want to use.
Feel free to contribute to this open-source project by creating issues, suggesting improvements, or submitting pull requests.