@tencent-connect/openclaw-qqbot 1.5.6 → 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 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.
@@ -164,61 +173,62 @@ AI sends videos via `<qqvideo>path</qqvideo>`. Supports local files and URLs. La
164
173
 
165
174
  > For a step-by-step walkthrough with screenshots, see the [official guide](https://cloud.tencent.com/developer/article/2626045).
166
175
 
167
- ### Step 2 — Install the Plugin
176
+ ### Step 2 — Install / Upgrade the Plugin
168
177
 
169
- **Option A: Install via npm (Recommended)**
178
+ **Option A: Remote One-Liner (Easiest, no clone required)**
170
179
 
171
180
  ```bash
172
- openclaw plugins install @tencent-connect/openclaw-qqbot
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
173
183
  ```
174
184
 
175
- **Option B: One-Click Install & Run**
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
- ```
185
+ One command does it all: download script cleanup old plugins → install → configure channel → restart service. Once done, open QQ and start chatting!
181
186
 
182
- The script handles everything: cleanup old plugins install deps register plugin → configure channel → start service. Once done, skip to [Step 4](#step-4--start--test).
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
+ > ```
183
191
 
184
- **Option C: Manual Step-by-Step**
192
+ **Option B: Local Script (if you've cloned the repo)**
185
193
 
186
194
  ```bash
187
- git clone https://github.com/tencent-connect/openclaw-qqbot.git && cd openclaw-qqbot
188
- npm install --omit=dev
189
- openclaw plugins install .
195
+ # Via npm
196
+ bash ./scripts/upgrade-via-npm.sh --appid YOUR_APPID --secret YOUR_SECRET
197
+
198
+ # Or via source
199
+ bash ./scripts/upgrade-via-source.sh --appid YOUR_APPID --secret YOUR_SECRET
190
200
  ```
191
201
 
192
- ### Step 3 — Configure OpenClaw
202
+ **Common flags:**
193
203
 
194
- **Option 1: CLI Wizard (Recommended)**
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 |
195
210
 
196
- ```bash
197
- openclaw channels add --channel qqbot --token "AppID:AppSecret"
198
- ```
211
+ > Environment variables `QQBOT_APPID` / `QQBOT_SECRET` are also supported.
199
212
 
200
- **Option 2: Edit Config File**
213
+ **Option C: Manual Install / Upgrade**
201
214
 
202
- Edit `~/.openclaw/openclaw.json`:
215
+ ```bash
216
+ # Uninstall old plugins (skip if first install)
217
+ openclaw plugins uninstall qqbot
218
+ openclaw plugins uninstall openclaw-qqbot
203
219
 
204
- ```json
205
- {
206
- "channels": {
207
- "qqbot": {
208
- "enabled": true,
209
- "appId": "Your AppID",
210
- "clientSecret": "Your AppSecret"
211
- }
212
- }
213
- }
214
- ```
220
+ # Install latest
221
+ openclaw plugins install @tencent-connect/openclaw-qqbot@latest
215
222
 
216
- ### Step 4 Start & Test
223
+ # Configure channel (first install only)
224
+ openclaw channels add --channel qqbot --token "AppID:AppSecret"
217
225
 
218
- ```bash
219
- openclaw gateway
226
+ # Start / restart
227
+ openclaw gateway restart
220
228
  ```
221
229
 
230
+ ### Step 3 — Test
231
+
222
232
  Open QQ, find your bot, and send a message!
223
233
 
224
234
  <div align="center">
@@ -366,119 +376,9 @@ STT supports two-level configuration with priority fallback:
366
376
 
367
377
  ---
368
378
 
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
379
  ## 📚 Documentation & Links
481
380
 
381
+ - [Upgrade Guide](docs/UPGRADE_GUIDE.md) — full upgrade paths and migration notes
482
382
  - [Command Reference](docs/commands.md) — OpenClaw CLI commands
483
383
  - [Changelog](CHANGELOG.md) — release notes
484
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 听得懂你在说什么。
@@ -161,61 +170,62 @@ AI 通过 `<qqvideo>路径</qqvideo>` 发送视频,支持本地文件和公网
161
170
 
162
171
  > 详细图文教程请参阅 [官方指南](https://cloud.tencent.com/developer/article/2626045)。
163
172
 
164
- ### 第二步 — 安装插件
173
+ ### 第二步 — 安装 / 升级插件
165
174
 
166
- **方式一:通过 npm 安装(推荐)**
175
+ **方式一:远程一键执行(最简单,无需 clone 仓库)**
167
176
 
168
177
  ```bash
169
- openclaw plugins install @tencent-connect/openclaw-qqbot
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
170
180
  ```
171
181
 
172
- **方式二:一键安装并启动**
173
-
174
- ```bash
175
- git clone https://github.com/tencent-connect/openclaw-qqbot.git && cd openclaw-qqbot
176
- bash ./scripts/upgrade-and-run.sh --appid YOUR_APPID --secret YOUR_SECRET
177
- ```
182
+ 一行命令搞定:下载脚本 → 清理旧插件 → 安装 → 配置通道 → 启动服务。完成后打开 QQ 即可开始聊天!
178
183
 
179
- 脚本会自动完成:清理旧插件 安装依赖 注册插件 → 配置通道 → 启动服务。完成后可直接跳到[第四步](#第四步--启动并测试)。
184
+ > 首次安装**必须**传 `--appid` `--secret`。后续升级如已有配置:
185
+ > ```bash
186
+ > curl -fsSL https://raw.githubusercontent.com/tencent-connect/openclaw-qqbot/main/scripts/upgrade-via-npm.sh | bash
187
+ > ```
180
188
 
181
- **方式三:手动分步安装**
189
+ **方式二:本地脚本(已 clone 仓库时使用)**
182
190
 
183
191
  ```bash
184
- git clone https://github.com/tencent-connect/openclaw-qqbot.git && cd openclaw-qqbot
185
- npm install --omit=dev
186
- openclaw plugins install .
192
+ # 通过 npm 安装
193
+ bash ./scripts/upgrade-via-npm.sh --appid YOUR_APPID --secret YOUR_SECRET
194
+
195
+ # 或通过源码安装
196
+ bash ./scripts/upgrade-via-source.sh --appid YOUR_APPID --secret YOUR_SECRET
187
197
  ```
188
198
 
189
- ### 第三步 — 配置 OpenClaw
199
+ **常用参数:**
190
200
 
191
- **方式一:通过 Wizard 配置(推荐)**
201
+ | 参数 | 说明 |
202
+ |------|------|
203
+ | `--appid <id> --secret <secret>` | 配置通道(首次安装必填,或更换凭证时使用) |
204
+ | `--version <版本号>` | 安装指定版本(仅 npm 脚本) |
205
+ | `--self-version` | 安装本地 `package.json` 中的版本(仅 npm 脚本) |
206
+ | `-h` / `--help` | 查看完整用法 |
192
207
 
193
- ```bash
194
- openclaw channels add --channel qqbot --token "AppID:AppSecret"
195
- ```
208
+ > 也可通过环境变量 `QQBOT_APPID` / `QQBOT_SECRET` 设置。
196
209
 
197
- **方式二:编辑配置文件**
210
+ **方式三:手动安装 / 升级**
198
211
 
199
- 编辑 `~/.openclaw/openclaw.json`:
212
+ ```bash
213
+ # 卸载旧插件(首次安装可跳过)
214
+ openclaw plugins uninstall qqbot
215
+ openclaw plugins uninstall openclaw-qqbot
200
216
 
201
- ```json
202
- {
203
- "channels": {
204
- "qqbot": {
205
- "enabled": true,
206
- "appId": "你的 AppID",
207
- "clientSecret": "你的 AppSecret"
208
- }
209
- }
210
- }
211
- ```
217
+ # 安装最新版本
218
+ openclaw plugins install @tencent-connect/openclaw-qqbot@latest
212
219
 
213
- ### 第四步 — 启动与测试
220
+ # 配置通道(首次安装必做)
221
+ openclaw channels add --channel qqbot --token "AppID:AppSecret"
214
222
 
215
- ```bash
216
- openclaw gateway
223
+ # 启动 / 重启
224
+ openclaw gateway restart
217
225
  ```
218
226
 
227
+ ### 第三步 — 测试
228
+
219
229
  打开 QQ,找到你的机器人,发条消息试试!
220
230
 
221
231
  <div align="center">
@@ -363,119 +373,9 @@ STT 支持两级配置,按优先级查找:
363
373
 
364
374
  ---
365
375
 
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
376
  ## 📚 文档与链接
478
377
 
378
+ - [升级指南](docs/UPGRADE_GUIDE.zh.md) — 完整升级路径与迁移说明
479
379
  - [命令参考](docs/commands.md) — OpenClaw CLI 常用命令
480
380
  - [更新日志](CHANGELOG.md) — 各版本变更记录
481
381
 
package/bin/qqbot-cli.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  /**
4
- * QQBot CLI - 用于升级和管理 QQBot 插件
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('=== QQBot 插件升级脚本 ===');
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 "AppID:AppSecret"`);
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('=== QQBot 插件安装 ===');
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 "AppID:AppSecret"`);
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
- QQBot CLI - QQ机器人插件管理工具
209
+ qqbot CLI - QQ机器人插件管理工具
210
210
 
211
211
  用法:
212
212
  npx openclaw-qqbot <命令>