Skip to content
dngdaPublic

About

Typescript - Lightweights WhatsApp bot πŸ€– made to response only self message with Baileys ✨

Topics

Resources

Stars

27 stars

Watchers

1 watching

Forks

Repository files navigation


πŸ€– Typescript - Lightweight WhatsApp bot using Baileys Library



Quality
    Gate Status Code Smells Security Rating

Getting Started

Trakteer Saya Trakteer Saya

Prerequisite

  • Star this repository 🌟
  • Node.js v20+ (recommended v22+) and pnpm
  • ffmpeg installed 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-exec runs the bundled yt-dlp, which requires it). After upgrading Python, run pnpm rebuild youtube-dl-exec to refresh yt-dlp

How to

Clone this project or download zip:

git clone https://github.com/dngda/self-bot
cd self-bot

Install the dependencies and Chromium browser binary:

pnpm install
pnpm exec playwright install chromium

Setup your .env file:

cp .env.sample .env

Fill .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 via onnxruntime-node using briaai/RMBG-1.4 (no API key needed). On first use, the quantized model (~44 MB) is automatically downloaded and cached in data/models/rmbg-1.4-quantized.onnx.

Usage

Run directly with tsx (without compiling):

pnpm start

Development mode (auto-reload with nodemon + tsx):

pnpm dev

Or compile TypeScript to build/ and run with Node / PM2:

pnpm build
node build/index.js
# or with PM2:
pm2 start ecosystem.config.js

After 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.

Exposed HTTP API

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 schema
  • POST /send β€” send a message with { "jid": "628xxx@s.whatsapp.net", "content": { "text": "Hello" }, "options": {} }

Features

Sticker & Image

  • Sticker Creator (sticker / s) using WA-Sticker-Formatter β€” supports images, videos (auto-compressed ≀ 1 MB), APNG, media URLs, rounded (-r), cropped (-c), custom packname|author, and local AI background removal (-nobg) powered by onnxruntime-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)

Media & Downloader

  • Social Media Video Downloader (vdl / v) powered by yt-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 via con oneview)

Tools & Productivity

  • 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> via mathjs)

Browser & Islam

  • Web Search Screenshots via Playwright (ddg / q for DuckDuckGo, gsrc / g for 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)

General, Random & Owner

  • 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-chat allow/deny/disb/ensb, dynamic setprefix/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 πŸ™

Thanks to

About

Typescript - Lightweights WhatsApp bot πŸ€– made to response only self message with Baileys ✨

Topics

Resources

Stars

27 stars

Watchers

1 watching

Forks

Releases

Sponsor this project

Used by

Contributors

Languages