78 lines
2.2 KiB
Markdown
78 lines
2.2 KiB
Markdown
# wauto 🤖
|
|
|
|
A WhatsApp bot built with TypeScript, [Baileys](https://github.com/WhiskeySockets/Baileys), and [Sharp](https://sharp.pixelplumbing.com/).
|
|
|
|
## Features
|
|
- `!ping` - Responds with pong
|
|
- `!time` - Current time in WIB (Asia/Jakarta)
|
|
- `!echo <text>` - Echoes your message
|
|
- `!sticker` / `!stiker` / `!s` - Converts sent or quoted image/video/sticker into a WhatsApp sticker
|
|
- `!help` - Displays command list
|
|
|
|
---
|
|
|
|
## Local Development
|
|
|
|
1. Install dependencies:
|
|
```bash
|
|
npm install
|
|
```
|
|
|
|
2. Run in development mode (with auto-reload):
|
|
```bash
|
|
npm run dev
|
|
```
|
|
|
|
3. Build and run production build:
|
|
```bash
|
|
npm run build
|
|
npm start
|
|
```
|
|
|
|
---
|
|
|
|
## CI / CD with Gitea Actions
|
|
|
|
The repository includes automated CI/CD configured in [`.gitea/workflows/ci-cd.yaml`](.gitea/workflows/ci-cd.yaml):
|
|
|
|
1. **CI (Continuous Integration)**:
|
|
- Triggers on every `push` and `pull_request` targeting `main`.
|
|
- Runs `npm ci` and `npm run build` (TypeScript compilation & type checking).
|
|
|
|
2. **CD (Continuous Delivery)**:
|
|
- Triggers on `push` to `main` and version tags (`v*`).
|
|
- Builds a production-ready, multi-stage Docker container.
|
|
- Pushes the image to the Gitea Container Registry:
|
|
```
|
|
git.hrkm.my.id/hira/wauto:latest
|
|
```
|
|
|
|
### Authentication for Gitea Actions Runner
|
|
The workflow uses `${{ secrets.GITEA_TOKEN || secrets.GITHUB_TOKEN }}`.
|
|
- If your Gitea instance has Actions package permissions enabled, `${{ secrets.GITHUB_TOKEN }}` works automatically.
|
|
- Alternatively, you can add a repository secret named `GITEA_TOKEN` with a Personal Access Token (`read:package`, `write:package`).
|
|
|
|
---
|
|
|
|
## Deployment with Docker Compose
|
|
|
|
Deploy the bot on your server using the included [`docker-compose.yml`](docker-compose.yml):
|
|
|
|
1. Log in to Gitea Container Registry on your server:
|
|
```bash
|
|
docker login git.hrkm.my.id
|
|
```
|
|
|
|
2. Pull and start the container:
|
|
```bash
|
|
docker compose pull
|
|
docker compose up -d
|
|
```
|
|
|
|
3. Scan the WhatsApp QR code to link your account:
|
|
```bash
|
|
docker compose logs -f
|
|
```
|
|
|
|
> **Important**: The `./auth` directory is mounted into `/app/auth` inside the container so your session login credentials persist across container restarts and updates.
|