π€ Typescript - Lightweight WhatsApp bot using Baileys Library
- Star this repository π
- Node.js
v20+(recommendedv22+) andpnpm ffmpeginstalled globally (required for animated stickers, video splitting, audio conversion, and voice notes)- Playwright Chromium (
pnpm exec playwright install chromium) for browser-based search screenshots Python 3.11+(python3 --version) for the video downloader (youtube-dl-execruns the bundledyt-dlp, which requires it). After upgrading Python, runpnpm rebuild youtube-dl-execto refreshyt-dlp
Clone this project or download zip:
git clone https://github.com/dngda/self-bot
cd self-botInstall the dependencies and Chromium browser binary:
pnpm install
pnpm exec playwright install chromiumSetup your .env file:
cp .env.sample .envFill .env with your configuration:
| Variable | Required | Description |
|---|---|---|
OWNER_JID / OWNER_LID |
Yes | Owner WhatsApp JID (628xxx@s.whatsapp.net) and LID (xxx@lid) |
PREFIX |
Yes | Command prefix or regex character class (default [.!:>]) |
PACKNAME / AUTHOR |
Yes | Default WhatsApp sticker pack name and author |
DEBUG_RAW |
No | Set true to log raw incoming messages |
EXPOSED_API_KEY |
For HTTP API | Bearer / x-api-key secret for the exposed Hono API (http://localhost:3333/send) |
OCR_API_KEY |
For ocr |
API key from ocr.space |
IMGBB_API_KEY |
For quotly media |
API key from imgbb for uploading quoted images/stickers |
GENIUS_API_KEY |
For lyrics |
API key from Genius |
QUOTLY_SERVER |
No | Custom Quotly server URL (defaults to http://localhost:4888) |
EXT_SCRIPT_PATH |
No | Directory containing external .php scripts for exec / run |
REMOVEBG_MODEL_PATH |
No | Custom local path for the ONNX model (default data/models/rmbg-1.4-quantized.onnx) |
REMOVEBG_MODEL_URL |
No | Custom download URL for the ONNX model |
REMOVEBG_IDLE_TIMEOUT_MS |
No | Unload ONNX session after idle ms to save RAM (default 300000, 0 to keep loaded) |
Note on Background Removal (
-nobg): Background removal runs 100% locally viaonnxruntime-nodeusingbriaai/RMBG-1.4(no API key needed). On first use, the quantized model (~44 MB) is automatically downloaded and cached indata/models/rmbg-1.4-quantized.onnx.
Run directly with tsx (without compiling):
pnpm startDevelopment mode (auto-reload with nodemon + tsx):
pnpm devOr compile TypeScript to build/ and run with Node / PM2:
pnpm build
node build/index.js
# or with PM2:
pm2 start ecosystem.config.jsAfter running it, scan the QR code shown in the terminal to link your WhatsApp account.
On startup, the bot fetches the latest WhatsApp Web version (falling back to the version bundled with Baileys if the fetch fails), initializes Playwright, restores scheduled reminders, and starts the exposed HTTP API on port 3333.
An authenticated Hono server runs on http://localhost:3333 for sending WhatsApp messages programmatically (authenticate with Authorization: Bearer <EXPOSED_API_KEY> or x-api-key: <EXPOSED_API_KEY>):
GET /sendβ inspect payload schemaPOST /sendβ send a message with{ "jid": "628xxx@s.whatsapp.net", "content": { "text": "Hello" }, "options": {} }
- Sticker Creator (
sticker/s) using WA-Sticker-Formatter β supports images, videos (auto-compressed β€ 1 MB), APNG, media URLs, rounded (-r), cropped (-c), custompackname|author, and local AI background removal (-nobg) powered byonnxruntime-node(briaai/RMBG-1.4, with automatic hole-filling for outlined white cartoons/stickers) - Auto-Sticker per chat (
con autosticker this) and Sticker Commands (scmd/dscmd) - Text to Sticker (
make/makec), Emoji Kitchen (combine/c), Quotly message bubble stickers (quotly/qc/qcf), and Sticker to Image/Video (toimg/tomedia) - Meme Caption rendered locally with
canvas(memefy/sm) - Image Tools β flip/flop (
flip/flop), AI HD upscale & enhance (hd), and watermark removal (removewm/rwm/rwmhd)
- Social Media Video Downloader (
vdl/v) powered byyt-dlp(youtube-dl-exec) β supports TikTok, Instagram/Reels, Twitter/X, and YouTube - Pinterest Search (
pint/pin) for images and videos - Video to MP3 (
tomp3/mp3) and Split Video into 30s clips for WA Status (vsplit/split) - OCR image-to-text (
ocr/itt) - View-Once Media recovery (
onev/1v, or auto-forward viacon oneview)
- Notes Database backed by SQLite + Sequelize (
notes/addnote/editnote/delnote) - Scheduled Reminders using cron jobs (
reminders/remind/updatereminder/delreminder/delallreminders) - Interactive Checklist & Sorter (
list/cl,sort) - Google Text-to-Speech voice notes (
say/tts) - Inline Math Calculator (
=<expression>viamathjs)
- Web Search Screenshots via Playwright (
ddg/qfor DuckDuckGo,gsrc/gfor Google) - Song Lyrics Search via Genius (
lyrics/ly) - Jadwal Sholat by Indonesian city/regency (
jsholat/jsh) - Al-Qur'an reader with per-ayah voice note recitation (
surah/quran/recite)
- Group Hide-Tag (
tag/all), Random Reddit Meme (meme/reddit), Dice Roll (roll/r), and Random List Picker (pick) - Anti-Delete Messages & Statuses (
con norevoke,con norevoke_status) + Contact Status Viewer/Downloader (gls/gs) - Access & Prefix Management β self/public mode (
con public), per-chatallow/deny/disb/ensb, dynamicsetprefix/resetprefix/cekprefix, and quote-repeat (-r) - Owner Utilities β JS/JSON eval (
eval/return), message JSON dump (dump), browser context refresh (rbrowser), external PHP script runner (exec/run), startup#script_*notes, and the Exposed HTTP API (/send)
π‘ Leave any feature ideas out in this discussion π
