A bot for WhatsApp created using a library that simulates real-time WhatsApp Web connection.
This project was developed using the following technologies:
Assuming you already have Node installed.
## 1. Clone the repository
git clone https://github.com/guivictorr/whatsapp-bot.git
## 2. Enter the folder
cd whatsapp-bot
## 3. Install dependencies
pnpm i
## 4. Configure the .env file
## 5. Run the application
pnpm run dev
## 6. Scan the QR code that appears in the terminal
- !gpt [prompt]
- !dalle [prompt]
- !covid state
- !cotacao
- !perfil
- !figurinha
- !eununca
- !membros (Group)
- !perfil @contact (Group)
- !ban @contact (Group)
To create commands, simply create a .ts
file in one of the group
folders for commands valid only in groups or global
for globally valid commands.
Example:
const commandName = async (msg: Message, args: string[]): Promise<Message> => {
// some code
return msg.reply('Hello World'); // return msg.reply(string)
};
export default commandName;
Once the file is created, the command will be functional.
To use the !gpt
and !dalle
commands, you need to add environment variables:
You can obtain these credentials by creating an account on the OpenAI website.
- OPENAI_API_KEY Click here
- OPENAI_ORG_ID Click here
To use the !figurinha command with gifs and videos, it is necessary for you to:
-
Download FFMPEG
-
In the
.env
file, configure theFFMPEG_PATH
environment variable with the path to ffmpeg
💡 You can try using the whereis ffmpeg
command to find the path.
- Fork this repository;
- Create a branch with your feature:
git checkout -b my-feature
; - Commit your changes:
git commit -m 'feat: My new feature'
; - Push to your branch:
git push origin my-feature
.
Once your pull request is merged, you can delete your branch.
This project is not affiliated, associated, authorized, endorsed by, or in any way officially connected with WhatsApp or any of its subsidiaries or affiliates. The official WhatsApp website can be found at https://whatsapp.com. "WhatsApp" as well as names, brands, logos, and related images are registered trademarks of their respective owners.