@sliverp/qqbot 1.4.1 → 1.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.bak.md +261 -0
- package/README.md +72 -214
- package/README.zh.md +115 -0
- package/package.json +2 -1
- package/skills/qqbot-cron/SKILL.md +490 -0
- package/skills/qqbot-media/SKILL.md +138 -0
package/README.bak.md
ADDED
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
# QQ Bot Channel Plugin for Openclaw(Clawdbot/Moltbot)
|
|
4
|
+
|
|
5
|
+
QQ 开放平台 Bot API 的 Openclaw 渠道插件,支持 C2C 私聊、群聊 @消息、频道消息。
|
|
6
|
+
|
|
7
|
+
[](https://www.npmjs.com/package/@sliverp/qqbot)
|
|
8
|
+
[](./LICENSE)
|
|
9
|
+
[](https://bot.q.qq.com/wiki/)
|
|
10
|
+
[](https://github.com/sliverp/openclaw)
|
|
11
|
+
[](https://nodejs.org/)
|
|
12
|
+
[](https://www.typescriptlang.org/)
|
|
13
|
+
|
|
14
|
+
</div>
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## 📸 使用示例
|
|
20
|
+
<div align="center">
|
|
21
|
+
<img width="400" alt="使用示例" src="https://github.com/user-attachments/assets/6f1704ab-584b-497e-8937-96f84ce2958f" />
|
|
22
|
+
<img width="670" height="396" alt="Clipboard_Screenshot_1770366319" src="https://github.com/user-attachments/assets/e21e9292-fb93-41a7-81fe-39eeefe3b01d" />
|
|
23
|
+
|
|
24
|
+
</div>
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## ✨ 功能特性
|
|
29
|
+
|
|
30
|
+
- 🔒 **多场景支持** - C2C 私聊、群聊 @消息、频道消息、频道私信
|
|
31
|
+
- 🖼️ **富媒体消息** - 支持图片收发、文件发送
|
|
32
|
+
- ⏰ **定时推送** - 支持定时任务到时后主动推送
|
|
33
|
+
- 🔗 **URL 无限制** - 私聊可直接发送 URL
|
|
34
|
+
- ⌨️ **输入状态** - Bot 正在输入中状态提示
|
|
35
|
+
- 🔄 **热更新** - 支持 npm 方式安装和热更新
|
|
36
|
+
- 📝 **Markdown** - 支持 Markdown 格式
|
|
37
|
+
- 📝 **Command** - 支持Openclaw原生命令
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## ⭐ Star 趋势
|
|
43
|
+
<div align="center">
|
|
44
|
+
<img width="666" height="464" alt="star-history-202626 (1)" src="https://github.com/user-attachments/assets/01d123b4-f2a7-45b9-b2ed-b7a344497b4a" />
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
</div>
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## 📦 安装
|
|
53
|
+
|
|
54
|
+
### 方式一:腾讯云 Lighthouse 镜像(最简单)
|
|
55
|
+
|
|
56
|
+
[](https://cloud.tencent.com/product/lighthouse)
|
|
57
|
+
|
|
58
|
+
直接使用预装好的腾讯云 Lighthouse 镜像,开箱即用,无需手动安装配置。
|
|
59
|
+
|
|
60
|
+
### 方式二:npm 安装(推荐)
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
openclaw plugins install @sliverp/qqbot@1.3.7
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### 方式三:源码安装
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
git clone https://github.com/sliverp/qqbot.git && cd qqbot
|
|
70
|
+
clawdbot plugins install .
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
> 💡 安装过程需要一些时间,尤其是小内存机器,请耐心等待
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## ⚙️ 配置
|
|
78
|
+
|
|
79
|
+
### 1. 获取 QQ 机器人凭证
|
|
80
|
+
|
|
81
|
+
1. 访问 [QQ 开放平台](https://q.qq.com/)
|
|
82
|
+
2. 创建机器人应用
|
|
83
|
+
3. 获取 `AppID` 和 `AppSecret`(ClientSecret)
|
|
84
|
+
4. Token 格式:`AppID:AppSecret`
|
|
85
|
+
|
|
86
|
+
### 2. 添加配置
|
|
87
|
+
|
|
88
|
+
**交互式配置:**
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
clawdbot channels add
|
|
92
|
+
# 选择 qqbot,按提示输入 Token
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
**命令行配置:**
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
clawdbot channels add --channel qqbot --token "AppID:AppSecret"
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### 3. 手动编辑配置(可选)
|
|
102
|
+
|
|
103
|
+
编辑 `~/.clawdbot/clawdbot.json`:
|
|
104
|
+
|
|
105
|
+
```json
|
|
106
|
+
{
|
|
107
|
+
"channels": {
|
|
108
|
+
"qqbot": {
|
|
109
|
+
"enabled": true,
|
|
110
|
+
"appId": "你的AppID",
|
|
111
|
+
"clientSecret": "你的AppSecret"
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
## 🚀 使用
|
|
121
|
+
|
|
122
|
+
### 启动服务
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
# 后台启动
|
|
126
|
+
clawdbot gateway restart
|
|
127
|
+
|
|
128
|
+
# 前台启动(查看日志)
|
|
129
|
+
clawdbot gateway --port 18789 --verbose
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### CLI 配置向导
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
clawdbot onboard
|
|
136
|
+
# 选择 QQ Bot 进行交互式配置
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
## ⚠️ 注意事项
|
|
142
|
+
|
|
143
|
+
- **群消息**:需要在群内 @机器人 才能触发回复
|
|
144
|
+
- **沙箱模式**:新创建的机器人默认在沙箱模式,需要添加测试用户
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## 🔄 升级
|
|
149
|
+
|
|
150
|
+
### npm 热更新
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
npx -y @sliverp/qqbot@1.3.7 upgrade
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
> 热更新后无需重新配置 AppId 和 AppSecret。该方式Openclaw和Node.js会占用大量内存,小内存机器优先建议使用源码方式热更新
|
|
157
|
+
|
|
158
|
+
### 源码热更新
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
git clone https://github.com/sliverp/qqbot.git && cd qqbot
|
|
162
|
+
|
|
163
|
+
# 运行升级脚本
|
|
164
|
+
bash ./scripts/upgrade.sh
|
|
165
|
+
|
|
166
|
+
# 重新安装
|
|
167
|
+
clawdbot plugins install .
|
|
168
|
+
|
|
169
|
+
# 重新配置
|
|
170
|
+
clawdbot channels add --channel qqbot --token "AppID:AppSecret"
|
|
171
|
+
|
|
172
|
+
# 重启网关
|
|
173
|
+
clawdbot gateway restart
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
升级脚本会自动清理旧版本和配置。
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
---
|
|
182
|
+
|
|
183
|
+
## 📚 版本历史
|
|
184
|
+
|
|
185
|
+
<details>
|
|
186
|
+
<summary><b>v1.4.0</b></summary>
|
|
187
|
+
|
|
188
|
+
- 支持 Markdown 格式
|
|
189
|
+
|
|
190
|
+
</details>
|
|
191
|
+
|
|
192
|
+
<details>
|
|
193
|
+
<summary><b>v1.3.13 - 2026.02.06</b></summary>
|
|
194
|
+
|
|
195
|
+
- ✨ 支持Openclawd内置指令“/compact" , "/new"等(注意,/reset等命令有危险性,非常不建议把Bot拉入群聊)
|
|
196
|
+
- 🐛 修复在一些情况下”正在输入“不生效的问题
|
|
197
|
+
|
|
198
|
+
</details>
|
|
199
|
+
|
|
200
|
+
<details>
|
|
201
|
+
<summary><b>v1.3.0 - 2026.02.03</b></summary>
|
|
202
|
+
|
|
203
|
+
- ✨ 支持图片收发等功能
|
|
204
|
+
- ✨ 支持定时任务到时后主动推送
|
|
205
|
+
- ✨ 支持使用 npm 等方式安装和升级
|
|
206
|
+
- 🐛 优化一些已知问题
|
|
207
|
+
|
|
208
|
+
</details>
|
|
209
|
+
|
|
210
|
+
<details>
|
|
211
|
+
<summary><b>v1.2.5 - 2026.02.02</b></summary>
|
|
212
|
+
|
|
213
|
+
- ✨ 解除 URL 发送限制
|
|
214
|
+
- ✨ 更新 Bot 正在输入中状态
|
|
215
|
+
- ✨ 提供主动推送能力
|
|
216
|
+
- 🐛 优化一些已知问题
|
|
217
|
+
|
|
218
|
+
</details>
|
|
219
|
+
|
|
220
|
+
<details>
|
|
221
|
+
<summary><b>v1.2.2 - 2026.01.31</b></summary>
|
|
222
|
+
|
|
223
|
+
- ✨ 支持发送文件
|
|
224
|
+
- ✨ 支持 openclaw、moltbot 命令行
|
|
225
|
+
- 🐛 修复 health 检查提示问题
|
|
226
|
+
- 🐛 修复文件发送后 clawdbot 无法读取的问题
|
|
227
|
+
|
|
228
|
+
</details>
|
|
229
|
+
|
|
230
|
+
<details>
|
|
231
|
+
<summary><b>v1.2.1</b></summary>
|
|
232
|
+
|
|
233
|
+
- 🐛 解决长时间使用会断联的问题
|
|
234
|
+
- 🐛 解决频繁重连的问题
|
|
235
|
+
- ✨ 增加大模型调用失败后的提示消息
|
|
236
|
+
|
|
237
|
+
</details>
|
|
238
|
+
|
|
239
|
+
<details>
|
|
240
|
+
<summary><b>v1.1.0</b></summary>
|
|
241
|
+
|
|
242
|
+
- 🐛 解决 URL 被拦截的问题
|
|
243
|
+
- 🐛 解决多轮消息发送失败的问题
|
|
244
|
+
- 🐛 修复部分图片无法接收的问题
|
|
245
|
+
- ✨ 增加支持 onboard 配置方式
|
|
246
|
+
|
|
247
|
+
</details>
|
|
248
|
+
|
|
249
|
+
---
|
|
250
|
+
|
|
251
|
+
## 🔗 相关链接
|
|
252
|
+
|
|
253
|
+
- [QQ 机器人官方文档](https://bot.q.qq.com/wiki/)
|
|
254
|
+
- [QQ 开放平台](https://q.qq.com/)
|
|
255
|
+
- [API v2 文档](https://bot.q.qq.com/wiki/develop/api-v2/)
|
|
256
|
+
|
|
257
|
+
---
|
|
258
|
+
|
|
259
|
+
## 📄 License
|
|
260
|
+
|
|
261
|
+
MIT
|
package/README.md
CHANGED
|
@@ -1,267 +1,125 @@
|
|
|
1
|
-
|
|
1
|
+
# QQ
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
QQ is a widely-used instant messaging platform that provides various communication capabilities such as text, voice, images, and files. It supports collaborative scenarios like group chats and channels, making it suitable for both personal communication and team collaboration.
|
|
4
4
|
|
|
5
|
-
QQ
|
|
5
|
+
This integration method connects OpenClaw with a QQ Bot. It utilizes the platform's long-connection event subscription mechanism to receive message and event callbacks, enabling stable and secure message exchange and automation capability integration without exposing a public webhook address.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
[](./LICENSE)
|
|
9
|
-
[](https://bot.q.qq.com/wiki/)
|
|
10
|
-
[](https://github.com/sliverp/moltbot)
|
|
11
|
-
[](https://nodejs.org/)
|
|
12
|
-
[](https://www.typescriptlang.org/)
|
|
7
|
+
# Step 1: Install the QQ Bot Plugin
|
|
13
8
|
|
|
14
|
-
|
|
9
|
+
Install via the OpenClaw plugins command.
|
|
15
10
|
|
|
16
|
-
|
|
11
|
+
```
|
|
12
|
+
openclaw plugins install @sliverp/qqbot@latest
|
|
13
|
+
```
|
|
17
14
|
|
|
18
|
-
|
|
15
|
+
Install from source code:
|
|
19
16
|
|
|
20
|
-
|
|
17
|
+
```
|
|
18
|
+
git clone https://github.com/sliverp/qqbot.git && cd qqbot
|
|
19
|
+
openclaw plugins install .
|
|
20
|
+
```
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
# Step 2: Create a QQ Bot
|
|
23
23
|
|
|
24
|
-
##
|
|
24
|
+
## 1. Register on the QQ Open Platform
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
Go to the official website of the Tencent QQ Open Platform. You cannot log in directly with your personal QQ account by default; you need to register a new QQ Open Platform account.
|
|
27
|
+
<img width="2140" height="1004" alt="1" src="https://github.com/user-attachments/assets/d76a780c-5040-43fb-ac41-5808f975ae4b" />
|
|
27
28
|
|
|
28
|
-
|
|
29
|
+
After the initial registration, follow the platform's instructions to set up a super administrator.
|
|
29
30
|
|
|
30
|
-
|
|
31
|
+
<img width="2556" height="1744" alt="2" src="https://github.com/user-attachments/assets/ad0a54d5-6997-4f52-ae8f-bea71aa11c30" />
|
|
32
|
+
After successfully scanning the QR code with your mobile QQ, proceed to the next step to fill in the relevant entity information.
|
|
31
33
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
- ⏰ **定时推送** - 支持定时任务到时后主动推送
|
|
35
|
-
- 🔗 **URL 无限制** - 私聊可直接发送 URL
|
|
36
|
-
- ⌨️ **输入状态** - Bot 正在输入中状态提示
|
|
37
|
-
- 🔄 **热更新** - 支持 npm 方式安装和热更新
|
|
38
|
-
- 📝 **Markdown** - 支持 Markdown 格式(即将更新)
|
|
34
|
+
Using "Individual" as an example here, follow the prompts to enter your name, ID number, phone number, and verification code, then click continue to proceed to the facial recognition step.
|
|
35
|
+
<img width="2544" height="1744" alt="3" src="https://github.com/user-attachments/assets/b85c11f8-5627-4e08-b522-b38c4929bcb6" />
|
|
39
36
|
|
|
40
|
-
|
|
37
|
+
Use your mobile QQ to scan the QR code for facial recognition.
|
|
38
|
+
<img width="2542" height="1272" alt="4" src="https://github.com/user-attachments/assets/d0db5539-56ef-4189-930f-595348892bef" />
|
|
41
39
|
|
|
42
|
-
|
|
40
|
+
Once the facial recognition review is approved, you can log in to the QQ Open Platform.
|
|
41
|
+
<img width="2356" height="1308" alt="5" src="https://github.com/user-attachments/assets/c1875b27-fefc-4a1c-81ef-863da8b15ec6" />
|
|
43
42
|
|
|
44
|
-
|
|
43
|
+
## 2. Create a QQ Bot
|
|
45
44
|
|
|
46
|
-
|
|
45
|
+
On the QQ Open Platform's QQ Bot page, you can create a bot.
|
|
46
|
+
<img width="2334" height="1274" alt="6" src="https://github.com/user-attachments/assets/8389c38d-6662-46d0-ae04-92af374b61ef" />
|
|
47
|
+
<img width="2316" height="1258" alt="7" src="https://github.com/user-attachments/assets/15cfe57a-0404-4b02-85fe-42a22cf96d01" />
|
|
47
48
|
|
|
48
|
-
|
|
49
|
+
After the QQ Bot is created, you can select it and click to enter the management page.
|
|
50
|
+
<img width="3002" height="1536" alt="8" src="https://github.com/user-attachments/assets/7c0c7c69-29db-457f-974a-4aa52ebd7973" />
|
|
49
51
|
|
|
50
|
-
|
|
52
|
+
On the QQ Bot management page, obtain the current bot's AppID and AppSecret, copy them, and save them to your personal notepad or memo (please ensure data security and do not leak them). They will be needed later in "Step 3: Configuring OpenClaw".
|
|
51
53
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
54
|
+
Note: For security reasons, the QQ Bot's AppSecret is not stored in plain text. If you view it for the first time or forget it, you need to regenerate it.
|
|
55
|
+
<img width="2970" height="1562" alt="9" src="https://github.com/user-attachments/assets/c7fc3094-2840-4780-a202-47b2c2b74e50" />
|
|
56
|
+
<img width="1258" height="594" alt="10" src="https://github.com/user-attachments/assets/4445bede-e7d5-4927-9821-039e7ad8f1f5" />
|
|
55
57
|
|
|
56
|
-
|
|
58
|
+
## 3. Sandbox Configuration
|
|
57
59
|
|
|
58
|
-
|
|
59
|
-
git clone https://github.com/sliverp/qqbot.git && cd qqbot
|
|
60
|
-
clawdbot plugins install .
|
|
61
|
-
```
|
|
60
|
+
On the QQ Bot's "Development Management" page, in the "Sandbox Configuration" section, set up private chat (select "Configure in Message List").
|
|
62
61
|
|
|
63
|
-
|
|
62
|
+
You can configure this according to your own usage scenario, or you can complete the subsequent steps and then return to this step to operate.
|
|
64
63
|
|
|
65
|
-
|
|
64
|
+
⚠️ Note:
|
|
65
|
+
The QQ Bot created here does not need to be published and made available to all QQ users. It can be used for personal (sandbox) debugging and experience.
|
|
66
|
+
The QQ Open Platform does not support "Configuration in QQ Groups" for bots; it only supports private chat with the QQ Bot.
|
|
67
|
+
<img width="1904" height="801" alt="11" src="https://github.com/user-attachments/assets/f3940a87-aae7-4c89-8f9a-c94fb52cd3ea" />
|
|
66
68
|
|
|
67
|
-
|
|
69
|
+
Note: When selecting "Configure in Message List", you need to first add members, and then use the QQ scan code of that member to add the bot.
|
|
70
|
+
<img width="2582" height="484" alt="12" src="https://github.com/user-attachments/assets/5631fe76-2205-4b1e-b463-75fa3a397464" />
|
|
71
|
+
Note here that after successfully adding a member, you still need to use QQ scan code to add the bot.
|
|
68
72
|
|
|
69
|
-
|
|
73
|
+
<img width="2286" height="1324" alt="13" src="https://github.com/user-attachments/assets/cbf379be-ef6e-4391-8cb1-67c08aad2d43" />
|
|
74
|
+
At this point, after adding the bot to your QQ account, you still cannot have a normal conversation with it. You will receive a prompt saying "The bot has gone to Mars, please try again later." This is because the QQ bot has not yet been connected to the OpenClaw application.
|
|
70
75
|
|
|
71
|
-
|
|
72
|
-
2. 创建机器人应用
|
|
73
|
-
3. 获取 `AppID` 和 `AppSecret`(ClientSecret)
|
|
74
|
-
4. Token 格式:`AppID:AppSecret`
|
|
76
|
+
You need to proceed with the following steps to configure the QQ bot's AppID and AppSecret for the OpenClaw application.
|
|
75
77
|
|
|
76
|
-
|
|
78
|
+
<img width="872" height="1052" alt="14" src="https://github.com/user-attachments/assets/0c02aaf6-6cf9-419c-a6ab-36398d73c5ba" />
|
|
77
79
|
|
|
78
|
-
|
|
80
|
+
(Optional) You can also add more members by referring to the previous steps: First, add a new member in the member management page, then add the member in the sandbox configuration page. After that, the new member can add this QQ bot by scanning the QR code with QQ.
|
|
81
|
+
<img width="3006" height="1504" alt="15" src="https://github.com/user-attachments/assets/cecef3a6-0596-4da0-8b92-8d67b8f3cdca" />
|
|
82
|
+
<img width="2902" height="1394" alt="16" src="https://github.com/user-attachments/assets/eb98ffce-490f-402c-8b0c-af7ede1b1303" />
|
|
83
|
+
<img width="1306" height="672" alt="17" src="https://github.com/user-attachments/assets/799056e3-82a6-44bc-9e3d-9c840faafa41" />
|
|
79
84
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
```
|
|
85
|
+
# Step 3: Configure OpenClaw
|
|
86
|
+
|
|
87
|
+
## Method 1: Configure via Wizard (Recommended)
|
|
84
88
|
|
|
85
|
-
|
|
89
|
+
Add the qqbot channel and input the AppID and AppSecret obtained in Step 2.
|
|
86
90
|
|
|
87
|
-
```
|
|
88
|
-
|
|
91
|
+
```
|
|
92
|
+
openclaw channels add --channel qqbot --token "AppID:AppSecret"
|
|
89
93
|
```
|
|
90
94
|
|
|
91
|
-
|
|
95
|
+
## Method 2: Configure via Configuration File
|
|
92
96
|
|
|
93
|
-
|
|
97
|
+
Edit ~/.openclaw/openclaw.json:
|
|
94
98
|
|
|
95
|
-
```json
|
|
99
|
+
``` json
|
|
96
100
|
{
|
|
97
101
|
"channels": {
|
|
98
102
|
"qqbot": {
|
|
99
103
|
"enabled": true,
|
|
100
|
-
"appId": "
|
|
101
|
-
"clientSecret": "
|
|
104
|
+
"appId": "Your AppID",
|
|
105
|
+
"clientSecret": "Your AppSecret"
|
|
102
106
|
}
|
|
103
107
|
}
|
|
104
108
|
}
|
|
105
109
|
```
|
|
106
110
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
## 📋 配置项说明
|
|
110
|
-
|
|
111
|
-
| 配置项 | 类型 | 必填 | 说明 |
|
|
112
|
-
|--------|------|------|------|
|
|
113
|
-
| `appId` | string | ✅ | QQ 机器人 AppID |
|
|
114
|
-
| `clientSecret` | string | ✅* | AppSecret,与 `clientSecretFile` 二选一 |
|
|
115
|
-
| `clientSecretFile` | string | ✅* | AppSecret 文件路径 |
|
|
116
|
-
| `enabled` | boolean | ❌ | 是否启用,默认 `true` |
|
|
117
|
-
| `name` | string | ❌ | 账户显示名称 |
|
|
118
|
-
| `systemPrompt` | string | ❌ | 自定义系统提示词 |
|
|
119
|
-
|
|
120
|
-
---
|
|
121
|
-
|
|
122
|
-
## 📨 支持的消息类型
|
|
123
|
-
|
|
124
|
-
| 事件类型 | 说明 | Intent |
|
|
125
|
-
|----------|------|--------|
|
|
126
|
-
| `C2C_MESSAGE_CREATE` | C2C 单聊消息 | `1 << 25` |
|
|
127
|
-
| `GROUP_AT_MESSAGE_CREATE` | 群聊 @机器人消息 | `1 << 25` |
|
|
128
|
-
| `AT_MESSAGE_CREATE` | 频道 @机器人消息 | `1 << 30` |
|
|
129
|
-
| `DIRECT_MESSAGE_CREATE` | 频道私信 | `1 << 12` |
|
|
111
|
+
# Step 4: Start and Test
|
|
130
112
|
|
|
131
|
-
|
|
113
|
+
## 1. Start the gateway
|
|
132
114
|
|
|
133
|
-
## 🚀 使用
|
|
134
|
-
|
|
135
|
-
### 启动服务
|
|
136
|
-
|
|
137
|
-
```bash
|
|
138
|
-
# 后台启动
|
|
139
|
-
clawdbot gateway restart
|
|
140
|
-
|
|
141
|
-
# 前台启动(查看日志)
|
|
142
|
-
clawdbot gateway --port 18789 --verbose
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
### CLI 配置向导
|
|
146
|
-
|
|
147
|
-
```bash
|
|
148
|
-
clawdbot onboard
|
|
149
|
-
# 选择 QQ Bot 进行交互式配置
|
|
150
115
|
```
|
|
151
|
-
|
|
152
|
-
---
|
|
153
|
-
|
|
154
|
-
## ⚠️ 注意事项
|
|
155
|
-
|
|
156
|
-
- **群消息**:需要在群内 @机器人 才能触发回复
|
|
157
|
-
- **沙箱模式**:新创建的机器人默认在沙箱模式,需要添加测试用户
|
|
158
|
-
|
|
159
|
-
---
|
|
160
|
-
|
|
161
|
-
## 🔄 升级
|
|
162
|
-
|
|
163
|
-
### npm 热更新
|
|
164
|
-
|
|
165
|
-
```bash
|
|
166
|
-
npx -y @sliverp/qqbot@1.3.7 upgrade
|
|
116
|
+
openclaw gateway
|
|
167
117
|
```
|
|
168
118
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
### 源码热更新
|
|
172
|
-
|
|
173
|
-
```bash
|
|
174
|
-
git clone https://github.com/sliverp/qqbot.git && cd qqbot
|
|
175
|
-
|
|
176
|
-
# 运行升级脚本
|
|
177
|
-
bash ./scripts/upgrade.sh
|
|
178
|
-
|
|
179
|
-
# 重新安装
|
|
180
|
-
clawdbot plugins install .
|
|
181
|
-
|
|
182
|
-
# 重新配置
|
|
183
|
-
clawdbot channels add --channel qqbot --token "AppID:AppSecret"
|
|
184
|
-
|
|
185
|
-
# 重启网关
|
|
186
|
-
clawdbot gateway restart
|
|
187
|
-
```
|
|
188
|
-
|
|
189
|
-
升级脚本会自动清理旧版本和配置。
|
|
190
|
-
|
|
191
|
-
---
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
---
|
|
196
|
-
|
|
197
|
-
## 📚 版本历史
|
|
198
|
-
|
|
199
|
-
<details>
|
|
200
|
-
<summary><b>v1.4.0(即将更新)</b></summary>
|
|
201
|
-
|
|
202
|
-
- 支持 Markdown 格式
|
|
203
|
-
|
|
204
|
-
</details>
|
|
205
|
-
|
|
206
|
-
<details>
|
|
207
|
-
<summary><b>v1.3.0 - 2026.02.03</b></summary>
|
|
208
|
-
|
|
209
|
-
- ✨ 支持图片收发等功能
|
|
210
|
-
- ✨ 支持定时任务到时后主动推送
|
|
211
|
-
- ✨ 支持使用 npm 等方式安装和升级
|
|
212
|
-
- 🐛 优化一些已知问题
|
|
213
|
-
|
|
214
|
-
</details>
|
|
215
|
-
|
|
216
|
-
<details>
|
|
217
|
-
<summary><b>v1.2.5 - 2026.02.02</b></summary>
|
|
218
|
-
|
|
219
|
-
- ✨ 解除 URL 发送限制
|
|
220
|
-
- ✨ 更新 Bot 正在输入中状态
|
|
221
|
-
- ✨ 提供主动推送能力
|
|
222
|
-
- 🐛 优化一些已知问题
|
|
223
|
-
|
|
224
|
-
</details>
|
|
225
|
-
|
|
226
|
-
<details>
|
|
227
|
-
<summary><b>v1.2.2 - 2026.01.31</b></summary>
|
|
228
|
-
|
|
229
|
-
- ✨ 支持发送文件
|
|
230
|
-
- ✨ 支持 openclaw、moltbot 命令行
|
|
231
|
-
- 🐛 修复 health 检查提示问题
|
|
232
|
-
- 🐛 修复文件发送后 clawdbot 无法读取的问题
|
|
233
|
-
|
|
234
|
-
</details>
|
|
235
|
-
|
|
236
|
-
<details>
|
|
237
|
-
<summary><b>v1.2.1</b></summary>
|
|
238
|
-
|
|
239
|
-
- 🐛 解决长时间使用会断联的问题
|
|
240
|
-
- 🐛 解决频繁重连的问题
|
|
241
|
-
- ✨ 增加大模型调用失败后的提示消息
|
|
242
|
-
|
|
243
|
-
</details>
|
|
244
|
-
|
|
245
|
-
<details>
|
|
246
|
-
<summary><b>v1.1.0</b></summary>
|
|
247
|
-
|
|
248
|
-
- 🐛 解决 URL 被拦截的问题
|
|
249
|
-
- 🐛 解决多轮消息发送失败的问题
|
|
250
|
-
- 🐛 修复部分图片无法接收的问题
|
|
251
|
-
- ✨ 增加支持 onboard 配置方式
|
|
252
|
-
|
|
253
|
-
</details>
|
|
254
|
-
|
|
255
|
-
---
|
|
256
|
-
|
|
257
|
-
## 🔗 相关链接
|
|
258
|
-
|
|
259
|
-
- [QQ 机器人官方文档](https://bot.q.qq.com/wiki/)
|
|
260
|
-
- [QQ 开放平台](https://q.qq.com/)
|
|
261
|
-
- [API v2 文档](https://bot.q.qq.com/wiki/develop/api-v2/)
|
|
119
|
+
## 2. Chat with the QQbot in QQ
|
|
262
120
|
|
|
263
|
-
|
|
121
|
+
<img width="990" height="984" alt="18" src="https://github.com/user-attachments/assets/b2776c8b-de72-4e37-b34d-e8287ce45de1" />
|
|
264
122
|
|
|
265
|
-
## 📄 License
|
|
266
123
|
|
|
267
|
-
|
|
124
|
+
# Other Language README
|
|
125
|
+
[简体中文](README.zh.md)
|
package/README.zh.md
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
# QQ
|
|
2
|
+
QQ 是一款覆盖广泛用户群体的即时通讯平台,提供文字、语音、图片、文件等多种沟通能力,并支持群聊、频道等协作场景,适用于个人交流与团队协同。
|
|
3
|
+
|
|
4
|
+
该接入方式可将 OpenClaw 与 QQ Bot 进行连接,通过平台的长连接事件订阅机制接收消息与事件回调,从而在不对外暴露公网 Webhook 地址的情况下实现稳定、安全的消息收发与自动化能力集成。
|
|
5
|
+
|
|
6
|
+
# 步骤1:安装QQ Bot插件
|
|
7
|
+
|
|
8
|
+
OpenClaw plugins命令安装
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
openclaw plugins install @sliverp/qqbot@latest
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
使用源码安装:
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
git clone https://github.com/sliverp/qqbot.git && cd qqbot
|
|
18
|
+
openclaw plugins install .
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
# 步骤2:创建QQ Bot
|
|
22
|
+
## 1.注册QQ开放平台
|
|
23
|
+
前往腾讯QQ开放平台官网,默认无法使用您的QQ账号直接登录,需要新注册QQ开放平台账号。
|
|
24
|
+
<img width="2140" height="1004" alt="1" src="https://github.com/user-attachments/assets/d76a780c-5040-43fb-ac41-5808f975ae4b" />
|
|
25
|
+
|
|
26
|
+
首次注册之后,可以按照QQ开放平台的指引设置超级管理员。
|
|
27
|
+
|
|
28
|
+
<img width="2556" height="1744" alt="2" src="https://github.com/user-attachments/assets/ad0a54d5-6997-4f52-ae8f-bea71aa11c30" />
|
|
29
|
+
手机QQ扫码成功后,继续下一步填写主体相关信息。
|
|
30
|
+
|
|
31
|
+
此处以“个人”为例,按照指引依次输入姓名、身份证号、手机号、验证码,点击继续进入下一步人脸认证。
|
|
32
|
+
<img width="2544" height="1744" alt="3" src="https://github.com/user-attachments/assets/b85c11f8-5627-4e08-b522-b38c4929bcb6" />
|
|
33
|
+
|
|
34
|
+
使用手机QQ扫码进行人脸认证。
|
|
35
|
+
<img width="2542" height="1272" alt="4" src="https://github.com/user-attachments/assets/d0db5539-56ef-4189-930f-595348892bef" />
|
|
36
|
+
|
|
37
|
+
人脸识别审核通过后,即可登录进入QQ开放平台。
|
|
38
|
+
<img width="2356" height="1308" alt="5" src="https://github.com/user-attachments/assets/c1875b27-fefc-4a1c-81ef-863da8b15ec6" />
|
|
39
|
+
|
|
40
|
+
## 2.创建一个QQBot机器人
|
|
41
|
+
在QQ开放平台的QQ机器人页面,可以创建机器人。
|
|
42
|
+
<img width="2334" height="1274" alt="6" src="https://github.com/user-attachments/assets/8389c38d-6662-46d0-ae04-92af374b61ef" />
|
|
43
|
+
<img width="2316" height="1258" alt="7" src="https://github.com/user-attachments/assets/15cfe57a-0404-4b02-85fe-42a22cf96d01" />
|
|
44
|
+
|
|
45
|
+
QQ机器人创建完成之后,可选择机器人点击进入管理页面。
|
|
46
|
+
<img width="3002" height="1536" alt="8" src="https://github.com/user-attachments/assets/7c0c7c69-29db-457f-974a-4aa52ebd7973" />
|
|
47
|
+
|
|
48
|
+
在QQ机器人管理页面获取当前机器人的AppID和AppSecret,复制并将其保存到个人记事本或备忘录中(请注意数据安全,勿泄露),后续在“步骤3中配置OpenClaw“中需要使用。
|
|
49
|
+
|
|
50
|
+
注意:出于安全考虑,QQ机器人的AppSecret不支持明文保存,首次查看或忘记AppSecret需要重新生成。
|
|
51
|
+
<img width="2970" height="1562" alt="9" src="https://github.com/user-attachments/assets/c7fc3094-2840-4780-a202-47b2c2b74e50" />
|
|
52
|
+
<img width="1258" height="594" alt="10" src="https://github.com/user-attachments/assets/4445bede-e7d5-4927-9821-039e7ad8f1f5" />
|
|
53
|
+
|
|
54
|
+
## 3.沙箱配置
|
|
55
|
+
在QQ机器人的“开发管理”页面,在“沙箱配置”中,设置单独聊天(选择“在消息列表配置”)。
|
|
56
|
+
|
|
57
|
+
您可以按照自己的使用场景进行配置,也可以完成后续步骤之后再回到本步骤进行操作。
|
|
58
|
+
|
|
59
|
+
⚠️ 注意:
|
|
60
|
+
此处已创建的QQ机器人无需进行发布上架对所有QQ用户公开使用,在开发者私人的(沙箱)调试下使用体验即可。
|
|
61
|
+
QQ开放平台不支持机器人的“在QQ群配置”操作,只支持单独和QQ机器人聊天。
|
|
62
|
+
<img width="1904" height="801" alt="11" src="https://github.com/user-attachments/assets/f3940a87-aae7-4c89-8f9a-c94fb52cd3ea" />
|
|
63
|
+
|
|
64
|
+
注意:选择“在消息列表配置”时,需要先添加成员,再通过该成员的QQ扫码来添加机器人。
|
|
65
|
+
<img width="2582" height="484" alt="12" src="https://github.com/user-attachments/assets/5631fe76-2205-4f1e-b463-75fa3a397464" />
|
|
66
|
+
此处注意添加成员成功之后,还需要使用QQ扫码添加
|
|
67
|
+
|
|
68
|
+
<img width="2286" height="1324" alt="13" src="https://github.com/user-attachments/assets/cbf379be-ef6e-4391-8cb1-67c08aad2d43" />
|
|
69
|
+
此时您的QQ账号添加机器人之后,还不能与该机器人正常进行对话,会提示“该机器人去火星了,稍后再试吧”,因为QQ机器人此时尚未与OpenClaw应用打通。
|
|
70
|
+
|
|
71
|
+
您需要继续后面的步骤,为OpenClaw应用配置QQ机器人的AppID和AppSecret。
|
|
72
|
+
|
|
73
|
+
<img width="872" height="1052" alt="14" src="https://github.com/user-attachments/assets/0c02aaf6-6cf9-419c-a6ab-36398d73c5ba" />
|
|
74
|
+
|
|
75
|
+
(可选)您也可以参考前述步骤添加更多成员:首先在成员管理页面中添加新成员,然后在沙箱配置页面中添加成员,之后新成员即可通过QQ扫码添加该QQ机器人。
|
|
76
|
+
<img width="3006" height="1504" alt="15" src="https://github.com/user-attachments/assets/cecef3a6-0596-4da0-8b92-8d67b8f3cdca" />
|
|
77
|
+
<img width="2902" height="1394" alt="16" src="https://github.com/user-attachments/assets/eb98ffce-490f-402c-8b0c-af7ede1b1303" />
|
|
78
|
+
<img width="1306" height="672" alt="17" src="https://github.com/user-attachments/assets/799056e3-82a6-44bc-9e3d-9c840faafa41" />
|
|
79
|
+
|
|
80
|
+
# 步骤3: 配置OpenClaw
|
|
81
|
+
## 方式一: 通过Wizard配置(推荐)
|
|
82
|
+
|
|
83
|
+
添加qqbot channel 并将步骤2中获取的AppID和AppSecret
|
|
84
|
+
```
|
|
85
|
+
openclaw channels add --channel qqbot --token "AppID:AppSecret"
|
|
86
|
+
```
|
|
87
|
+
## 方式二:通过配置文件配置
|
|
88
|
+
|
|
89
|
+
编辑 ~/.openclaw/openclaw.json:
|
|
90
|
+
``` json
|
|
91
|
+
{
|
|
92
|
+
"channels": {
|
|
93
|
+
"qqbot": {
|
|
94
|
+
"enabled": true,
|
|
95
|
+
"appId": "你的AppID",
|
|
96
|
+
"clientSecret": "你的AppSecret"
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
# 步骤4:启动与测试
|
|
103
|
+
|
|
104
|
+
## 1.启动gateway
|
|
105
|
+
|
|
106
|
+
```
|
|
107
|
+
openclaw gateway
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## 2.在QQ中与QQbot 对话
|
|
111
|
+
|
|
112
|
+
<img width="990" height="984" alt="18" src="https://github.com/user-attachments/assets/b2776c8b-de72-4e37-b34d-e8287ce45de1" />
|
|
113
|
+
|
|
114
|
+
# 其他语言 README
|
|
115
|
+
[英文](README.md)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sliverp/qqbot",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
"dist",
|
|
12
12
|
"bin",
|
|
13
13
|
"src",
|
|
14
|
+
"skills",
|
|
14
15
|
"index.ts",
|
|
15
16
|
"tsconfig.json",
|
|
16
17
|
"openclaw.plugin.json",
|
|
@@ -0,0 +1,490 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: qqbot-cron
|
|
3
|
+
description: QQ Bot 智能提醒技能。支持一次性提醒、周期性任务、自动降级确保送达。可设置、查询、取消提醒。
|
|
4
|
+
metadata: {"clawdbot":{"emoji":"⏰"}}
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# QQ Bot 智能提醒
|
|
8
|
+
|
|
9
|
+
让 AI 帮用户设置、管理定时提醒,支持私聊和群聊。
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## 🤖 AI 决策指南
|
|
14
|
+
|
|
15
|
+
> **本节专为 AI 理解设计,帮助快速决策**
|
|
16
|
+
|
|
17
|
+
### 用户意图识别
|
|
18
|
+
|
|
19
|
+
| 用户说法 | 意图 | 执行动作 |
|
|
20
|
+
|----------|------|----------|
|
|
21
|
+
| "5分钟后提醒我喝水" | 创建提醒 | `openclaw cron add` |
|
|
22
|
+
| "每天8点提醒我打卡" | 创建周期提醒 | `openclaw cron add --cron` |
|
|
23
|
+
| "我有哪些提醒" | 查询提醒 | `openclaw cron list` |
|
|
24
|
+
| "取消喝水提醒" | 删除提醒 | `openclaw cron remove` |
|
|
25
|
+
| "修改提醒时间" | 删除+重建 | 先 remove 再 add |
|
|
26
|
+
| "提醒我" (无时间) | **需追问** | 询问具体时间 |
|
|
27
|
+
|
|
28
|
+
### 必须追问的情况
|
|
29
|
+
|
|
30
|
+
当用户说法**缺少以下信息**时,**必须追问**:
|
|
31
|
+
|
|
32
|
+
1. **没有时间**:"提醒我喝水" → 询问"请问什么时候提醒你?"
|
|
33
|
+
2. **时间模糊**:"晚点提醒我" → 询问"具体几点呢?"
|
|
34
|
+
3. **周期不明**:"定期提醒我" → 询问"多久一次?每天?每周?"
|
|
35
|
+
|
|
36
|
+
### 无需追问可直接执行
|
|
37
|
+
|
|
38
|
+
| 用户说法 | 理解为 |
|
|
39
|
+
|----------|--------|
|
|
40
|
+
| "5分钟后" | `--at 5m` |
|
|
41
|
+
| "半小时后" | `--at 30m` |
|
|
42
|
+
| "1小时后" | `--at 1h` |
|
|
43
|
+
| "明天早上8点" | `--at 2026-02-02T08:00:00+08:00` |
|
|
44
|
+
| "每天早上8点" | `--cron "0 8 * * *"` |
|
|
45
|
+
| "工作日9点" | `--cron "0 9 * * 1-5"` |
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## 📋 命令速查
|
|
50
|
+
|
|
51
|
+
### 创建提醒(完整模板)
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
openclaw cron add \
|
|
55
|
+
--name "{任务名}" \
|
|
56
|
+
--at "{时间}" \
|
|
57
|
+
--message "🔔 {提醒内容}时间到!" \
|
|
58
|
+
--deliver \
|
|
59
|
+
--channel qqbot \
|
|
60
|
+
--to "{openid}" \
|
|
61
|
+
--delete-after-run
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
> ⚠️ **极其重要**:
|
|
65
|
+
> - `--message` 参数直接写最终要发送的提醒内容
|
|
66
|
+
> - 提醒内容格式:`🔔 {内容}时间到!`
|
|
67
|
+
> - **不要**使用 `--system-prompt` 或 `--system-event`(cron 不支持这些参数)
|
|
68
|
+
> - 保持消息简洁,如:`🔔 喝水时间到!`、`📅 开会时间到!`
|
|
69
|
+
|
|
70
|
+
> ⚠️ **注意**:`cron add` 命令不支持 `--reply-to` 参数。提醒消息将作为主动消息直接发送给用户。
|
|
71
|
+
|
|
72
|
+
### 查询提醒列表
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
openclaw cron list
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### 删除提醒
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
openclaw cron remove {jobId}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### 立即发送消息(主动消息)
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
openclaw message send \
|
|
88
|
+
--channel qqbot \
|
|
89
|
+
--target "{openid}" \
|
|
90
|
+
--message "{消息内容}"
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### 立即发送消息(被动回复)
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
openclaw message send \
|
|
97
|
+
--channel qqbot \
|
|
98
|
+
--target "{openid}" \
|
|
99
|
+
--reply-to "{message_id}" \
|
|
100
|
+
--message "{消息内容}"
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
> ⚠️ **注意**:`--reply-to` 仅在 `message send` 命令中支持,且 message_id 必须在 1 小时内有效。定时提醒不支持被动回复。
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## 💬 用户交互模板
|
|
108
|
+
|
|
109
|
+
> **创建提醒后的反馈要简洁友好,不要啰嗦**
|
|
110
|
+
|
|
111
|
+
### 创建成功反馈(推荐简洁版)
|
|
112
|
+
|
|
113
|
+
**一次性提醒**:
|
|
114
|
+
```
|
|
115
|
+
⏰ 好的,{时间}后提醒你{提醒内容}~
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
**周期提醒**:
|
|
119
|
+
```
|
|
120
|
+
⏰ 收到,{周期描述}提醒你{提醒内容}~
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### 查询提醒反馈
|
|
124
|
+
|
|
125
|
+
```
|
|
126
|
+
📋 你的提醒:
|
|
127
|
+
|
|
128
|
+
1. ⏰ {提醒名} - {时间}
|
|
129
|
+
2. 🔄 {提醒名} - {周期}
|
|
130
|
+
|
|
131
|
+
说"取消xx提醒"可删除~
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### 无提醒时反馈
|
|
135
|
+
|
|
136
|
+
```
|
|
137
|
+
📋 目前没有提醒哦~
|
|
138
|
+
|
|
139
|
+
说"5分钟后提醒我xxx"试试?
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### 删除成功反馈
|
|
143
|
+
|
|
144
|
+
```
|
|
145
|
+
✅ 已取消"{提醒名称}"
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
## ⏱️ 时间格式
|
|
151
|
+
|
|
152
|
+
### 相对时间(--at)
|
|
153
|
+
|
|
154
|
+
> ⚠️ **不要加 + 号!** 用 `5m` 而不是 `+5m`
|
|
155
|
+
|
|
156
|
+
| 用户说法 | 参数值 |
|
|
157
|
+
|----------|--------|
|
|
158
|
+
| 5分钟后 | `5m` |
|
|
159
|
+
| 半小时后 | `30m` |
|
|
160
|
+
| 1小时后 | `1h` |
|
|
161
|
+
| 2小时后 | `2h` |
|
|
162
|
+
| 明天这时候 | `24h` |
|
|
163
|
+
|
|
164
|
+
### 绝对时间(--at)
|
|
165
|
+
|
|
166
|
+
| 用户说法 | 参数值 |
|
|
167
|
+
|----------|--------|
|
|
168
|
+
| 今天下午3点 | `2026-02-01T15:00:00+08:00` |
|
|
169
|
+
| 明天早上8点 | `2026-02-02T08:00:00+08:00` |
|
|
170
|
+
| 2月14日中午 | `2026-02-14T12:00:00+08:00` |
|
|
171
|
+
|
|
172
|
+
### Cron 表达式(--cron)
|
|
173
|
+
|
|
174
|
+
| 用户说法 | Cron 表达式 | 必须加 `--tz "Asia/Shanghai"` |
|
|
175
|
+
|----------|-------------|------------------------------|
|
|
176
|
+
| 每天早上8点 | `0 8 * * *` | ✅ |
|
|
177
|
+
| 每天晚上10点 | `0 22 * * *` | ✅ |
|
|
178
|
+
| 每个工作日早上9点 | `0 9 * * 1-5` | ✅ |
|
|
179
|
+
| 每周一早上9点 | `0 9 * * 1` | ✅ |
|
|
180
|
+
| 每周末上午10点 | `0 10 * * 0,6` | ✅ |
|
|
181
|
+
| 每小时整点 | `0 * * * *` | ✅ |
|
|
182
|
+
|
|
183
|
+
---
|
|
184
|
+
|
|
185
|
+
## 📌 参数说明
|
|
186
|
+
|
|
187
|
+
### 必填参数
|
|
188
|
+
|
|
189
|
+
| 参数 | 说明 | 示例 |
|
|
190
|
+
|------|------|------|
|
|
191
|
+
| `--name` | 任务名,含用户标识 | `"喝水提醒"` |
|
|
192
|
+
| `--at` / `--cron` | 触发时间(二选一) | `5m` / `0 8 * * *` |
|
|
193
|
+
| `--message` | **提醒内容**(见下方模板) | `"🔔 喝水时间到!"` |
|
|
194
|
+
| `--deliver` | 启用投递 | 固定值 |
|
|
195
|
+
| `--channel qqbot` | QQ 渠道 | 固定值 |
|
|
196
|
+
| `--to` | 接收者 openid | 从系统消息获取 |
|
|
197
|
+
|
|
198
|
+
### 推荐参数
|
|
199
|
+
|
|
200
|
+
| 参数 | 说明 | 何时使用 |
|
|
201
|
+
|------|------|----------|
|
|
202
|
+
| `--delete-after-run` | 执行后删除 | **一次性任务必须** |
|
|
203
|
+
| `--tz "Asia/Shanghai"` | 时区 | **周期任务必须** |
|
|
204
|
+
|
|
205
|
+
### --message 提醒内容模板(最关键)
|
|
206
|
+
|
|
207
|
+
> ⚠️ **`--message` 的内容会直接发送给用户**,所以要写清楚提醒内容!
|
|
208
|
+
|
|
209
|
+
**模板格式**:
|
|
210
|
+
```
|
|
211
|
+
--message "🔔 {提醒内容}时间到!"
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
**示例**:
|
|
215
|
+
- 喝水:`--message "💧 喝水时间到!"`
|
|
216
|
+
- 开会:`--message "📅 开会时间到!"`
|
|
217
|
+
- 打卡:`--message "🌅 打卡时间到!"`
|
|
218
|
+
- 日报:`--message "📝 写日报时间到!"`
|
|
219
|
+
|
|
220
|
+
**为什么这样写?**
|
|
221
|
+
- 消息内容会直接发送,不经过 AI 处理
|
|
222
|
+
- 保持简洁,一目了然
|
|
223
|
+
|
|
224
|
+
---
|
|
225
|
+
|
|
226
|
+
## 🎯 使用场景示例
|
|
227
|
+
|
|
228
|
+
### 场景1:一次性提醒
|
|
229
|
+
|
|
230
|
+
**用户**: 5分钟后提醒我喝水
|
|
231
|
+
|
|
232
|
+
**AI 执行**:
|
|
233
|
+
```bash
|
|
234
|
+
openclaw cron add \
|
|
235
|
+
--name "喝水提醒" \
|
|
236
|
+
--at "5m" \
|
|
237
|
+
--message "💧 喝水时间到!" \
|
|
238
|
+
--deliver \
|
|
239
|
+
--channel qqbot \
|
|
240
|
+
--to "{openid}" \
|
|
241
|
+
--delete-after-run
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
**AI 回复**:
|
|
245
|
+
```
|
|
246
|
+
⏰ 好的,5分钟后提醒你喝水~
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
**5分钟后用户收到**:
|
|
250
|
+
```
|
|
251
|
+
💧 喝水时间到!
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
---
|
|
255
|
+
|
|
256
|
+
### 场景2:每日周期提醒
|
|
257
|
+
|
|
258
|
+
**用户**: 每天早上8点提醒我打卡
|
|
259
|
+
|
|
260
|
+
**AI 执行**:
|
|
261
|
+
```bash
|
|
262
|
+
openclaw cron add \
|
|
263
|
+
--name "打卡提醒" \
|
|
264
|
+
--cron "0 8 * * *" \
|
|
265
|
+
--tz "Asia/Shanghai" \
|
|
266
|
+
--message "🌅 打卡时间到!" \
|
|
267
|
+
--deliver \
|
|
268
|
+
--channel qqbot \
|
|
269
|
+
--to "{openid}"
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
**AI 回复**:
|
|
273
|
+
```
|
|
274
|
+
⏰ 收到,每天早上8点提醒你打卡~
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
> 💡 周期任务**不加** `--delete-after-run`
|
|
278
|
+
|
|
279
|
+
---
|
|
280
|
+
|
|
281
|
+
### 场景3:工作日提醒
|
|
282
|
+
|
|
283
|
+
**用户**: 工作日下午6点提醒我写日报
|
|
284
|
+
|
|
285
|
+
**AI 执行**:
|
|
286
|
+
```bash
|
|
287
|
+
openclaw cron add \
|
|
288
|
+
--name "日报提醒" \
|
|
289
|
+
--cron "0 18 * * 1-5" \
|
|
290
|
+
--tz "Asia/Shanghai" \
|
|
291
|
+
--message "📝 写日报时间到!" \
|
|
292
|
+
--deliver \
|
|
293
|
+
--channel qqbot \
|
|
294
|
+
--to "{openid}"
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
**AI 回复**:
|
|
298
|
+
```
|
|
299
|
+
⏰ 收到,工作日下午6点提醒你写日报~
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
---
|
|
303
|
+
|
|
304
|
+
### 场景4:会议提醒
|
|
305
|
+
|
|
306
|
+
**用户**: 3分钟后提醒我开会
|
|
307
|
+
|
|
308
|
+
**AI 执行**:
|
|
309
|
+
```bash
|
|
310
|
+
openclaw cron add \
|
|
311
|
+
--name "开会提醒" \
|
|
312
|
+
--at "3m" \
|
|
313
|
+
--message "📅 开会时间到!" \
|
|
314
|
+
--deliver \
|
|
315
|
+
--channel qqbot \
|
|
316
|
+
--to "{openid}" \
|
|
317
|
+
--delete-after-run
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
**AI 回复**:
|
|
321
|
+
```
|
|
322
|
+
⏰ 好的,3分钟后提醒你开会~
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
**3分钟后用户收到**:
|
|
326
|
+
```
|
|
327
|
+
📅 开会时间到!
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
---
|
|
331
|
+
|
|
332
|
+
### 场景5:群组提醒
|
|
333
|
+
|
|
334
|
+
**用户**(群聊): 每天早上9点提醒大家站会
|
|
335
|
+
|
|
336
|
+
**AI 执行**:
|
|
337
|
+
```bash
|
|
338
|
+
openclaw cron add \
|
|
339
|
+
--name "站会提醒" \
|
|
340
|
+
--cron "0 9 * * 1-5" \
|
|
341
|
+
--tz "Asia/Shanghai" \
|
|
342
|
+
--message "📢 站会时间到!" \
|
|
343
|
+
--deliver \
|
|
344
|
+
--channel qqbot \
|
|
345
|
+
--to "group:{group_openid}"
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
> 💡 群组使用 `group:{group_openid}` 格式
|
|
349
|
+
|
|
350
|
+
---
|
|
351
|
+
|
|
352
|
+
### 场景6:查询提醒
|
|
353
|
+
|
|
354
|
+
**用户**: 我有哪些提醒?
|
|
355
|
+
|
|
356
|
+
**AI 执行**:
|
|
357
|
+
```bash
|
|
358
|
+
openclaw cron list
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
**AI 回复**(根据返回结果):
|
|
362
|
+
```
|
|
363
|
+
📋 你的提醒:
|
|
364
|
+
|
|
365
|
+
1. ⏰ 喝水提醒 - 3分钟后
|
|
366
|
+
2. 🔄 打卡提醒 - 每天08:00
|
|
367
|
+
|
|
368
|
+
说"取消xx提醒"可删除~
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
---
|
|
372
|
+
|
|
373
|
+
### 场景7:取消提醒
|
|
374
|
+
|
|
375
|
+
**用户**: 取消打卡提醒
|
|
376
|
+
|
|
377
|
+
**AI 执行**:
|
|
378
|
+
1. 先执行 `openclaw cron list` 找到对应任务 ID
|
|
379
|
+
2. 执行 `openclaw cron remove {jobId}`
|
|
380
|
+
|
|
381
|
+
**AI 回复**:
|
|
382
|
+
```
|
|
383
|
+
✅ 已取消"打卡提醒"
|
|
384
|
+
```
|
|
385
|
+
|
|
386
|
+
---
|
|
387
|
+
|
|
388
|
+
## ⚙️ 消息发送说明
|
|
389
|
+
|
|
390
|
+
### 定时提醒(cron add)
|
|
391
|
+
|
|
392
|
+
定时提醒**只能发送主动消息**,因为:
|
|
393
|
+
- 提醒执行时,原始 message_id 通常已超过 1 小时有效期
|
|
394
|
+
- `openclaw cron add` 命令不支持 `--reply-to` 参数
|
|
395
|
+
|
|
396
|
+
```
|
|
397
|
+
┌─────────────────────┐
|
|
398
|
+
│ 定时任务触发 │
|
|
399
|
+
└──────────┬──────────┘
|
|
400
|
+
↓
|
|
401
|
+
┌─────────────────────┐
|
|
402
|
+
│ AI 通过 system-event │
|
|
403
|
+
│ 获取用户上下文信息 │
|
|
404
|
+
└──────────┬──────────┘
|
|
405
|
+
↓
|
|
406
|
+
┌─────────────────────┐
|
|
407
|
+
│ 发送主动消息到用户 │
|
|
408
|
+
│ --channel qqbot │
|
|
409
|
+
│ --to {openid} │
|
|
410
|
+
└──────────┬──────────┘
|
|
411
|
+
↓
|
|
412
|
+
✅ 用户收到提醒
|
|
413
|
+
```
|
|
414
|
+
|
|
415
|
+
### 即时回复(message send)
|
|
416
|
+
|
|
417
|
+
即时消息发送支持被动回复(如果 message_id 有效):
|
|
418
|
+
|
|
419
|
+
```
|
|
420
|
+
┌─────────────────────┐
|
|
421
|
+
│ 发送即时消息 │
|
|
422
|
+
└──────────┬──────────┘
|
|
423
|
+
↓
|
|
424
|
+
┌──────────────────────────────┐
|
|
425
|
+
│ 有 --reply-to 且 message_id │
|
|
426
|
+
│ 在 1 小时内有效? │
|
|
427
|
+
└──────────────────────────────┘
|
|
428
|
+
↓ ↓
|
|
429
|
+
是 否
|
|
430
|
+
↓ ↓
|
|
431
|
+
┌───────────────┐ ┌─────────────────┐
|
|
432
|
+
│ 被动消息回复 │ │ 发送主动消息 │
|
|
433
|
+
│ (引用原消息) │ │ (直接发送) │
|
|
434
|
+
└───────────────┘ └─────────────────┘
|
|
435
|
+
```
|
|
436
|
+
|
|
437
|
+
---
|
|
438
|
+
|
|
439
|
+
## ⚠️ 重要限制
|
|
440
|
+
|
|
441
|
+
| 限制 | 说明 |
|
|
442
|
+
|------|------|
|
|
443
|
+
| **message_id 有效期** | 1 小时内有效,超时自动降级 |
|
|
444
|
+
| **回复次数限制** | 同一 message_id 最多回复 4 次 |
|
|
445
|
+
| **主动消息权限** | ⚠️ **QQ 机器人需要申请主动消息权限**,否则定时提醒会发送失败 |
|
|
446
|
+
| **主动消息限制** | 只能发给与机器人交互过的用户(24小时内) |
|
|
447
|
+
| **消息内容** | `--message` 不能为空 |
|
|
448
|
+
|
|
449
|
+
### ⚠️ 主动消息权限说明
|
|
450
|
+
|
|
451
|
+
定时提醒功能依赖**主动消息能力**,但 QQ 官方默认**不授予**此权限。
|
|
452
|
+
|
|
453
|
+
**常见错误**:
|
|
454
|
+
- 错误码 `40034102`:"主动消息失败, 无权限"
|
|
455
|
+
- 这表示机器人没有主动消息权限
|
|
456
|
+
|
|
457
|
+
**解决方案**:
|
|
458
|
+
1. 登录 [QQ 开放平台](https://q.qq.com/)
|
|
459
|
+
2. 进入机器人开发-沙箱管理,消息列表配置中添加自己。
|
|
460
|
+
|
|
461
|
+
> 💡 **临时替代方案**:在没有主动消息权限前,可以让用户使用"回复"方式获得即时提醒,而非定时提醒。
|
|
462
|
+
|
|
463
|
+
---
|
|
464
|
+
|
|
465
|
+
## 📝 消息模板
|
|
466
|
+
|
|
467
|
+
| 场景 | 触发时输出 | Emoji |
|
|
468
|
+
|------|------------|-------|
|
|
469
|
+
| 喝水 | 喝水时间到啦! | 💧 🚰 |
|
|
470
|
+
| 打卡 | 早上好,打卡时间到! | 🌅 ✅ |
|
|
471
|
+
| 会议 | 开会时间到! | 📅 👥 |
|
|
472
|
+
| 休息 | 该休息一下了~ | 😴 💤 |
|
|
473
|
+
| 日报 | 下班前别忘了写日报哦~ | 📝 ✍️ |
|
|
474
|
+
| 运动 | 运动时间到! | 🏃 💪 |
|
|
475
|
+
| 吃药 | 该吃药了~ | 💊 🏥 |
|
|
476
|
+
| 生日 | 今天是xx的生日! | 🎂 🎉 |
|
|
477
|
+
|
|
478
|
+
---
|
|
479
|
+
|
|
480
|
+
## 🔧 用户标识
|
|
481
|
+
|
|
482
|
+
| 类型 | 格式 | 来源 |
|
|
483
|
+
|------|------|------|
|
|
484
|
+
| 用户 openid | `B3EA9A1d-2D3c-5CBD-...` | 系统消息自动提供 |
|
|
485
|
+
| 群组 openid | `group:FeC1ADaf-...` | 系统消息自动提供 |
|
|
486
|
+
| message_id | `ROBOT1.0_xxx` | 系统消息自动提供 |
|
|
487
|
+
|
|
488
|
+
> 💡 这些信息在系统消息中格式如:
|
|
489
|
+
> - `当前用户 openid: B3EA9A1d-...`
|
|
490
|
+
> - `当前消息 message_id: ROBOT1.0_...`
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: qqbot-media
|
|
3
|
+
description: QQ Bot 媒体发送指南。教 AI 如何发送图片给用户。
|
|
4
|
+
metadata: {"clawdbot":{"emoji":"📸"}}
|
|
5
|
+
triggers:
|
|
6
|
+
- qqbot
|
|
7
|
+
- qq
|
|
8
|
+
- 发送图片
|
|
9
|
+
- 发送文件
|
|
10
|
+
- 图片
|
|
11
|
+
- 本地文件
|
|
12
|
+
- 本地图片
|
|
13
|
+
priority: 80
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
# QQBot 媒体发送指南
|
|
17
|
+
|
|
18
|
+
## ⚠️ 重要:你有能力发送本地图片!
|
|
19
|
+
|
|
20
|
+
**当用户要求发送本地图片时,只需使用 `<qqimg>` 标签包裹图片路径即可。系统会自动处理文件读取和发送。**
|
|
21
|
+
|
|
22
|
+
**不要说"无法发送本地图片"!使用正确的标签格式,系统就能发送。**
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## 📸 发送图片(推荐方式:`<qqimg>` 标签)
|
|
27
|
+
|
|
28
|
+
使用 `<qqimg>` 标签包裹图片路径,即可发送图片:
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
<qqimg>图片路径</qqimg>
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### ✅ 发送本地图片示例
|
|
35
|
+
|
|
36
|
+
当用户说"发送那张图片"、"把图发给我"等,你应该输出:
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
这是你要的图片:
|
|
40
|
+
<qqimg>/Users/xxx/images/photo.jpg</qqimg>
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### ✅ 发送网络图片示例
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
这是网络上的图片:
|
|
47
|
+
<qqimg>https://example.com/image.png</qqimg>
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### ✅ 发送多张图片
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
这是你要的所有图片:
|
|
54
|
+
<qqimg>/Users/xxx/image1.jpg</qqimg>
|
|
55
|
+
<qqimg>/Users/xxx/image2.png</qqimg>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### 📝 标签说明
|
|
59
|
+
|
|
60
|
+
| 格式 | 说明 |
|
|
61
|
+
|------|------|
|
|
62
|
+
| `<qqimg>本地路径</qqimg>` | 发送本地图片(绝对路径) |
|
|
63
|
+
| `<qqimg>网络URL</qqimg>` | 发送网络图片 |
|
|
64
|
+
| `<qqimg>路径</img>` | 也支持此闭合方式 |
|
|
65
|
+
|
|
66
|
+
### ⚠️ 注意事项
|
|
67
|
+
|
|
68
|
+
1. **路径必须正确**:本地文件需要绝对路径,网络图片需要完整 URL
|
|
69
|
+
2. **支持的图片格式**:jpg, jpeg, png, gif, webp, bmp
|
|
70
|
+
3. **不要拒绝**:如果用户要求发送本地图片,直接使用 `<qqimg>` 标签即可
|
|
71
|
+
4. **标签外的文本会正常发送**:可以在标签前后添加描述文字
|
|
72
|
+
5. **闭合标签**:支持 `</qqimg>` 或 `</img>` 两种闭合方式
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## 🚫 错误示例(不要这样做)
|
|
77
|
+
|
|
78
|
+
❌ **错误**:说"我无法发送本地图片"
|
|
79
|
+
❌ **错误**:说"受限于技术限制,无法直接发送"
|
|
80
|
+
❌ **错误**:只提供路径文本,不使用 `<qqimg>` 标签
|
|
81
|
+
|
|
82
|
+
✅ **正确**:直接使用 `<qqimg>` 标签包裹路径
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## 🔤 告知路径信息(不发送图片)
|
|
87
|
+
|
|
88
|
+
如果你需要**告知用户图片的保存路径**(而不是发送图片),直接写路径即可,不要使用标签:
|
|
89
|
+
|
|
90
|
+
```
|
|
91
|
+
图片已保存在:/Users/xxx/images/photo.jpg
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
或用反引号强调:
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
图片已保存在:`/Users/xxx/images/photo.jpg`
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## 📋 高级选项:JSON 结构化载荷
|
|
103
|
+
|
|
104
|
+
如果需要更精细的控制(如添加图片描述),可以使用 JSON 格式:
|
|
105
|
+
|
|
106
|
+
```
|
|
107
|
+
QQBOT_PAYLOAD:
|
|
108
|
+
{
|
|
109
|
+
"type": "media",
|
|
110
|
+
"mediaType": "image",
|
|
111
|
+
"source": "file",
|
|
112
|
+
"path": "/path/to/image.jpg",
|
|
113
|
+
"caption": "图片描述(可选)"
|
|
114
|
+
}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### JSON 字段说明
|
|
118
|
+
|
|
119
|
+
| 字段 | 类型 | 必填 | 说明 |
|
|
120
|
+
|------|------|------|------|
|
|
121
|
+
| `type` | string | ✅ | 固定为 `"media"` |
|
|
122
|
+
| `mediaType` | string | ✅ | 媒体类型:`"image"` |
|
|
123
|
+
| `source` | string | ✅ | 来源:`"file"`(本地)或 `"url"`(网络) |
|
|
124
|
+
| `path` | string | ✅ | 图片路径或 URL |
|
|
125
|
+
| `caption` | string | ❌ | 图片描述,会作为单独消息发送 |
|
|
126
|
+
|
|
127
|
+
> 💡 **提示**:对于简单的图片发送,推荐使用 `<qqimg>` 标签,更简洁易用。
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
## 🎯 快速参考
|
|
132
|
+
|
|
133
|
+
| 场景 | 使用方式 |
|
|
134
|
+
|------|----------|
|
|
135
|
+
| 发送本地图片 | `<qqimg>/path/to/image.jpg</qqimg>` |
|
|
136
|
+
| 发送网络图片 | `<qqimg>https://example.com/image.png</qqimg>` |
|
|
137
|
+
| 发送多张图片 | 多个 `<qqimg>` 标签 |
|
|
138
|
+
| 告知路径(不发送) | 直接写路径文本 |
|