📤 QQ Bot 文件发送工具
快速开始指南
安装
此skill已经创建完成,无需安装(qqbot扩展已内置)。
快速使用
方式1:在Agent中调用
import { sendQQFile } from "/root/.openclaw/workspace/skills/qqbot-file-sender/index.js";
// 发送本地图片到私聊
await sendQQFile({
targetId: "33558EFB7CF362DA4A894FBE2E93DFDE",
targetType: "c2c",
fileType: "image",
filePath: "/path/to/image.jpg",
content: "这是您的图片"
});
方式2:通过OpenClaw命令运行
openclaw run --skill qqbot-file-sender --params '{
"targetId": "33558EFB7CF362DA4A894FBE2E93DFDE",
"targetType": "c2c",
"fileType": "image",
"filePath": "/path/to/image.jpg",
"content": "测试发送图片"
}'
方式3:使用便捷函数
import { sendQQImageToUser, sendQQImageToGroup } from "/root/.openclaw/workspace/skills/qqbot-file-sender/index.js";
// 发送图片到用户
await sendQQImageToUser(userId, "/path/to/image.jpg", "说明文字");
// 发送图片到群聊
await sendQQImageToGroup(groupId, "https://example.com/image.png", "说明文字");
参数说明
| 参数 | 说明 | 示例 |
|---|---|---|
| targetId | 用户或群组OpenID | "33558EFB7CF362DA4A894FBE2E93DFDE" |
| targetType | c2c(私聊)或group(群聊) |
"c2c" |
| fileType | image, video, voice |
"image" |
| filePath | 本地文件路径(与fileUrl二选一) | "/path/to/file.jpg" |
| fileUrl | 网络文件URL(与filePath二选一) | "https://example.com/file.jpg" |
| content | 附加文字说明(可选) | "这是图片说明" |
支持功能
✅ 私聊发送文件
✅ 群聊发送文件
✅ 本地文件上传
✅ 网络URL上传
✅ 图片、视频、语音
❌ 普通文件(暂未开放)
注意事项
- 用户OpenID:就是system prompt中的openid,如
33558EFB7CF362DA4A894FBE2E93DFDE - 群组OpenID:需要从群聊消息中获取(目前只支持私聊,群聊功能待测试)
- 文件大小:建议图片≤10MB,视频≤100MB
- 网络URL:必须是公网可访问的URL
遇到的问题?
Q: 获取AccessToken失败
A: 确保已配置QQ Bot:
openclaw channels add --channel qqbot --token "AppID:AppSecret"
Q: FILE类型无法发送
A: QQ Bot API暂未开放普通文件类型,仅支持图片、视频、语音
Q: 群聊无法发送
A: 当前沙箱环境仅支持私聊(C2C),群聊功能可能需要正式发布
查看完整文档
详细API文档请查看:/root/.openclaw/workspace/skills/qqbot-file-sender/SKILL.md
运行示例:/root/.openclaw/workspace/skills/qqbot-file-sender/examples.ts