How wangrongding/wechat-bot works
WeChat Bot is a command-line IM agent and local-WeChat analysis tool. Its main reply flow is an IM event through a channel agent, optional message capture, a selected AI service, and a reply sent back through that channel. Separate workflows operate Lark messages, invoke OpenCLI for local WeChat data, and analyze chat data with statistics or AI. The README documents these capabilities, but most platform-agent and analysis implementations were not sampled, so their internal call wiring is shown only where documented or evidenced by the CLI excerpt.
Main entry points: src Reply service dispatch · index.js CLI commands · adapters IM APIs · bot.js WeChat agent
Components 24
Command entry
- CLI commands
src/index.js - Runtime config
src/config/env.js
IM channels
- WeChat agent
src/platforms/wechat/bot.js - WeChat message store
src/platforms/wechat/messageStore.js - Lark agent
src/platforms/lark/agent.js - Lark message store
src/platforms/lark/messageStore.js - Telegram agent
src/platforms/telegram/agent.js - Telegram message store
src/platforms/telegram/messageStore.js - WhatsApp agent
src/platforms/whatsapp/agent.js - WhatsApp message store
src/platforms/whatsapp/messageStore.js - IM APIs
src/adapters - Lark operations
src/adapters/lark.js
AI services
Local data
- OpenCLI adapter
src/adapters/opencli.js - Chat analyzer
src/analysis/wechatAnalyzer.js
Other components
- User
- IM users
- Model APIs
- Local WeChat tools
- Local chat data
- Lark API
- Telegram Bot API
- WhatsApp Cloud API
Connections 41
- User → CLI commands: runs commands
- CLI commands → Runtime config: loads settings
- CLI commands → WeChat agent: starts agent
- CLI commands → Lark agent: starts agent
- CLI commands → Telegram agent: starts agent
- CLI commands → WhatsApp agent: starts agent
- CLI commands → Lark operations: invokes operations
- CLI commands → OpenCLI adapter: runs local tools
- CLI commands → Chat analyzer: requests analysis
- WeChat agent → Reply service dispatch: requests reply
- Lark agent → Reply service dispatch: requests reply
- Telegram agent → Reply service dispatch: requests reply
- WhatsApp agent → Reply service dispatch: requests reply
- Reply service dispatch → Model providers: selects service
- Model providers → Model APIs: sends prompt
- Model APIs → Model providers: returns reply
- Model providers → Reply service dispatch: returns reply
- Reply service dispatch → WeChat agent: returns reply
- Reply service dispatch → Lark agent: returns reply
- Reply service dispatch → Telegram agent: returns reply
- Reply service dispatch → WhatsApp agent: returns reply
- IM users → WeChat agent: sends messages
- IM users → Lark agent: sends events
- IM users → Telegram agent: sends messages
- IM users → WhatsApp agent: sends webhooks
- WeChat agent → WeChat message store: captures messages
- Lark agent → Lark message store: stores messages
- Telegram agent → Telegram message store: stores messages
- WhatsApp agent → WhatsApp message store: stores messages
- WeChat agent → IM APIs: sends replies
- Lark agent → IM APIs: sends replies
- Telegram agent → IM APIs: sends replies
- WhatsApp agent → IM APIs: sends replies
- IM APIs → Lark API: uses
- IM APIs → Telegram Bot API: uses
- IM APIs → WhatsApp Cloud API: uses
- Lark operations → Lark API: reads and sends
- OpenCLI adapter → Local WeChat tools: invokes
- Local WeChat tools → Local chat data: reads cached data
- Chat analyzer → Local chat data: analyzes chats
- Chat analyzer → Reply service dispatch: requests AI analysis