qqbot配置并管理QQ官方机器人,支持身份认证、IP白名单设置、Webhook/WebSocket连接及OpenClaw AI集成。
Install via ClawdBot CLI:
clawdbot install byzgpc/qqbotQQ 官方机器人 (QQ Bot) 完整配置教程,包含从创建机器人到接入 OpenClaw AI 的全过程,以及常见问题排查。
⚠️ 重要: AppSecret 只显示一次,立即保存!
家庭宽带需要公网 IP,并配置到 QQ 开放平台。
curl https://api.ipify.org
⚠️ 注意: 家庭宽带 IP 会定期变化,需要及时更新白名单,否则会出现错误 11298。
在 openclaw.json 中添加 QQ 频道配置:
{
"channels": {
"qq": {
"enabled": true,
"appId": "你的AppID",
"appSecret": "你的AppSecret"
}
}
}
复制 qq_official_bot.py 到工作区:
cp qq_official_bot.py ~/.openclaw/workspace/
编辑配置文件:
APP_ID = "你的AppID"
APP_SECRET = "你的AppSecret"
# 启动 QQ Bot
~/.openclaw/workspace/qq_bot_daemon.sh start
# 查看状态
~/.openclaw/workspace/qq_bot_daemon.sh status
# 查看日志
tail -f ~/.openclaw/workspace/qq_bot.log
现象:
获取 Token 失败: 11298
接口访问源IP不在白名单
原因:
解决方案:
curl https://api.ipify.org长期方案:
现象:
原因 1: Intents 权限未开启
解决方案:
原因 2: 事件订阅方式错误
解决方案:
确认选择了「使用长连接接收事件」(WebSocket 模式),而不是 HTTP 回调。
原因 3: 机器人未添加好友/进群
解决方案:
现象:
ModuleNotFoundError: No module named 'requests'
ModuleNotFoundError: No module named 'aiohttp'
解决方案:
pip3 install requests aiohttp websockets --user
现象:
✅ 鉴权成功!
Session ID: xxx
💓 心跳确认
但没有收到 C2C_MESSAGE_CREATE 或 AT_MESSAGE_CREATE 事件。
原因: Intents 值配置错误
解决方案:
使用正确的 Intents 组合:
INTENTS = (1 << 0) | (1 << 25) | (1 << 30)
# GUILDS | GROUP_AND_C2C_EVENT | AT_MESSAGES
现象:
⏳ 等待 OpenClaw AI 回复...
抱歉,AI 响应超时
原因: AI 处理器未运行或响应太慢
解决方案:
~/.openclaw/workspace/
├── qq_official_bot.py # QQ Bot 主程序
├── qq_bot_daemon.sh # 启动管理脚本
├── qq_bot.log # 运行日志
├── qq_queue/ # 消息队列目录
│ ├── ai_request_*.json # AI 请求
│ └── ai_response_*.txt # AI 回复
└── qq_ai_handler.sh # AI 处理器
# 启动
~/.openclaw/workspace/qq_bot_daemon.sh start
# 停止
~/.openclaw/workspace/qq_bot_daemon.sh stop
# 重启
~/.openclaw/workspace/qq_bot_daemon.sh restart
# 查看状态
~/.openclaw/workspace/qq_bot_daemon.sh status
# 查看日志
tail -f ~/.openclaw/workspace/qq_bot.log
tail -f ~/.openclaw/workspace/qq_bot.log | grep -E "连接|心跳|收到"
tail -f ~/.openclaw/workspace/qq_bot.log | grep "收到事件"
# 创建测试请求
echo '{"request_id":"test","message":"你好"}' > ~/.openclaw/workspace/qq_queue/ai_request_test.json
# 创建回复
echo "你好!我是小皮" > ~/.openclaw/workspace/qq_queue/ai_response_test.txt
维护者: 小皮 🦊
版本: 1.0.0
更新时间: 2026-02-23
Generated Feb 25, 2026
Small businesses can deploy this QQ bot to handle common customer inquiries on QQ groups or private chats, providing instant responses to FAQs like business hours, product details, or order status. It integrates with OpenClaw AI to generate personalized replies, reducing manual workload and improving response times.
Gaming communities on QQ can use this bot to automate announcements, moderate chats, and engage members with AI-driven conversations about game strategies or events. It helps maintain active participation by responding to @mentions and private messages in real-time.
Educational institutions or tutors can implement this bot to answer student questions on QQ groups, provide study tips, or schedule sessions via AI interactions. It supports continuous learning by handling queries outside class hours and integrating with custom educational content.
Companies can use this bot within internal QQ groups to facilitate team communication, automate task reminders, and provide quick answers to HR or IT queries. It enhances productivity by reducing email clutter and enabling seamless AI-assisted workflows.
Offer a managed service where businesses pay a monthly fee to host and maintain the QQ bot, including updates, IP management, and technical support. Revenue comes from tiered plans based on usage levels or features like advanced AI customization.
Provide consulting and development services to customize the bot for specific client needs, such as integrating with proprietary systems or adding specialized AI modules. Revenue is generated through one-time project fees or ongoing maintenance contracts.
Deploy a free version of the bot with basic functionalities, while charging for premium features like analytics dashboards, multi-bot management, or priority support. This model attracts small users and upsells to larger enterprises seeking enhanced capabilities.
💬 Integration Tip
Ensure your server has a stable public IP or use cloud hosting to avoid frequent IP changes, and regularly update QQ platform settings like Intents permissions for reliable message reception.
Captures learnings, errors, and corrections to enable continuous improvement. Use when: (1) A command or operation fails unexpectedly, (2) User corrects Clau...
Helps users discover and install agent skills when they ask questions like "how do I do X", "find a skill for X", "is there a skill that can...", or express interest in extending capabilities. This skill should be used when the user is looking for functionality that might exist as an installable skill.
Search and analyze your own session logs (older/parent conversations) using jq.
Typed knowledge graph for structured agent memory and composable skills. Use when creating/querying entities (Person, Project, Task, Event, Document), linking related objects, enforcing constraints, planning multi-step actions as graph transformations, or when skills need to share state. Trigger on "remember", "what do I know about", "link X to Y", "show dependencies", entity CRUD, or cross-skill data access.
Ultimate AI agent memory system for Cursor, Claude, ChatGPT & Copilot. WAL protocol + vector search + git-notes + cloud backup. Never lose context again. Vibe-coding ready.
Headless browser automation CLI optimized for AI agents with accessibility tree snapshots and ref-based element selection