https://github.com/hendraaagil/gilbot-whatsapp
WhatsApp bot (https://gilbot.hendraaagil.dev/) source code.
https://github.com/hendraaagil/gilbot-whatsapp
bot nodejs whatsapp-bot whatsapp-web whatsapp-web-js
Last synced: 2 months ago
JSON representation
WhatsApp bot (https://gilbot.hendraaagil.dev/) source code.
- Host: GitHub
- URL: https://github.com/hendraaagil/gilbot-whatsapp
- Owner: hendraaagil
- License: mit
- Created: 2023-05-09T10:19:13.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-11-02T15:01:54.000Z (over 1 year ago)
- Last Synced: 2025-12-10T04:22:21.360Z (7 months ago)
- Topics: bot, nodejs, whatsapp-bot, whatsapp-web, whatsapp-web-js
- Language: TypeScript
- Homepage:
- Size: 748 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/funding.yml
- License: LICENSE
Awesome Lists containing this project
README
# GilBot WhatsApp
This is the source code for the WhatsApp bot. Since there is an issue with the WhatsApp policy, I make this project open source. Feel free to deploy on your own or add more features. Don't forget to give credit to this repository.

## Project Structure
### [GitHub workflow](.github/workflows/deploy.yml)
This is for continuous deployment to VPS with [pm2](https://pm2.keymetrics.io/).
### [Prisma ORM](prisma)
This is for configure the database (schema, migrations, seeders) with [Prisma](https://www.prisma.io/).
### [Main source](src)
#### [Assets](src/assets)
Store any assets which will be sent to the user.
#### [Commands](src/commands)
Store all available bot commands.
#### [Events](src/events)
Store action for registered events. Currently it only listen to message event, because all of the commands is based on message sent from the user.
#### [Libs](src/libs)
All of the utilities should be stored in here.
#### [Types](src/types)
Store type definition files.
## Command flow
If you checked on the all files in [commands](src/commands) folder, the command is separated into 2 types:
- Command without `requireLock`
```mermaid
flowchart LR
A([Start]) --> |User sends 'message'| B[Parse Message]
B --> C{Is the message
registered as a command?}
C --> |Yes| D["Run command.execute()"]
C --> |No| E["Run default command"]
D --> F
E --> F
F[Send Response] --> G
G([End])
```
- Command with `requireLock`
```mermaid
flowchart LR
A([Start]) --> |User sends 'message'| B[Parse Message]
B --> C{Is message
registered as command?}
C --> |Yes| D["Run command.execute()"] --> I[Create/Update Current Command]
C --> |No| E["Run default command"]
I --> |User sends parameters| H["Run command.generate()"]
H --> F[Send Response] --> J[Reset Current Command]
E --> K[Send Response]
J --> G([End])
K --> G
```
This `requireLock` configuration can be found in the [prisma data](prisma/data/commands.ts).
## Development setup
This project require Node.js version `>=16.x` and `yarn` package manager. All available scripts can be found in [package.json](package.json)
## License
This project is under [MIT License](LICENSE).