@tencent-connect/openclaw-qqbot 1.5.5 → 1.5.7
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.md +61 -152
- package/README.zh.md +61 -152
- package/bin/qqbot-cli.js +6 -6
- package/dist/AI/345/210/233/346/226/260/345/272/224/347/224/250/345/245/226_/347/224/263/346/212/245/344/271/246.md +211 -0
- package/dist/src/api.js +10 -8
- package/dist/src/config.js +8 -3
- package/dist/src/gateway.js +212 -59
- package/dist/src/slash-commands.d.ts +48 -0
- package/dist/src/slash-commands.js +212 -0
- package/dist/src/types.d.ts +1 -0
- package/package.json +1 -1
- package/scripts/{upgrade.sh → cleanup-legacy-plugins.sh} +3 -3
- package/scripts/proactive-api-server.ts +17 -4
- package/scripts/send-proactive.ts +24 -4
- package/scripts/set-markdown.sh +20 -20
- package/scripts/upgrade-via-npm.sh +204 -0
- package/scripts/{upgrade-and-run.sh → upgrade-via-source.sh} +60 -44
- package/skills/qqbot-cron/SKILL.md +0 -15
- package/skills/qqbot-media/SKILL.md +16 -1
- package/src/api.ts +114 -32
- package/src/channel.ts +2 -1
- package/src/config.ts +8 -3
- package/src/gateway.ts +339 -49
- package/src/image-server.ts +5 -2
- package/src/outbound.ts +32 -26
- package/src/ref-index-store.ts +358 -0
- package/src/types.ts +7 -0
- package/src/utils/platform.ts +16 -2
- package/scripts/npm-upgrade.sh +0 -120
- package/scripts/pull-latest.sh +0 -316
package/README.md
CHANGED
|
@@ -40,6 +40,7 @@ Scan to join the QQ group chat
|
|
|
40
40
|
| 🔄 **Hot Reload** | Install via npm with seamless hot updates |
|
|
41
41
|
| 📝 **Markdown** | Full Markdown formatting support |
|
|
42
42
|
| 🛠️ **Commands** | Native OpenClaw command integration |
|
|
43
|
+
| 💬 **Quoted Context** | Resolve QQ `REFIDX_*` quoted messages and inject quote body into AI context |
|
|
43
44
|
|
|
44
45
|
---
|
|
45
46
|
|
|
@@ -47,6 +48,14 @@ Scan to join the QQ group chat
|
|
|
47
48
|
|
|
48
49
|
> **Note:** This plugin serves as a **message channel** only — it relays messages between QQ and OpenClaw. Capabilities like image understanding, voice transcription, drawing, etc. depend on the **AI model** you configure and the **skills** installed in OpenClaw, not on this plugin itself.
|
|
49
50
|
|
|
51
|
+
### 💬 Quoted Message Context (REFIDX)
|
|
52
|
+
|
|
53
|
+
QQ quote events carry index keys (e.g. `REFIDX_xxx`) instead of full original message body. The plugin now resolves these indices from a local persistent store and injects quote context into AI input, so replies better understand “which message is being quoted”.
|
|
54
|
+
|
|
55
|
+
- Inbound and outbound messages with `ref_idx` are automatically indexed.
|
|
56
|
+
- Store path: `~/.openclaw/qqbot/data/ref-index.jsonl` (survives gateway restart).
|
|
57
|
+
- Quote body may include text + media summary (image/voice/video/file).
|
|
58
|
+
|
|
50
59
|
### 🎙️ Voice Messages (STT)
|
|
51
60
|
|
|
52
61
|
With STT configured, the plugin automatically transcribes voice messages to text before passing them to AI. The whole process is transparent to the user — sending voice feels as natural as sending text.
|
|
@@ -97,6 +106,16 @@ AI sends voice via `<qqvoice>path</qqvoice>`. Formats: mp3/wav/silk/ogg. No ffmp
|
|
|
97
106
|
|
|
98
107
|
<img width="360" src="docs/images/21dce8bfc553ce23d1bd1b270e9c516c.jpg" alt="TTS Voice Demo" />
|
|
99
108
|
|
|
109
|
+
### ⏰ Scheduled Reminder (Proactive Message)
|
|
110
|
+
|
|
111
|
+
> **You**: Remind me to eat in 5 minutes
|
|
112
|
+
>
|
|
113
|
+
> **QQBot**: confirms the reminder first, then proactively sends a voice + text reminder when time is up
|
|
114
|
+
|
|
115
|
+
This capability depends on OpenClaw cron scheduling and proactive messaging. If no reminder arrives, a common reason is QQ-side interception of bot proactive messages.
|
|
116
|
+
|
|
117
|
+
<img width="360" src="docs/images/reminder.jpg" alt="Scheduled Reminder Demo" />
|
|
118
|
+
|
|
100
119
|
### 📎 File Sending
|
|
101
120
|
|
|
102
121
|
> **You**: Extract chapter 1 of War and Peace and send it as a file
|
|
@@ -142,72 +161,73 @@ AI sends videos via `<qqvideo>path</qqvideo>`. Supports local files and URLs. La
|
|
|
142
161
|
2. After scanning, tap **Agree** on your phone — you'll land on the bot configuration page.
|
|
143
162
|
3. Click **Create Bot** to create a new QQ bot.
|
|
144
163
|
|
|
145
|
-
<img width="
|
|
164
|
+
<img width="720" alt="Create Bot" src="docs/images/create_robot.png" />
|
|
165
|
+
|
|
166
|
+
> ⚠️ The bot will automatically appear in your QQ message list and send a first message. However, it will reply "The bot has gone to Mars" until you complete the configuration steps below.
|
|
167
|
+
|
|
168
|
+
<img width="400" alt="Bot Say Hello" src="docs/images/bot_say_hello.jpg" />
|
|
146
169
|
|
|
147
170
|
4. Find **AppID** and **AppSecret** on the bot's page, click **Copy** for each, and save them somewhere safe (e.g., a notepad). **AppSecret is not stored in plaintext — if you leave the page without saving it, you'll have to regenerate a new one.**
|
|
148
171
|
|
|
149
|
-
<img width="
|
|
172
|
+
<img width="720" alt="Find AppID and AppSecret" src="docs/images/find_appid_secret.png" />
|
|
150
173
|
|
|
151
174
|
> For a step-by-step walkthrough with screenshots, see the [official guide](https://cloud.tencent.com/developer/article/2626045).
|
|
152
175
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
### Step 2 — Install the Plugin
|
|
176
|
+
### Step 2 — Install / Upgrade the Plugin
|
|
156
177
|
|
|
157
|
-
**Option A:
|
|
178
|
+
**Option A: Remote One-Liner (Easiest, no clone required)**
|
|
158
179
|
|
|
159
180
|
```bash
|
|
160
|
-
|
|
181
|
+
curl -fsSL https://raw.githubusercontent.com/tencent-connect/openclaw-qqbot/main/scripts/upgrade-via-npm.sh \
|
|
182
|
+
| bash -s -- --appid YOUR_APPID --secret YOUR_SECRET
|
|
161
183
|
```
|
|
162
184
|
|
|
163
|
-
|
|
185
|
+
One command does it all: download script → cleanup old plugins → install → configure channel → restart service. Once done, open QQ and start chatting!
|
|
164
186
|
|
|
165
|
-
**
|
|
187
|
+
> `--appid` and `--secret` are **required for first-time install**. For subsequent upgrades:
|
|
188
|
+
> ```bash
|
|
189
|
+
> curl -fsSL https://raw.githubusercontent.com/tencent-connect/openclaw-qqbot/main/scripts/upgrade-via-npm.sh | bash
|
|
190
|
+
> ```
|
|
191
|
+
|
|
192
|
+
**Option B: Local Script (if you've cloned the repo)**
|
|
166
193
|
|
|
167
194
|
```bash
|
|
168
|
-
|
|
169
|
-
bash ./scripts/upgrade-
|
|
170
|
-
```
|
|
195
|
+
# Via npm
|
|
196
|
+
bash ./scripts/upgrade-via-npm.sh --appid YOUR_APPID --secret YOUR_SECRET
|
|
171
197
|
|
|
172
|
-
|
|
198
|
+
# Or via source
|
|
199
|
+
bash ./scripts/upgrade-via-source.sh --appid YOUR_APPID --secret YOUR_SECRET
|
|
200
|
+
```
|
|
173
201
|
|
|
174
|
-
**
|
|
202
|
+
**Common flags:**
|
|
175
203
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
204
|
+
| Flag | Description |
|
|
205
|
+
|------|-------------|
|
|
206
|
+
| `--appid <id> --secret <secret>` | Configure channel (required for first install, or to change credentials) |
|
|
207
|
+
| `--version <version>` | Install a specific version (npm script only) |
|
|
208
|
+
| `--self-version` | Install the version from local `package.json` (npm script only) |
|
|
209
|
+
| `-h` / `--help` | Show full usage |
|
|
181
210
|
|
|
182
|
-
|
|
211
|
+
> Environment variables `QQBOT_APPID` / `QQBOT_SECRET` are also supported.
|
|
183
212
|
|
|
184
|
-
**Option
|
|
213
|
+
**Option C: Manual Install / Upgrade**
|
|
185
214
|
|
|
186
215
|
```bash
|
|
187
|
-
|
|
188
|
-
|
|
216
|
+
# Uninstall old plugins (skip if first install)
|
|
217
|
+
openclaw plugins uninstall qqbot
|
|
218
|
+
openclaw plugins uninstall openclaw-qqbot
|
|
189
219
|
|
|
190
|
-
|
|
220
|
+
# Install latest
|
|
221
|
+
openclaw plugins install @tencent-connect/openclaw-qqbot@latest
|
|
191
222
|
|
|
192
|
-
|
|
223
|
+
# Configure channel (first install only)
|
|
224
|
+
openclaw channels add --channel qqbot --token "AppID:AppSecret"
|
|
193
225
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
"channels": {
|
|
197
|
-
"qqbot": {
|
|
198
|
-
"enabled": true,
|
|
199
|
-
"appId": "Your AppID",
|
|
200
|
-
"clientSecret": "Your AppSecret"
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
}
|
|
226
|
+
# Start / restart
|
|
227
|
+
openclaw gateway restart
|
|
204
228
|
```
|
|
205
229
|
|
|
206
|
-
### Step
|
|
207
|
-
|
|
208
|
-
```bash
|
|
209
|
-
openclaw gateway
|
|
210
|
-
```
|
|
230
|
+
### Step 3 — Test
|
|
211
231
|
|
|
212
232
|
Open QQ, find your bot, and send a message!
|
|
213
233
|
|
|
@@ -356,120 +376,9 @@ STT supports two-level configuration with priority fallback:
|
|
|
356
376
|
|
|
357
377
|
---
|
|
358
378
|
|
|
359
|
-
## 🔄 Upgrade
|
|
360
|
-
|
|
361
|
-
### Option 1: Upgrade via npm (Recommended)
|
|
362
|
-
|
|
363
|
-
```bash
|
|
364
|
-
bash ./scripts/npm-upgrade.sh
|
|
365
|
-
```
|
|
366
|
-
|
|
367
|
-
The script automatically backs up channel config → uninstalls old plugins → installs new version → restores config → restarts gateway.
|
|
368
|
-
|
|
369
|
-
```bash
|
|
370
|
-
# Specify tag
|
|
371
|
-
bash ./scripts/npm-upgrade.sh --tag alpha
|
|
372
|
-
|
|
373
|
-
# Specify exact version
|
|
374
|
-
bash ./scripts/npm-upgrade.sh --version 1.0.0-alpha.0
|
|
375
|
-
```
|
|
376
|
-
|
|
377
|
-
### Option 2: Upgrade via Source
|
|
378
|
-
|
|
379
|
-
Run the one-click script to upgrade and restart:
|
|
380
|
-
|
|
381
|
-
```bash
|
|
382
|
-
bash ./scripts/upgrade-and-run.sh
|
|
383
|
-
```
|
|
384
|
-
|
|
385
|
-
When no `--appid` / `--secret` is provided, the script reads existing config from `~/.openclaw/openclaw.json` automatically.
|
|
386
|
-
|
|
387
|
-
```bash
|
|
388
|
-
# First-time or override credentials
|
|
389
|
-
bash ./scripts/upgrade-and-run.sh --appid YOUR_APPID --secret YOUR_SECRET
|
|
390
|
-
```
|
|
391
|
-
|
|
392
|
-
<details>
|
|
393
|
-
<summary>Full Options</summary>
|
|
394
|
-
|
|
395
|
-
| Option | Description |
|
|
396
|
-
|--------|-------------|
|
|
397
|
-
| `--appid <id>` | QQ Bot AppID |
|
|
398
|
-
| `--secret <secret>` | QQ Bot AppSecret |
|
|
399
|
-
| `--markdown <yes\|no>` | Enable Markdown format (default: no) |
|
|
400
|
-
| `-h, --help` | Show help |
|
|
401
|
-
|
|
402
|
-
Environment variables `QQBOT_APPID`, `QQBOT_SECRET`, `QQBOT_TOKEN` (AppID:Secret) are also supported.
|
|
403
|
-
|
|
404
|
-
</details>
|
|
405
|
-
|
|
406
|
-
---
|
|
407
|
-
|
|
408
|
-
## 🔀 Migrating from Legacy Plugins
|
|
409
|
-
|
|
410
|
-
If you previously installed `qqbot`, `@sliverp/qqbot`, `@tencent-connect/qqbot`, or other related legacy plugins, you need to uninstall the old plugin before installing the new version.
|
|
411
|
-
|
|
412
|
-
### Recommended: Use npm-upgrade Script (Automatic)
|
|
413
|
-
|
|
414
|
-
```bash
|
|
415
|
-
bash ./scripts/npm-upgrade.sh
|
|
416
|
-
```
|
|
417
|
-
|
|
418
|
-
The script automatically uninstalls all legacy plugin variants (`qqbot`, `@sliverp/qqbot`, `openclaw-qq`, etc.), cleans up residual directories, and backs up/restores channel config.
|
|
419
|
-
|
|
420
|
-
### Manual Migration
|
|
421
|
-
|
|
422
|
-
**1. Back up your channel config**
|
|
423
|
-
|
|
424
|
-
Save the `channels.qqbot` section from `~/.openclaw/openclaw.json` (including `appId`, `clientSecret`, `allowFrom`, etc.) — you'll need to restore it later.
|
|
425
|
-
|
|
426
|
-
**2. Uninstall old plugins**
|
|
427
|
-
|
|
428
|
-
Run the appropriate uninstall command(s) based on what you had installed:
|
|
429
|
-
|
|
430
|
-
```bash
|
|
431
|
-
# Uninstall legacy plugin variants (pick the ones that apply)
|
|
432
|
-
openclaw plugins uninstall qqbot
|
|
433
|
-
openclaw plugins uninstall @sliverp/qqbot
|
|
434
|
-
openclaw plugins uninstall @tencent-connect/qqbot
|
|
435
|
-
openclaw plugins uninstall openclaw-qqbot
|
|
436
|
-
openclaw plugins uninstall openclaw-qq
|
|
437
|
-
```
|
|
438
|
-
|
|
439
|
-
If `plugins uninstall` doesn't fully clean up, manually remove residual directories:
|
|
440
|
-
|
|
441
|
-
```bash
|
|
442
|
-
rm -rf ~/.openclaw/extensions/qqbot
|
|
443
|
-
rm -rf ~/.openclaw/extensions/openclaw-qqbot
|
|
444
|
-
rm -rf ~/.openclaw/extensions/openclaw-qq
|
|
445
|
-
```
|
|
446
|
-
|
|
447
|
-
**3. Temporarily remove channel config**
|
|
448
|
-
|
|
449
|
-
> ⚠️ Important: `openclaw plugins install` validates the config file. If `channels.qqbot` exists but no plugin provides that channel, it will fail with `unknown channel id: qqbot`.
|
|
450
|
-
|
|
451
|
-
Before installing, temporarily remove the `channels.qqbot` section from `~/.openclaw/openclaw.json`.
|
|
452
|
-
|
|
453
|
-
**4. Install the new version**
|
|
454
|
-
|
|
455
|
-
```bash
|
|
456
|
-
openclaw plugins install @tencent-connect/openclaw-qqbot@alpha
|
|
457
|
-
```
|
|
458
|
-
|
|
459
|
-
**5. Restore channel config**
|
|
460
|
-
|
|
461
|
-
Write back the previously saved `channels.qqbot` config to `~/.openclaw/openclaw.json`.
|
|
462
|
-
|
|
463
|
-
**6. Restart the gateway**
|
|
464
|
-
|
|
465
|
-
```bash
|
|
466
|
-
openclaw gateway restart
|
|
467
|
-
```
|
|
468
|
-
|
|
469
|
-
---
|
|
470
|
-
|
|
471
379
|
## 📚 Documentation & Links
|
|
472
380
|
|
|
381
|
+
- [Upgrade Guide](docs/UPGRADE_GUIDE.md) — full upgrade paths and migration notes
|
|
473
382
|
- [Command Reference](docs/commands.md) — OpenClaw CLI commands
|
|
474
383
|
- [Changelog](CHANGELOG.md) — release notes
|
|
475
384
|
|
package/README.zh.md
CHANGED
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
| 🔄 **热更新** | 支持 npm 方式安装和无缝热更新 |
|
|
38
38
|
| 📝 **Markdown** | 完整支持 Markdown 格式消息 |
|
|
39
39
|
| 🛠️ **原生命令** | 支持 OpenClaw 原生命令 |
|
|
40
|
+
| 💬 **引用上下文** | 解析 QQ `REFIDX_*` 引用消息,并将引用内容注入 AI 上下文 |
|
|
40
41
|
|
|
41
42
|
---
|
|
42
43
|
|
|
@@ -44,6 +45,14 @@
|
|
|
44
45
|
|
|
45
46
|
> **说明:** 本插件仅作为**消息通道**,负责在 QQ 和 OpenClaw 之间传递消息。图片理解、语音转录、AI 画图等能力取决于你配置的 **AI 模型**以及在 OpenClaw 中安装的 **skill**,而非插件本身提供。
|
|
46
47
|
|
|
48
|
+
### 💬 引用消息上下文(REFIDX)
|
|
49
|
+
|
|
50
|
+
QQ 的引用事件通常只携带索引键(如 `REFIDX_xxx`),不直接返回原始消息全文。插件已支持从本地持久化索引中解析引用内容,并注入 AI 上下文,帮助模型更准确理解“用户引用的是哪条消息”。
|
|
51
|
+
|
|
52
|
+
- 入站/出站消息中的 `ref_idx` 会自动建立索引。
|
|
53
|
+
- 存储位置:`~/.openclaw/qqbot/data/ref-index.jsonl`(网关重启后仍可恢复)。
|
|
54
|
+
- 引用内容支持文本 + 媒体摘要(图片/语音/视频/文件)。
|
|
55
|
+
|
|
47
56
|
### 🎙️ 语音消息(STT)
|
|
48
57
|
|
|
49
58
|
配置 STT 后,插件会自动将语音转录为文字再交给 AI 处理。整个过程对用户完全透明——发语音就像发文字一样自然,AI 听得懂你在说什么。
|
|
@@ -94,6 +103,16 @@ AI 通过 `<qqvoice>路径</qqvoice>` 发送语音消息。格式:mp3/wav/silk
|
|
|
94
103
|
|
|
95
104
|
<img width="360" src="docs/images/21dce8bfc553ce23d1bd1b270e9c516c.jpg" alt="发语音演示" />
|
|
96
105
|
|
|
106
|
+
### ⏰ 定时提醒(主动消息)
|
|
107
|
+
|
|
108
|
+
> **你**:5分钟后提醒我吃饭
|
|
109
|
+
>
|
|
110
|
+
> **QQBot**:先确认已创建提醒,到点后再主动推送语音 + 文本提醒
|
|
111
|
+
|
|
112
|
+
该能力依赖 OpenClaw cron 调度与主动消息能力。若未收到提醒,常见原因是 QQ 侧拦截了机器人主动消息。
|
|
113
|
+
|
|
114
|
+
<img width="360" src="docs/images/reminder.jpg" alt="定时提醒演示" />
|
|
115
|
+
|
|
97
116
|
### 📎 文件发送
|
|
98
117
|
|
|
99
118
|
> **你**:战争与和平的第一章截取一下发文件给我
|
|
@@ -139,72 +158,73 @@ AI 通过 `<qqvideo>路径</qqvideo>` 发送视频,支持本地文件和公网
|
|
|
139
158
|
2. 手机 QQ 扫码后选择**同意**,即完成注册,进入 QQ 机器人配置页。
|
|
140
159
|
3. 点击**创建机器人**,即可直接新建一个 QQ 机器人。
|
|
141
160
|
|
|
142
|
-
<img width="
|
|
161
|
+
<img width="720" alt="创建机器人" src="docs/images/create_robot.png" />
|
|
162
|
+
|
|
163
|
+
> ⚠️ 机器人创建后会自动出现在你的 QQ 消息列表中,并发送第一条消息。但在完成下面的配置之前,发消息会提示"该机器人去火星了",属于正常现象。
|
|
164
|
+
|
|
165
|
+
<img width="400" alt="机器人打招呼" src="docs/images/bot_say_hello.jpg" />
|
|
143
166
|
|
|
144
167
|
4. 在机器人页面中找到 **AppID** 和 **AppSecret**,分别点击右侧**复制**按钮,保存到记事本或备忘录中。**AppSecret 不支持明文保存,离开页面后再查看会强制重置,请务必妥善保存。**
|
|
145
168
|
|
|
146
|
-
<img width="
|
|
169
|
+
<img width="720" alt="找到 AppID 和 AppSecret" src="docs/images/find_appid_secret.png" />
|
|
147
170
|
|
|
148
171
|
> 详细图文教程请参阅 [官方指南](https://cloud.tencent.com/developer/article/2626045)。
|
|
149
172
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
### 第二步 — 安装插件
|
|
173
|
+
### 第二步 — 安装 / 升级插件
|
|
153
174
|
|
|
154
|
-
|
|
175
|
+
**方式一:远程一键执行(最简单,无需 clone 仓库)**
|
|
155
176
|
|
|
156
177
|
```bash
|
|
157
|
-
|
|
178
|
+
curl -fsSL https://raw.githubusercontent.com/tencent-connect/openclaw-qqbot/main/scripts/upgrade-via-npm.sh \
|
|
179
|
+
| bash -s -- --appid YOUR_APPID --secret YOUR_SECRET
|
|
158
180
|
```
|
|
159
181
|
|
|
160
|
-
|
|
182
|
+
一行命令搞定:下载脚本 → 清理旧插件 → 安装 → 配置通道 → 启动服务。完成后打开 QQ 即可开始聊天!
|
|
161
183
|
|
|
162
|
-
|
|
184
|
+
> 首次安装**必须**传 `--appid` 和 `--secret`。后续升级如已有配置:
|
|
185
|
+
> ```bash
|
|
186
|
+
> curl -fsSL https://raw.githubusercontent.com/tencent-connect/openclaw-qqbot/main/scripts/upgrade-via-npm.sh | bash
|
|
187
|
+
> ```
|
|
188
|
+
|
|
189
|
+
**方式二:本地脚本(已 clone 仓库时使用)**
|
|
163
190
|
|
|
164
191
|
```bash
|
|
165
|
-
|
|
166
|
-
bash ./scripts/upgrade-
|
|
167
|
-
```
|
|
192
|
+
# 通过 npm 安装
|
|
193
|
+
bash ./scripts/upgrade-via-npm.sh --appid YOUR_APPID --secret YOUR_SECRET
|
|
168
194
|
|
|
169
|
-
|
|
195
|
+
# 或通过源码安装
|
|
196
|
+
bash ./scripts/upgrade-via-source.sh --appid YOUR_APPID --secret YOUR_SECRET
|
|
197
|
+
```
|
|
170
198
|
|
|
171
|
-
|
|
199
|
+
**常用参数:**
|
|
172
200
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
201
|
+
| 参数 | 说明 |
|
|
202
|
+
|------|------|
|
|
203
|
+
| `--appid <id> --secret <secret>` | 配置通道(首次安装必填,或更换凭证时使用) |
|
|
204
|
+
| `--version <版本号>` | 安装指定版本(仅 npm 脚本) |
|
|
205
|
+
| `--self-version` | 安装本地 `package.json` 中的版本(仅 npm 脚本) |
|
|
206
|
+
| `-h` / `--help` | 查看完整用法 |
|
|
178
207
|
|
|
179
|
-
|
|
208
|
+
> 也可通过环境变量 `QQBOT_APPID` / `QQBOT_SECRET` 设置。
|
|
180
209
|
|
|
181
|
-
|
|
210
|
+
**方式三:手动安装 / 升级**
|
|
182
211
|
|
|
183
212
|
```bash
|
|
184
|
-
|
|
185
|
-
|
|
213
|
+
# 卸载旧插件(首次安装可跳过)
|
|
214
|
+
openclaw plugins uninstall qqbot
|
|
215
|
+
openclaw plugins uninstall openclaw-qqbot
|
|
186
216
|
|
|
187
|
-
|
|
217
|
+
# 安装最新版本
|
|
218
|
+
openclaw plugins install @tencent-connect/openclaw-qqbot@latest
|
|
188
219
|
|
|
189
|
-
|
|
220
|
+
# 配置通道(首次安装必做)
|
|
221
|
+
openclaw channels add --channel qqbot --token "AppID:AppSecret"
|
|
190
222
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
"channels": {
|
|
194
|
-
"qqbot": {
|
|
195
|
-
"enabled": true,
|
|
196
|
-
"appId": "你的 AppID",
|
|
197
|
-
"clientSecret": "你的 AppSecret"
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
}
|
|
223
|
+
# 启动 / 重启
|
|
224
|
+
openclaw gateway restart
|
|
201
225
|
```
|
|
202
226
|
|
|
203
|
-
###
|
|
204
|
-
|
|
205
|
-
```bash
|
|
206
|
-
openclaw gateway
|
|
207
|
-
```
|
|
227
|
+
### 第三步 — 测试
|
|
208
228
|
|
|
209
229
|
打开 QQ,找到你的机器人,发条消息试试!
|
|
210
230
|
|
|
@@ -353,120 +373,9 @@ STT 支持两级配置,按优先级查找:
|
|
|
353
373
|
|
|
354
374
|
---
|
|
355
375
|
|
|
356
|
-
## 🔄 升级
|
|
357
|
-
|
|
358
|
-
### 方式一:通过 npm 升级(推荐)
|
|
359
|
-
|
|
360
|
-
```bash
|
|
361
|
-
bash ./scripts/npm-upgrade.sh
|
|
362
|
-
```
|
|
363
|
-
|
|
364
|
-
脚本会自动备份通道配置 → 卸载旧插件 → 安装新版本 → 恢复配置 → 重启网关。
|
|
365
|
-
|
|
366
|
-
```bash
|
|
367
|
-
# 指定 tag
|
|
368
|
-
bash ./scripts/npm-upgrade.sh --tag alpha
|
|
369
|
-
|
|
370
|
-
# 指定版本号
|
|
371
|
-
bash ./scripts/npm-upgrade.sh --version 1.0.0-alpha.0
|
|
372
|
-
```
|
|
373
|
-
|
|
374
|
-
### 方式二:通过源码升级
|
|
375
|
-
|
|
376
|
-
运行一键脚本即可升级并重启:
|
|
377
|
-
|
|
378
|
-
```bash
|
|
379
|
-
bash ./scripts/upgrade-and-run.sh
|
|
380
|
-
```
|
|
381
|
-
|
|
382
|
-
不传 `--appid` / `--secret` 参数时,脚本会自动读取 `~/.openclaw/openclaw.json` 中已有的配置。
|
|
383
|
-
|
|
384
|
-
```bash
|
|
385
|
-
# 首次配置或需要覆盖时
|
|
386
|
-
bash ./scripts/upgrade-and-run.sh --appid YOUR_APPID --secret YOUR_SECRET
|
|
387
|
-
```
|
|
388
|
-
|
|
389
|
-
<details>
|
|
390
|
-
<summary>完整选项</summary>
|
|
391
|
-
|
|
392
|
-
| 选项 | 说明 |
|
|
393
|
-
|------|------|
|
|
394
|
-
| `--appid <id>` | QQ 机器人 AppID |
|
|
395
|
-
| `--secret <secret>` | QQ 机器人 AppSecret |
|
|
396
|
-
| `--markdown <yes\|no>` | 是否启用 Markdown 消息格式(默认: no) |
|
|
397
|
-
| `-h, --help` | 显示帮助 |
|
|
398
|
-
|
|
399
|
-
也支持环境变量:`QQBOT_APPID`、`QQBOT_SECRET`、`QQBOT_TOKEN`(AppID:Secret)。
|
|
400
|
-
|
|
401
|
-
</details>
|
|
402
|
-
|
|
403
|
-
---
|
|
404
|
-
|
|
405
|
-
## 🔀 从旧版插件迁移
|
|
406
|
-
|
|
407
|
-
如果你之前安装的是 `qqbot`、`@sliverp/qqbot`、`@tencent-connect/qqbot` 等关联插件,需要先卸载旧插件再安装新版本。
|
|
408
|
-
|
|
409
|
-
### 推荐:使用 npm-upgrade 脚本(自动处理)
|
|
410
|
-
|
|
411
|
-
```bash
|
|
412
|
-
bash ./scripts/npm-upgrade.sh
|
|
413
|
-
```
|
|
414
|
-
|
|
415
|
-
脚本会自动卸载所有历史版本的插件(`qqbot`、`@sliverp/qqbot`、`openclaw-qq` 等)、清理残留目录、备份恢复通道配置。
|
|
416
|
-
|
|
417
|
-
### 手动迁移
|
|
418
|
-
|
|
419
|
-
**1. 备份你的通道配置**
|
|
420
|
-
|
|
421
|
-
先记录 `~/.openclaw/openclaw.json` 中 `channels.qqbot` 的内容(`appId`、`clientSecret`、`allowFrom` 等),后续需要恢复。
|
|
422
|
-
|
|
423
|
-
**2. 卸载旧插件**
|
|
424
|
-
|
|
425
|
-
根据你之前安装的插件名,执行对应的卸载命令:
|
|
426
|
-
|
|
427
|
-
```bash
|
|
428
|
-
# 卸载可能存在的旧版插件(按实际情况选择)
|
|
429
|
-
openclaw plugins uninstall qqbot
|
|
430
|
-
openclaw plugins uninstall @sliverp/qqbot
|
|
431
|
-
openclaw plugins uninstall @tencent-connect/qqbot
|
|
432
|
-
openclaw plugins uninstall openclaw-qqbot
|
|
433
|
-
openclaw plugins uninstall openclaw-qq
|
|
434
|
-
```
|
|
435
|
-
|
|
436
|
-
如果 `plugins uninstall` 未能完全清理,手动删除残留目录:
|
|
437
|
-
|
|
438
|
-
```bash
|
|
439
|
-
rm -rf ~/.openclaw/extensions/qqbot
|
|
440
|
-
rm -rf ~/.openclaw/extensions/openclaw-qqbot
|
|
441
|
-
rm -rf ~/.openclaw/extensions/openclaw-qq
|
|
442
|
-
```
|
|
443
|
-
|
|
444
|
-
**3. 临时移除通道配置**
|
|
445
|
-
|
|
446
|
-
> ⚠️ 重要:`openclaw plugins install` 会校验配置文件。如果配置中存在 `channels.qqbot` 但对应插件尚未安装,会报 `unknown channel id: qqbot` 错误并拒绝安装。
|
|
447
|
-
|
|
448
|
-
安装前需要临时从 `~/.openclaw/openclaw.json` 中移除 `channels.qqbot` 配置段。
|
|
449
|
-
|
|
450
|
-
**4. 安装新版本**
|
|
451
|
-
|
|
452
|
-
```bash
|
|
453
|
-
openclaw plugins install @tencent-connect/openclaw-qqbot@alpha
|
|
454
|
-
```
|
|
455
|
-
|
|
456
|
-
**5. 恢复通道配置**
|
|
457
|
-
|
|
458
|
-
将之前备份的 `channels.qqbot` 配置写回 `~/.openclaw/openclaw.json`。
|
|
459
|
-
|
|
460
|
-
**6. 重启网关**
|
|
461
|
-
|
|
462
|
-
```bash
|
|
463
|
-
openclaw gateway restart
|
|
464
|
-
```
|
|
465
|
-
|
|
466
|
-
---
|
|
467
|
-
|
|
468
376
|
## 📚 文档与链接
|
|
469
377
|
|
|
378
|
+
- [升级指南](docs/UPGRADE_GUIDE.zh.md) — 完整升级路径与迁移说明
|
|
470
379
|
- [命令参考](docs/commands.md) — OpenClaw CLI 常用命令
|
|
471
380
|
- [更新日志](CHANGELOG.md) — 各版本变更记录
|
|
472
381
|
|
package/bin/qqbot-cli.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* qqbot CLI - 用于升级和管理 qqbot 插件
|
|
5
5
|
*
|
|
6
6
|
* 用法:
|
|
7
7
|
* npx openclaw-qqbot upgrade # 升级插件
|
|
@@ -131,7 +131,7 @@ function runCommand(cmd, args = []) {
|
|
|
131
131
|
|
|
132
132
|
// 升级命令
|
|
133
133
|
function upgrade() {
|
|
134
|
-
console.log('===
|
|
134
|
+
console.log('=== qqbot 插件升级脚本 ===');
|
|
135
135
|
|
|
136
136
|
let foundInstallation = null;
|
|
137
137
|
let savedConfig = null;
|
|
@@ -175,7 +175,7 @@ function upgrade() {
|
|
|
175
175
|
}
|
|
176
176
|
} else {
|
|
177
177
|
console.log('未找到已保存的 qqbot 配置,请手动配置:');
|
|
178
|
-
console.log(` ${foundInstallation} channels add --channel qqbot --token "
|
|
178
|
+
console.log(` ${foundInstallation} channels add --channel qqbot --token "appid:appsecret"`);
|
|
179
179
|
return;
|
|
180
180
|
}
|
|
181
181
|
|
|
@@ -186,7 +186,7 @@ function upgrade() {
|
|
|
186
186
|
|
|
187
187
|
// 安装命令
|
|
188
188
|
function install() {
|
|
189
|
-
console.log('===
|
|
189
|
+
console.log('=== qqbot 插件安装 ===');
|
|
190
190
|
|
|
191
191
|
const cmd = detectInstallation();
|
|
192
192
|
if (!cmd) {
|
|
@@ -200,13 +200,13 @@ function install() {
|
|
|
200
200
|
|
|
201
201
|
console.log('\n=== 安装完成 ===');
|
|
202
202
|
console.log('\n请配置机器人通道:');
|
|
203
|
-
console.log(` ${cmd} channels add --channel qqbot --token "
|
|
203
|
+
console.log(` ${cmd} channels add --channel qqbot --token "appid:appsecret"`);
|
|
204
204
|
}
|
|
205
205
|
|
|
206
206
|
// 显示帮助
|
|
207
207
|
function showHelp() {
|
|
208
208
|
console.log(`
|
|
209
|
-
|
|
209
|
+
qqbot CLI - QQ机器人插件管理工具
|
|
210
210
|
|
|
211
211
|
用法:
|
|
212
212
|
npx openclaw-qqbot <命令>
|