@tencent-connect/openclaw-qqbot 1.5.6 → 1.6.0-alpha.1
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 +55 -148
- package/README.zh.md +53 -148
- package/bin/qqbot-cli.js +6 -6
- package/dist/scripts/upgrade-via-npm.sh +168 -0
- package/dist/src/api.d.ts +36 -27
- package/dist/src/api.js +83 -25
- package/dist/src/channel.js +5 -5
- package/dist/src/gateway.js +619 -587
- package/dist/src/image-server.d.ts +7 -1
- package/dist/src/image-server.js +72 -11
- package/dist/src/message-queue.d.ts +267 -0
- package/dist/src/message-queue.js +558 -0
- package/dist/src/outbound.d.ts +53 -0
- package/dist/src/outbound.js +538 -610
- package/dist/src/ref-index-store.d.ts +70 -0
- package/dist/src/ref-index-store.js +274 -0
- package/dist/src/slash-commands.d.ts +61 -0
- package/dist/src/slash-commands.js +211 -0
- package/dist/src/types.d.ts +23 -0
- package/dist/src/user-messages.d.ts +43 -0
- package/dist/src/user-messages.js +65 -0
- package/dist/src/utils/audio-convert.d.ts +18 -8
- package/dist/src/utils/audio-convert.js +63 -93
- package/dist/src/utils/media-tags.js +12 -2
- package/dist/src/utils/platform.d.ts +2 -1
- package/dist/src/utils/platform.js +18 -2
- package/package.json +1 -1
- package/scripts/{upgrade.sh → cleanup-legacy-plugins.sh} +3 -3
- package/scripts/set-markdown.sh +20 -20
- package/scripts/upgrade-via-npm.sh +174 -0
- package/scripts/{upgrade-and-run.sh → upgrade-via-source.sh} +207 -70
- package/skills/qqbot-cron/SKILL.md +46 -423
- package/skills/qqbot-media/SKILL.md +29 -182
- package/src/api.ts +119 -28
- package/src/channel.ts +6 -6
- package/src/gateway.ts +641 -549
- package/src/image-server.ts +76 -11
- package/src/openclaw-plugin-sdk.d.ts +1 -1
- package/src/outbound.ts +592 -626
- package/src/ref-index-store.ts +358 -0
- package/src/slash-commands.ts +287 -0
- package/src/types.ts +24 -1
- package/src/user-messages.ts +73 -0
- package/src/utils/audio-convert.ts +69 -4
- package/src/utils/media-tags.ts +12 -2
- package/src/utils/platform.ts +16 -2
- package/scripts/draw_arch.py +0 -174
- package/scripts/npm-upgrade.sh +0 -120
- package/scripts/pull-latest.sh +0 -316
package/README.md
CHANGED
|
@@ -6,14 +6,19 @@
|
|
|
6
6
|
|
|
7
7
|
# QQ Bot Channel Plugin for OpenClaw
|
|
8
8
|
|
|
9
|
+
|
|
10
|
+
|
|
9
11
|
**Connect your AI assistant to QQ — private chat, group chat, and rich media, all in one plugin.**
|
|
10
12
|
|
|
13
|
+
### 🚀 Current Version: `v1.5.7`
|
|
14
|
+
|
|
11
15
|
[](./LICENSE)
|
|
12
16
|
[](https://bot.q.qq.com/wiki/)
|
|
13
17
|
[](https://github.com/tencent-connect/openclaw-qqbot)
|
|
14
18
|
[](https://nodejs.org/)
|
|
15
19
|
[](https://www.typescriptlang.org/)
|
|
16
20
|
|
|
21
|
+
|
|
17
22
|
<br/>
|
|
18
23
|
|
|
19
24
|
**[简体中文](README.zh.md) | English**
|
|
@@ -40,6 +45,7 @@ Scan to join the QQ group chat
|
|
|
40
45
|
| 🔄 **Hot Reload** | Install via npm with seamless hot updates |
|
|
41
46
|
| 📝 **Markdown** | Full Markdown formatting support |
|
|
42
47
|
| 🛠️ **Commands** | Native OpenClaw command integration |
|
|
48
|
+
| 💬 **Quoted Context** | Resolve QQ `REFIDX_*` quoted messages and inject quote body into AI context |
|
|
43
49
|
|
|
44
50
|
---
|
|
45
51
|
|
|
@@ -47,6 +53,16 @@ Scan to join the QQ group chat
|
|
|
47
53
|
|
|
48
54
|
> **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
55
|
|
|
56
|
+
### 💬 Quoted Message Context (REFIDX)
|
|
57
|
+
|
|
58
|
+
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”.
|
|
59
|
+
|
|
60
|
+
- Inbound and outbound messages with `ref_idx` are automatically indexed.
|
|
61
|
+
- Store path: `~/.openclaw/qqbot/data/ref-index.jsonl` (survives gateway restart).
|
|
62
|
+
- Quote body may include text + media summary (image/voice/video/file).
|
|
63
|
+
|
|
64
|
+
<img width="360" src="docs/images/ref_msg.png" alt="Quoted Message Context Demo" />
|
|
65
|
+
|
|
50
66
|
### 🎙️ Voice Messages (STT)
|
|
51
67
|
|
|
52
68
|
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.
|
|
@@ -77,7 +93,7 @@ If your main model supports vision (e.g. Tencent Hunyuan `hunyuan-vision`), AI c
|
|
|
77
93
|
|
|
78
94
|
<img width="360" src="docs/images/59d421891f813b0d3c0cbe12574b6a72_720.jpg" alt="Image Understanding Demo" />
|
|
79
95
|
|
|
80
|
-
### 🎨 Image
|
|
96
|
+
### 🎨 Image Sending
|
|
81
97
|
|
|
82
98
|
> **You**: Draw me a cat
|
|
83
99
|
>
|
|
@@ -87,7 +103,7 @@ AI sends images via `<qqimg>path</qqimg>`. Supports local paths and URLs. Format
|
|
|
87
103
|
|
|
88
104
|
<img width="360" src="docs/images/4645f2b3a20822b7f8d6664a708529eb_720.jpg" alt="Image Generation Demo" />
|
|
89
105
|
|
|
90
|
-
### 🔊 Voice
|
|
106
|
+
### 🔊 Voice Sending
|
|
91
107
|
|
|
92
108
|
> **You**: Tell me a joke in voice
|
|
93
109
|
>
|
|
@@ -164,61 +180,62 @@ AI sends videos via `<qqvideo>path</qqvideo>`. Supports local files and URLs. La
|
|
|
164
180
|
|
|
165
181
|
> For a step-by-step walkthrough with screenshots, see the [official guide](https://cloud.tencent.com/developer/article/2626045).
|
|
166
182
|
|
|
167
|
-
### Step 2 — Install the Plugin
|
|
183
|
+
### Step 2 — Install / Upgrade the Plugin
|
|
168
184
|
|
|
169
|
-
**Option A:
|
|
185
|
+
**Option A: Remote One-Liner (Easiest, no clone required)**
|
|
170
186
|
|
|
171
187
|
```bash
|
|
172
|
-
|
|
188
|
+
curl -fsSL https://raw.githubusercontent.com/tencent-connect/openclaw-qqbot/main/scripts/upgrade-via-npm.sh \
|
|
189
|
+
| bash -s -- --appid YOUR_APPID --secret YOUR_SECRET
|
|
173
190
|
```
|
|
174
191
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
```bash
|
|
178
|
-
git clone https://github.com/tencent-connect/openclaw-qqbot.git && cd openclaw-qqbot
|
|
179
|
-
bash ./scripts/upgrade-and-run.sh --appid YOUR_APPID --secret YOUR_SECRET
|
|
180
|
-
```
|
|
192
|
+
One command does it all: download script → cleanup old plugins → install → configure channel → restart service. Once done, open QQ and start chatting!
|
|
181
193
|
|
|
182
|
-
|
|
194
|
+
> `--appid` and `--secret` are **required for first-time install**. For subsequent upgrades:
|
|
195
|
+
> ```bash
|
|
196
|
+
> curl -fsSL https://raw.githubusercontent.com/tencent-connect/openclaw-qqbot/main/scripts/upgrade-via-npm.sh | bash
|
|
197
|
+
> ```
|
|
183
198
|
|
|
184
|
-
**Option
|
|
199
|
+
**Option B: Local Script (if you've cloned the repo)**
|
|
185
200
|
|
|
186
201
|
```bash
|
|
187
|
-
|
|
188
|
-
npm
|
|
189
|
-
|
|
202
|
+
# Via npm
|
|
203
|
+
bash ./scripts/upgrade-via-npm.sh --appid YOUR_APPID --secret YOUR_SECRET
|
|
204
|
+
|
|
205
|
+
# Or via source
|
|
206
|
+
bash ./scripts/upgrade-via-source.sh --appid YOUR_APPID --secret YOUR_SECRET
|
|
190
207
|
```
|
|
191
208
|
|
|
192
|
-
|
|
209
|
+
**Common flags:**
|
|
193
210
|
|
|
194
|
-
|
|
211
|
+
| Flag | Description |
|
|
212
|
+
|------|-------------|
|
|
213
|
+
| `--appid <id> --secret <secret>` | Configure channel (required for first install, or to change credentials) |
|
|
214
|
+
| `--version <version>` | Install a specific version (npm script only) |
|
|
215
|
+
| `--self-version` | Install the version from local `package.json` (npm script only) |
|
|
216
|
+
| `-h` / `--help` | Show full usage |
|
|
195
217
|
|
|
196
|
-
|
|
197
|
-
openclaw channels add --channel qqbot --token "AppID:AppSecret"
|
|
198
|
-
```
|
|
218
|
+
> Environment variables `QQBOT_APPID` / `QQBOT_SECRET` are also supported.
|
|
199
219
|
|
|
200
|
-
**Option
|
|
220
|
+
**Option C: Manual Install / Upgrade**
|
|
201
221
|
|
|
202
|
-
|
|
222
|
+
```bash
|
|
223
|
+
# Uninstall old plugins (skip if first install)
|
|
224
|
+
openclaw plugins uninstall qqbot
|
|
225
|
+
openclaw plugins uninstall openclaw-qqbot
|
|
203
226
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
"channels": {
|
|
207
|
-
"qqbot": {
|
|
208
|
-
"enabled": true,
|
|
209
|
-
"appId": "Your AppID",
|
|
210
|
-
"clientSecret": "Your AppSecret"
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
```
|
|
227
|
+
# Install latest
|
|
228
|
+
openclaw plugins install @tencent-connect/openclaw-qqbot@latest
|
|
215
229
|
|
|
216
|
-
|
|
230
|
+
# Configure channel (first install only)
|
|
231
|
+
openclaw channels add --channel qqbot --token "AppID:AppSecret"
|
|
217
232
|
|
|
218
|
-
|
|
219
|
-
openclaw gateway
|
|
233
|
+
# Start / restart
|
|
234
|
+
openclaw gateway restart
|
|
220
235
|
```
|
|
221
236
|
|
|
237
|
+
### Step 3 — Test
|
|
238
|
+
|
|
222
239
|
Open QQ, find your bot, and send a message!
|
|
223
240
|
|
|
224
241
|
<div align="center">
|
|
@@ -366,119 +383,9 @@ STT supports two-level configuration with priority fallback:
|
|
|
366
383
|
|
|
367
384
|
---
|
|
368
385
|
|
|
369
|
-
## 🔄 Upgrade
|
|
370
|
-
|
|
371
|
-
### Option 1: Upgrade via npm (Recommended)
|
|
372
|
-
|
|
373
|
-
Current latest npm version: `1.5.6`
|
|
374
|
-
|
|
375
|
-
```bash
|
|
376
|
-
bash ./scripts/npm-upgrade.sh
|
|
377
|
-
```
|
|
378
|
-
|
|
379
|
-
The script automatically backs up channel config → uninstalls old plugins → installs new version → restores config → restarts gateway.
|
|
380
|
-
|
|
381
|
-
```bash
|
|
382
|
-
# Specify exact version
|
|
383
|
-
bash ./scripts/npm-upgrade.sh --version 1.5.6
|
|
384
|
-
```
|
|
385
|
-
|
|
386
|
-
### Option 2: Upgrade via Source
|
|
387
|
-
|
|
388
|
-
Run the one-click script to upgrade and restart:
|
|
389
|
-
|
|
390
|
-
```bash
|
|
391
|
-
bash ./scripts/upgrade-and-run.sh
|
|
392
|
-
```
|
|
393
|
-
|
|
394
|
-
When no `--appid` / `--secret` is provided, the script reads existing config from `~/.openclaw/openclaw.json` automatically.
|
|
395
|
-
|
|
396
|
-
```bash
|
|
397
|
-
# First-time or override credentials
|
|
398
|
-
bash ./scripts/upgrade-and-run.sh --appid YOUR_APPID --secret YOUR_SECRET
|
|
399
|
-
```
|
|
400
|
-
|
|
401
|
-
<details>
|
|
402
|
-
<summary>Full Options</summary>
|
|
403
|
-
|
|
404
|
-
| Option | Description |
|
|
405
|
-
|--------|-------------|
|
|
406
|
-
| `--appid <id>` | QQ Bot AppID |
|
|
407
|
-
| `--secret <secret>` | QQ Bot AppSecret |
|
|
408
|
-
| `--markdown <yes\|no>` | Enable Markdown format (default: no) |
|
|
409
|
-
| `-h, --help` | Show help |
|
|
410
|
-
|
|
411
|
-
Environment variables `QQBOT_APPID`, `QQBOT_SECRET`, `QQBOT_TOKEN` (AppID:Secret) are also supported.
|
|
412
|
-
|
|
413
|
-
</details>
|
|
414
|
-
|
|
415
|
-
---
|
|
416
|
-
|
|
417
|
-
## 🔀 Migrating from Legacy Plugins
|
|
418
|
-
|
|
419
|
-
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.
|
|
420
|
-
|
|
421
|
-
### Recommended: Use npm-upgrade Script (Automatic)
|
|
422
|
-
|
|
423
|
-
```bash
|
|
424
|
-
bash ./scripts/npm-upgrade.sh
|
|
425
|
-
```
|
|
426
|
-
|
|
427
|
-
The script automatically uninstalls all legacy plugin variants (`qqbot`, `@sliverp/qqbot`, `openclaw-qq`, etc.), cleans up residual directories, and backs up/restores channel config.
|
|
428
|
-
|
|
429
|
-
### Manual Migration
|
|
430
|
-
|
|
431
|
-
**1. Back up your channel config**
|
|
432
|
-
|
|
433
|
-
Save the `channels.qqbot` section from `~/.openclaw/openclaw.json` (including `appId`, `clientSecret`, `allowFrom`, etc.) — you'll need to restore it later.
|
|
434
|
-
|
|
435
|
-
**2. Uninstall old plugins**
|
|
436
|
-
|
|
437
|
-
Run the appropriate uninstall command(s) based on what you had installed:
|
|
438
|
-
|
|
439
|
-
```bash
|
|
440
|
-
# Uninstall legacy plugin variants (pick the ones that apply)
|
|
441
|
-
openclaw plugins uninstall qqbot
|
|
442
|
-
openclaw plugins uninstall @sliverp/qqbot
|
|
443
|
-
openclaw plugins uninstall @tencent-connect/qqbot
|
|
444
|
-
openclaw plugins uninstall openclaw-qqbot
|
|
445
|
-
openclaw plugins uninstall openclaw-qq
|
|
446
|
-
```
|
|
447
|
-
|
|
448
|
-
If `plugins uninstall` doesn't fully clean up, manually remove residual directories:
|
|
449
|
-
|
|
450
|
-
```bash
|
|
451
|
-
rm -rf ~/.openclaw/extensions/qqbot
|
|
452
|
-
rm -rf ~/.openclaw/extensions/openclaw-qqbot
|
|
453
|
-
rm -rf ~/.openclaw/extensions/openclaw-qq
|
|
454
|
-
```
|
|
455
|
-
|
|
456
|
-
**3. Temporarily remove channel config**
|
|
457
|
-
|
|
458
|
-
> ⚠️ 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`.
|
|
459
|
-
|
|
460
|
-
Before installing, temporarily remove the `channels.qqbot` section from `~/.openclaw/openclaw.json`.
|
|
461
|
-
|
|
462
|
-
**4. Install the new version**
|
|
463
|
-
|
|
464
|
-
```bash
|
|
465
|
-
openclaw plugins install @tencent-connect/openclaw-qqbot
|
|
466
|
-
```
|
|
467
|
-
|
|
468
|
-
**5. Restore channel config**
|
|
469
|
-
|
|
470
|
-
Write back the previously saved `channels.qqbot` config to `~/.openclaw/openclaw.json`.
|
|
471
|
-
|
|
472
|
-
**6. Restart the gateway**
|
|
473
|
-
|
|
474
|
-
```bash
|
|
475
|
-
openclaw gateway restart
|
|
476
|
-
```
|
|
477
|
-
|
|
478
|
-
---
|
|
479
|
-
|
|
480
386
|
## 📚 Documentation & Links
|
|
481
387
|
|
|
388
|
+
- [Upgrade Guide](docs/UPGRADE_GUIDE.md) — full upgrade paths and migration notes
|
|
482
389
|
- [Command Reference](docs/commands.md) — OpenClaw CLI commands
|
|
483
390
|
- [Changelog](CHANGELOG.md) — release notes
|
|
484
391
|
|
package/README.zh.md
CHANGED
|
@@ -6,8 +6,11 @@
|
|
|
6
6
|
|
|
7
7
|
# QQ Bot — OpenClaw 渠道插件
|
|
8
8
|
|
|
9
|
+
|
|
9
10
|
**让你的 AI 助手接入 QQ — 私聊、群聊、富媒体,一个插件全搞定。**
|
|
10
11
|
|
|
12
|
+
### 🚀 当前版本: `v1.5.7`
|
|
13
|
+
|
|
11
14
|
[](./LICENSE)
|
|
12
15
|
[](https://bot.q.qq.com/wiki/)
|
|
13
16
|
[](https://github.com/tencent-connect/openclaw-qqbot)
|
|
@@ -37,6 +40,7 @@
|
|
|
37
40
|
| 🔄 **热更新** | 支持 npm 方式安装和无缝热更新 |
|
|
38
41
|
| 📝 **Markdown** | 完整支持 Markdown 格式消息 |
|
|
39
42
|
| 🛠️ **原生命令** | 支持 OpenClaw 原生命令 |
|
|
43
|
+
| 💬 **引用上下文** | 解析 QQ `REFIDX_*` 引用消息,并将引用内容注入 AI 上下文 |
|
|
40
44
|
|
|
41
45
|
---
|
|
42
46
|
|
|
@@ -44,6 +48,16 @@
|
|
|
44
48
|
|
|
45
49
|
> **说明:** 本插件仅作为**消息通道**,负责在 QQ 和 OpenClaw 之间传递消息。图片理解、语音转录、AI 画图等能力取决于你配置的 **AI 模型**以及在 OpenClaw 中安装的 **skill**,而非插件本身提供。
|
|
46
50
|
|
|
51
|
+
### 💬 引用消息上下文(REFIDX)
|
|
52
|
+
|
|
53
|
+
QQ 的引用事件通常只携带索引键(如 `REFIDX_xxx`),不直接返回原始消息全文。插件已支持从本地持久化索引中解析引用内容,并注入 AI 上下文,帮助模型更准确理解“用户引用的是哪条消息”。
|
|
54
|
+
|
|
55
|
+
- 入站/出站消息中的 `ref_idx` 会自动建立索引。
|
|
56
|
+
- 存储位置:`~/.openclaw/qqbot/data/ref-index.jsonl`(网关重启后仍可恢复)。
|
|
57
|
+
- 引用内容支持文本 + 媒体摘要(图片/语音/视频/文件)。
|
|
58
|
+
|
|
59
|
+
<img width="360" src="docs/images/ref_msg.png" alt="引用消息上下文演示" />
|
|
60
|
+
|
|
47
61
|
### 🎙️ 语音消息(STT)
|
|
48
62
|
|
|
49
63
|
配置 STT 后,插件会自动将语音转录为文字再交给 AI 处理。整个过程对用户完全透明——发语音就像发文字一样自然,AI 听得懂你在说什么。
|
|
@@ -74,7 +88,7 @@
|
|
|
74
88
|
|
|
75
89
|
<img width="360" src="docs/images/59d421891f813b0d3c0cbe12574b6a72_720.jpg" alt="图片理解演示" />
|
|
76
90
|
|
|
77
|
-
### 🎨
|
|
91
|
+
### 🎨 图片发送
|
|
78
92
|
|
|
79
93
|
> **你**:画一只猫咪
|
|
80
94
|
>
|
|
@@ -84,7 +98,7 @@ AI 通过 `<qqimg>路径</qqimg>` 发送图片,支持本地文件路径和网
|
|
|
84
98
|
|
|
85
99
|
<img width="360" src="docs/images/4645f2b3a20822b7f8d6664a708529eb_720.jpg" alt="发图片演示" />
|
|
86
100
|
|
|
87
|
-
### 🔊
|
|
101
|
+
### 🔊 语音发送
|
|
88
102
|
|
|
89
103
|
> **你**:给我讲一个笑话
|
|
90
104
|
>
|
|
@@ -161,61 +175,62 @@ AI 通过 `<qqvideo>路径</qqvideo>` 发送视频,支持本地文件和公网
|
|
|
161
175
|
|
|
162
176
|
> 详细图文教程请参阅 [官方指南](https://cloud.tencent.com/developer/article/2626045)。
|
|
163
177
|
|
|
164
|
-
### 第二步 —
|
|
178
|
+
### 第二步 — 安装 / 升级插件
|
|
165
179
|
|
|
166
|
-
|
|
180
|
+
**方式一:远程一键执行(最简单,无需 clone 仓库)**
|
|
167
181
|
|
|
168
182
|
```bash
|
|
169
|
-
|
|
183
|
+
curl -fsSL https://raw.githubusercontent.com/tencent-connect/openclaw-qqbot/main/scripts/upgrade-via-npm.sh \
|
|
184
|
+
| bash -s -- --appid YOUR_APPID --secret YOUR_SECRET
|
|
170
185
|
```
|
|
171
186
|
|
|
172
|
-
|
|
187
|
+
一行命令搞定:下载脚本 → 清理旧插件 → 安装 → 配置通道 → 启动服务。完成后打开 QQ 即可开始聊天!
|
|
173
188
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
```
|
|
178
|
-
|
|
179
|
-
脚本会自动完成:清理旧插件 → 安装依赖 → 注册插件 → 配置通道 → 启动服务。完成后可直接跳到[第四步](#第四步--启动并测试)。
|
|
189
|
+
> 首次安装**必须**传 `--appid` 和 `--secret`。后续升级如已有配置:
|
|
190
|
+
> ```bash
|
|
191
|
+
> curl -fsSL https://raw.githubusercontent.com/tencent-connect/openclaw-qqbot/main/scripts/upgrade-via-npm.sh | bash
|
|
192
|
+
> ```
|
|
180
193
|
|
|
181
|
-
|
|
194
|
+
**方式二:本地脚本(已 clone 仓库时使用)**
|
|
182
195
|
|
|
183
196
|
```bash
|
|
184
|
-
|
|
185
|
-
npm
|
|
186
|
-
|
|
197
|
+
# 通过 npm 安装
|
|
198
|
+
bash ./scripts/upgrade-via-npm.sh --appid YOUR_APPID --secret YOUR_SECRET
|
|
199
|
+
|
|
200
|
+
# 或通过源码安装
|
|
201
|
+
bash ./scripts/upgrade-via-source.sh --appid YOUR_APPID --secret YOUR_SECRET
|
|
187
202
|
```
|
|
188
203
|
|
|
189
|
-
|
|
204
|
+
**常用参数:**
|
|
190
205
|
|
|
191
|
-
|
|
206
|
+
| 参数 | 说明 |
|
|
207
|
+
|------|------|
|
|
208
|
+
| `--appid <id> --secret <secret>` | 配置通道(首次安装必填,或更换凭证时使用) |
|
|
209
|
+
| `--version <版本号>` | 安装指定版本(仅 npm 脚本) |
|
|
210
|
+
| `--self-version` | 安装本地 `package.json` 中的版本(仅 npm 脚本) |
|
|
211
|
+
| `-h` / `--help` | 查看完整用法 |
|
|
192
212
|
|
|
193
|
-
|
|
194
|
-
openclaw channels add --channel qqbot --token "AppID:AppSecret"
|
|
195
|
-
```
|
|
213
|
+
> 也可通过环境变量 `QQBOT_APPID` / `QQBOT_SECRET` 设置。
|
|
196
214
|
|
|
197
|
-
|
|
215
|
+
**方式三:手动安装 / 升级**
|
|
198
216
|
|
|
199
|
-
|
|
217
|
+
```bash
|
|
218
|
+
# 卸载旧插件(首次安装可跳过)
|
|
219
|
+
openclaw plugins uninstall qqbot
|
|
220
|
+
openclaw plugins uninstall openclaw-qqbot
|
|
200
221
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
"channels": {
|
|
204
|
-
"qqbot": {
|
|
205
|
-
"enabled": true,
|
|
206
|
-
"appId": "你的 AppID",
|
|
207
|
-
"clientSecret": "你的 AppSecret"
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
```
|
|
222
|
+
# 安装最新版本
|
|
223
|
+
openclaw plugins install @tencent-connect/openclaw-qqbot@latest
|
|
212
224
|
|
|
213
|
-
|
|
225
|
+
# 配置通道(首次安装必做)
|
|
226
|
+
openclaw channels add --channel qqbot --token "AppID:AppSecret"
|
|
214
227
|
|
|
215
|
-
|
|
216
|
-
openclaw gateway
|
|
228
|
+
# 启动 / 重启
|
|
229
|
+
openclaw gateway restart
|
|
217
230
|
```
|
|
218
231
|
|
|
232
|
+
### 第三步 — 测试
|
|
233
|
+
|
|
219
234
|
打开 QQ,找到你的机器人,发条消息试试!
|
|
220
235
|
|
|
221
236
|
<div align="center">
|
|
@@ -363,119 +378,9 @@ STT 支持两级配置,按优先级查找:
|
|
|
363
378
|
|
|
364
379
|
---
|
|
365
380
|
|
|
366
|
-
## 🔄 升级
|
|
367
|
-
|
|
368
|
-
### 方式一:通过 npm 升级(推荐)
|
|
369
|
-
|
|
370
|
-
当前最新 npm 版本:`1.5.6`
|
|
371
|
-
|
|
372
|
-
```bash
|
|
373
|
-
bash ./scripts/npm-upgrade.sh
|
|
374
|
-
```
|
|
375
|
-
|
|
376
|
-
脚本会自动备份通道配置 → 卸载旧插件 → 安装新版本 → 恢复配置 → 重启网关。
|
|
377
|
-
|
|
378
|
-
```bash
|
|
379
|
-
# 指定版本号
|
|
380
|
-
bash ./scripts/npm-upgrade.sh --version 1.5.6
|
|
381
|
-
```
|
|
382
|
-
|
|
383
|
-
### 方式二:通过源码升级
|
|
384
|
-
|
|
385
|
-
运行一键脚本即可升级并重启:
|
|
386
|
-
|
|
387
|
-
```bash
|
|
388
|
-
bash ./scripts/upgrade-and-run.sh
|
|
389
|
-
```
|
|
390
|
-
|
|
391
|
-
不传 `--appid` / `--secret` 参数时,脚本会自动读取 `~/.openclaw/openclaw.json` 中已有的配置。
|
|
392
|
-
|
|
393
|
-
```bash
|
|
394
|
-
# 首次配置或需要覆盖时
|
|
395
|
-
bash ./scripts/upgrade-and-run.sh --appid YOUR_APPID --secret YOUR_SECRET
|
|
396
|
-
```
|
|
397
|
-
|
|
398
|
-
<details>
|
|
399
|
-
<summary>完整选项</summary>
|
|
400
|
-
|
|
401
|
-
| 选项 | 说明 |
|
|
402
|
-
|------|------|
|
|
403
|
-
| `--appid <id>` | QQ 机器人 AppID |
|
|
404
|
-
| `--secret <secret>` | QQ 机器人 AppSecret |
|
|
405
|
-
| `--markdown <yes\|no>` | 是否启用 Markdown 消息格式(默认: no) |
|
|
406
|
-
| `-h, --help` | 显示帮助 |
|
|
407
|
-
|
|
408
|
-
也支持环境变量:`QQBOT_APPID`、`QQBOT_SECRET`、`QQBOT_TOKEN`(AppID:Secret)。
|
|
409
|
-
|
|
410
|
-
</details>
|
|
411
|
-
|
|
412
|
-
---
|
|
413
|
-
|
|
414
|
-
## 🔀 从旧版插件迁移
|
|
415
|
-
|
|
416
|
-
如果你之前安装的是 `qqbot`、`@sliverp/qqbot`、`@tencent-connect/qqbot` 等关联插件,需要先卸载旧插件再安装新版本。
|
|
417
|
-
|
|
418
|
-
### 推荐:使用 npm-upgrade 脚本(自动处理)
|
|
419
|
-
|
|
420
|
-
```bash
|
|
421
|
-
bash ./scripts/npm-upgrade.sh
|
|
422
|
-
```
|
|
423
|
-
|
|
424
|
-
脚本会自动卸载所有历史版本的插件(`qqbot`、`@sliverp/qqbot`、`openclaw-qq` 等)、清理残留目录、备份恢复通道配置。
|
|
425
|
-
|
|
426
|
-
### 手动迁移
|
|
427
|
-
|
|
428
|
-
**1. 备份你的通道配置**
|
|
429
|
-
|
|
430
|
-
先记录 `~/.openclaw/openclaw.json` 中 `channels.qqbot` 的内容(`appId`、`clientSecret`、`allowFrom` 等),后续需要恢复。
|
|
431
|
-
|
|
432
|
-
**2. 卸载旧插件**
|
|
433
|
-
|
|
434
|
-
根据你之前安装的插件名,执行对应的卸载命令:
|
|
435
|
-
|
|
436
|
-
```bash
|
|
437
|
-
# 卸载可能存在的旧版插件(按实际情况选择)
|
|
438
|
-
openclaw plugins uninstall qqbot
|
|
439
|
-
openclaw plugins uninstall @sliverp/qqbot
|
|
440
|
-
openclaw plugins uninstall @tencent-connect/qqbot
|
|
441
|
-
openclaw plugins uninstall openclaw-qqbot
|
|
442
|
-
openclaw plugins uninstall openclaw-qq
|
|
443
|
-
```
|
|
444
|
-
|
|
445
|
-
如果 `plugins uninstall` 未能完全清理,手动删除残留目录:
|
|
446
|
-
|
|
447
|
-
```bash
|
|
448
|
-
rm -rf ~/.openclaw/extensions/qqbot
|
|
449
|
-
rm -rf ~/.openclaw/extensions/openclaw-qqbot
|
|
450
|
-
rm -rf ~/.openclaw/extensions/openclaw-qq
|
|
451
|
-
```
|
|
452
|
-
|
|
453
|
-
**3. 临时移除通道配置**
|
|
454
|
-
|
|
455
|
-
> ⚠️ 重要:`openclaw plugins install` 会校验配置文件。如果配置中存在 `channels.qqbot` 但对应插件尚未安装,会报 `unknown channel id: qqbot` 错误并拒绝安装。
|
|
456
|
-
|
|
457
|
-
安装前需要临时从 `~/.openclaw/openclaw.json` 中移除 `channels.qqbot` 配置段。
|
|
458
|
-
|
|
459
|
-
**4. 安装新版本**
|
|
460
|
-
|
|
461
|
-
```bash
|
|
462
|
-
openclaw plugins install @tencent-connect/openclaw-qqbot
|
|
463
|
-
```
|
|
464
|
-
|
|
465
|
-
**5. 恢复通道配置**
|
|
466
|
-
|
|
467
|
-
将之前备份的 `channels.qqbot` 配置写回 `~/.openclaw/openclaw.json`。
|
|
468
|
-
|
|
469
|
-
**6. 重启网关**
|
|
470
|
-
|
|
471
|
-
```bash
|
|
472
|
-
openclaw gateway restart
|
|
473
|
-
```
|
|
474
|
-
|
|
475
|
-
---
|
|
476
|
-
|
|
477
381
|
## 📚 文档与链接
|
|
478
382
|
|
|
383
|
+
- [升级指南](docs/UPGRADE_GUIDE.zh.md) — 完整升级路径与迁移说明
|
|
479
384
|
- [命令参考](docs/commands.md) — OpenClaw CLI 常用命令
|
|
480
385
|
- [更新日志](CHANGELOG.md) — 各版本变更记录
|
|
481
386
|
|
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 <命令>
|