evecordjs v1.0.6
EvecordJS
EvecordJS is a JavaScript library for creating easily configurable Discord bots. This bot has the ability to automatically reply to specific messages.
Features
- Easy setup
- Flexible configuration of message triggers and responses
- Persistence of reactions using JSON files
Requirements
- Node.js (version 12.0.0 or higher)
- npm (comes with Node.js)
- Discord account and bot token
Installation
- Clone or download this repository.
Navigate to the project folder and run the following command to install the necessary dependencies:
npm install discord.js
Usage
Create a
.env
file in the root directory of your project and add the following content:TOKEN=YourDiscordBotToken
Initialize and start the bot with code like this:
const EvecordJS = require("./EvecordJS"); const bot = new EvecordJS(); bot.start();
To start the bot, run the following command:
node your_bot_file.js
Detailed Feature Explanation
Setting Up Message Reactions
You can set up reactions to specific messages using the registerReaction
method:
bot.registerReaction("hello", "Nice to meet you!");
This will make the bot automatically reply "Nice to meet you!" when someone posts "hello" in the chat.
Saving and Loading Reactions
- Configured reactions are automatically saved to a
reactions.json
file. - When the bot restarts, it loads the reactions from this file.
Error Handling
- The bot properly handles issues such as login failures or message sending errors, displaying error messages in the console.
Important Notes
- This bot uses
GatewayIntentBits.MessageContent
, so you need to enable the Message Content Intent in the Discord Developer Portal. - Always manage your bot token securely and be careful not to upload it to public repositories.
Troubleshooting
If the bot doesn't come online:
- Check that the
.env
file is correctly set up. - Verify that the bot token is correct in the Discord Developer Portal.
- Check that the
If the bot doesn't react:
- Check the console logs for error messages.
- Verify that the
reactions.json
file is being generated correctly.
Customization
While this code provides basic functionality, you can extend the EvecordJS
class to add more features if desired. For example, you could add command handling, database integration, webhooks, and more.
Support
If you encounter any issues or need further clarification, please post your questions in the Issues section of this repository.(https://github.com/Emon2358/evecordjs)