lc-cn/onebots
About
多平台多协议机器人应用中台网关
Science & EngineeringMeasured star growth
- in 24h
- 0
- in 7 days
- +3
- in 15 days
- +3
- in 1 month
- Collecting history
Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.
README.en.md
OriginalOneBots
A multi-platform, multi-protocol IM bot gateway and framework (TypeScript / Node.js)
One CommonEvent abstraction, many platform adapters, many wire protocols (OneBot / Satori / Milky).
What problem does it solve?
You often want:
One process talks to many IM platforms, and exposes one or more standard protocols to plugins or your own backend—without rewriting glue code per platform.
OneBots provides:
| Layer | Role |
|---|---|
| Adapter | Maps each platform’s events & APIs to CommonEvent + shared Adapter APIs |
| Protocol | Turns CommonEvent into OneBot v11/v12, Satori, Milky wire formats and handles inbound API calls |
@onebots/core |
Accounts, ID map (createId / resolveId), routing, protocol registry |
onebots app |
Config, plugin loading, HTTP/WS gateway, optional Web UI |
Architecture (high level)
flowchart LR
subgraph IM["IM platforms"]
A1[QQ / WeChat / Feishu / …]
end
subgraph OB["OneBots"]
B[Adapter]
C[Account + id_map]
D[Protocol]
end
subgraph Down["Consumers"]
E[OneBot clients]
F[Satori / Milky clients]
G[Your services]
end
A1 --> B --> C --> D
D --> E
D --> F
D --> G
Who it is / isn’t for
Good fit if you:
- Need multiple IM platforms and a unified internal event model before exporting to protocols
- Want multiple protocols on the same account (e.g. OneBot + Satori) for different ecosystems
- Prefer Node.js ≥24 (
.node-versionrecommended) / TypeScript and a self-hosted gateway
Maybe not if you:
- Only target one platform with one official SDK (e.g. Discord.js only)—that can be simpler
- Rely heavily on Python stacks (e.g. NoneBot plugins)—stay there or bridge explicitly
Comparison (neutral)
| Aspect | Raw platform SDKs | Other bot frameworks | OneBots |
|---|---|---|---|
| Multi-platform abstraction | DIY | Often yes | CommonEvent + adapters |
| Multi-protocol export | DIY | Varies | Same account, multiple protocols |
| Stack | Any | Often Python/TS | TS / ESM / pnpm monorepo |
| Ecosystem size | — | Some larger | Infrastructure-style; grows with contributors |
Features (summary)
- 20+ adapters: QQ official, ICQQ, WeChat OA, DingTalk, Feishu, WeCom, Telegram, Slack, Discord, Kook, Teams, Line, Email, WhatsApp, Zulip, Matrix, Google Chat, Facebook Messenger, Mock, …
- Protocols: OneBot v11/v12, Satori v1, Milky v1
- Monorepo:
pnpm workspace(packages/*,adapters/*,protocols/*) - Optional Web UI:
@onebots/web - Client SDKs:
imhelper+@imhelper/* - Event flow:
account.dispatch(commonEvent)→ eachprotocol.dispatch
Quick start
A) Docker (recommended)
Mount a data volume or config is lost on restart:
docker run -d -p 6727:6727 -v $(pwd)/data:/data --name onebots ghcr.io/lc-cn/onebots:master
See Docker guide.
B) npm installation
Install the management program, register its user-level OS service, then start it:
pnpm add onebots
npx onebots install --data-dir ./data
npx onebots start
npx onebots status
The empty installation exposes the management console without creating a platform account or enabling a protocol. Generate a one-time device code and pair the browser:
npx onebots auth bootstrap --data-dir ./data
Use the Web Install dependencies page to select adapters, output protocols and framework integrations. OneBots installs required peers into an immutable runtime generation, verifies it, and activates it only after confirmation. The terminal uses the same control API:
npx onebots ui --data-dir ./data --setup
Use --system with lifecycle commands for a system-level service. doctor diagnoses the installed manager and gateway; update plans or installs gateway runtime updates. The gateway can stop or fail while the management console remains available.
C) From source
git clone https://github.com/lc-cn/onebots.git
cd onebots
pnpm install
pnpm dev
pnpm build && pnpm test
Requires Node.js ≥ 24.
Production usage
Persist the management workspace, install extensions through the Web/TUI installation plan, then create and validate account and protocol configuration in the management console. Do not add packages directly to the active runtime or pass the removed -r, -p and -c flags. Full reference: documentation.
Downstream imhelper clients: Client SDK guide.
Repo layout
packages/core—@onebots/corepackages/onebots— CLI & gatewaypackages/web— Web adminpackages/imhelper— client SDK coreadapters/*—@onebots/adapter-*protocols/*—@onebots/protocol-*+@imhelper/*SDKsdocs/— VitePress source
More: packages/core/ARCHITECTURE.md
Contributing
pnpm build
pnpm test
pnpm changeset
License
Acknowledgements
If OneBots helps you, consider a ⭐ on GitHub.
Made with ❤️ by 凉菜 & contributors
Explore related projects
Loading…