Katsumi
WhatsApp Bot using Baileys, MySQL and MongoDB.
Install / Use
/learn @nat9h/KatsumiREADME
Table of Contents
- Overview
- Why Katsumi?
- Feature Matrix
- Quick Start
- Configuration
- Project Structure
- Create a Plugin
- Scripts
- Troubleshooting
- Contributing
- License
Overview
Katsumi is a lean WhatsApp bot framework built on Baileys. Drop a plugin file in src/plugins/ and it becomes a command. Configure via .env, choose MySQL, MongoDB, or a JSON store, and deploy with PM2 or Docker.
Why Katsumi?
- Focused, minimal core
- Plugin‑first design
- MySQL / MongoDB / JSON storage
- Clean developer workflow (ESLint, Prettier, PM2)
Feature Matrix
| Area | Capability | Status |
| --------------- | -------------------------------- | :----: |
| Core | Baileys socket + message router | ✅ |
| Plugins | File‑based, auto‑loaded commands | ✅ |
| Storage | MySQL / MongoDB / JSON | ✅ |
| Config | Centralized .env | ✅ |
| DX | ESLint, Prettier, scripts | ✅ |
| Process Manager | PM2 ecosystem.config.cjs | ✅ |
| Docker | Example snippet (below) | ▶️ |
Quick Start
git clone https://github.com/nat9h/Katsumi.git
cd Katsumi
npm install
cp .env.example .env
Edit .env, then run:
npm run dev # development
npm start # production
npm run pm2 # PM2 process
On first run, scan the QR code or Pairing code with WhatsApp.
Configuration
| Variable | Description | Example / Default | | ---------------- | ------------------------------------ | ---------------------------------- | | MYSQL_HOST | MySQL host | localhost | | MYSQL_PORT | MySQL port | 3306 | | MYSQL_USER | MySQL user | root | | MYSQL_PASSWORD | MySQL password | password | | MYSQL_DATABASE | MySQL database name | baileys | | USE_MONGO | Use MongoDB for storage (true/false) | false | | MONGO_URI | MongoDB connection string | mongodb://localhost:27017/database | | BOT_SESSION_NAME | Session storage identifier | session | | BOT_PREFIXES | Comma‑separated command prefixes | !,.,? |
Notes:
- When
USE_MONGO=true, ensureMONGO_URIis reachable. - If neither MySQL or MongoDB is enabled, Katsumi falls back to a JSON store.
Docker (optional)
# Dockerfile (example)
FROM node:20-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci --omit=dev
COPY . .
CMD ["npm","start"]
# Build & run
docker build -t katsumi .
docker run --env-file .env --name katsumi --restart unless-stopped katsumi
Project Structure
Katsumi/
├───src
│ ├───config
│ ├───core
│ ├───lib
│ │ ├───auth
│ │ ├───clonebot
│ │ ├───database
│ │ │ └───models
│ │ ├───schema
│ │ └───scraper
│ ├───plugins
│ └───utils
│ └───API
├─ ecosystem.config.cjs
├─ eslint.config.mjs
├─ .env.example
├─ package.json
└─ README.md
Create a Plugin
Create src/plugins/ping.js:
import os from "os";
import { performance } from "perf_hooks";
export default {
name: "ping",
description: "Show latency and host info",
command: ["ping", "p"],
permissions: "all", // all | admin | owner
category: "info",
cooldown: 0,
async execute(m) {
const t0 = performance.now();
const total = (os.totalmem() / 1024 ** 3).toFixed(2);
const free = (os.freemem() / 1024 ** 3).toFixed(2);
await m.reply(
`PONG
` +
`Latency: ${(performance.now() - t0).toFixed(2)}ms
` +
`CPU: ${os.cpus().length} cores
` +
`RAM: ${free} / ${total} GB`
);
},
};
Plugin Options
| Option | Description | Example | | ----------- | ----------------------------- | ----------------------- | | command | Triggers | ["ping", "p"] | | permissions | Access level | "all", "admin", "owner" | | category | Help grouping | "info" | | cooldown | Cooldown in seconds | 0 | | group | Group chats only (optional) | true / false | | private | Private chats only (optional) | true / false |
Scripts
npm run dev # watch mode
npm run lint # eslint
npm run prettier # format
Troubleshooting
-
YouTube downloads fail with "Signature solving failed" or "Requested format is not available"
This meansyt-dlpcannot solve YouTube's JavaScript challenges. You must set up a JavaScript runtime and enable EJS components:- Install Deno (recommended):
curl -fsSL https://deno.land/install.sh | sh - Ensure
yt-dlpis updated (latest):
oryt-dlp --update-to nightly
python -m pip install -U --pre "yt-dlp[default]"The
[default]extra installsyt-dlp-ejs(challenge solver scripts).- OR use remote EJS (if you can't install
yt-dlp-ejs): Add to~/.config/yt-dlp/config:
Test with:--js-runtimes deno --remote-components ejs:npm
yt-dlp --js-runtimes deno --remote-components ejs:npm -f "bestaudio" "https://youtu.be/mzB1VGEGcSU" - Install Deno (recommended):
-
No QR: widen the terminal and check network; pairing code mode is supported.
-
MySQL auth errors: verify host/user/password and database.
-
Mongo errors: verify
MONGO_URIand thatUSE_MONGO=true. -
Session issues: change
BOT_SESSION_NAMEand re‑login.
Contributing
Fork, create a feature branch, run lint, open a pull request with a clear description.
License
MIT. See LICENSE.
Related Skills
feishu-drive
348.2k|
things-mac
348.2kManage Things 3 via the `things` CLI on macOS (add/update projects+todos via URL scheme; read/search/list from the local Things database)
clawhub
348.2kUse the ClawHub CLI to search, install, update, and publish agent skills from clawhub.com
postkit
PostgreSQL-native identity, configuration, metering, and job queues. SQL functions that work with any language or driver
