VENOCYBER AI is a WhatsApp chatbot built using the whatsapp-web.js
library, allowing users to interact with an intelligent chatbot powered by GPT (ChatGPT) and create DALL·E-generated images. This README provides a comprehensive explanation of the code structure and functionality.
- WhatsApp Integration: Utilizes
whatsapp-web.js
to connect to the WhatsApp Web platform, enabling the bot to send and receive messages. - GPT Integration: Communicates with the ChatGPT API to generate responses based on user input.
- DALL·E Integration: Generates images using the DALL·E API in response to specific commands.
- Node.js and npm installed on your machine.
- WhatsApp account and a phone with an active internet connection.
-
Clone the repository:
git clone https://github.com/kingjux/Venocyber-AI.git
-
Navigate to the project directory:
cd Venocyber-AI
-
Install dependencies:
npm install
-
Create a
.env
file in the root directory with the following content:CHATGPT_API_URL=https://guruapi.tech/api/chatgpt DALLE_API_URL=https://aemt.me/dalle
Replace the URLs with the actual endpoints you want to use.
-
Run the application:
npm start
-
Scan the QR code displayed with your WhatsApp Web to authenticate.
The script initializes the WhatsApp client and sets up event listeners for authentication, QR code display, and readiness.
Environment variables are used to configure the URLs for the ChatGPT and DALL·E APIs. This allows for easy modification without altering the code.
const apiUrl = `${process.env.CHATGPT_API_URL}?text=${encodeURIComponent(text)}`;
The message
event listener handles incoming messages. It checks for specific commands, interacts with APIs, and sends appropriate responses.
The getChatGPTResponse
function makes a request to the ChatGPT API and processes the response.
The getDALLEImage
function generates images using the DALL·E API in response to the /dalle
command.
Responses are formatted with emojis based on certain conditions or keywords in the reply.
// Add emojis based on conditions or keywords in the response
if (response.toLowerCase().includes("hello")) {
emojiResponse += " 👋";
} else if (response.toLowerCase().includes("thank you")) {
emojiResponse += " 🙏";
}
The script includes error handling to gracefully manage API errors and other exceptions.
- Send messages to the WhatsApp number associated with the bot.
- Use the
/dalle
command to generate DALL·E images based on text input. - Experience intelligent responses generated by ChatGPT.
Feel free to contribute by submitting issues or pull requests. Your feedback and improvements are welcomed!
This project is licensed under the MIT License - see the LICENSE file for details.
- Thanks to the authors of
whatsapp-web.js
for providing a powerful library for WhatsApp Web automation. - Appreciation to OpenAI for ChatGPT and DALL·E APIs.
Happy Chatting with Venocyber Ai! 🤖🚀