qq-bot-roost 1.0.11 → 1.0.13
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 +3 -3
- package/package.json +3 -3
- package/src/bot.js +12 -0
- package/src/config.js +777 -759
- package/src/gitee.js +5 -4
- package/src/main.js +3 -0
- package/src/message.js +2 -0
- package/src/mirror.js +8 -2
- package/src/outbound.js +39 -0
- package/src/plugin/loader.js +42 -10
- package/src/plugin/market.js +41 -3
- package/src/plugin/runtime-errors.js +27 -0
- package/src/plugin/snapshot.js +64 -0
- package/src/proxy.js +675 -0
- package/src/runtime.js +18 -0
- package/src/services/config-watch.js +2 -0
- package/src/tarball.js +3 -2
- package/src/updater.js +2 -1
- package/src/web/server.js +3741 -3620
- package/web/app.js +4934 -4701
- package/web/index.html +1337 -1315
package/README.md
CHANGED
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
|
|
9
9
|
<img src="https://img.shields.io/badge/Node.js-22.13%2B-339933?logo=node.js&logoColor=white" alt="Node.js 22.13+">
|
|
10
10
|
<img src="https://img.shields.io/badge/dependencies-0-brightgreen" alt="零依赖">
|
|
11
|
-
<img src="https://img.shields.io/badge/tests-
|
|
11
|
+
<img src="https://img.shields.io/badge/tests-903%20passed-brightgreen" alt="测试 903 项">
|
|
12
12
|
<img src="https://img.shields.io/badge/plugins-JS%20%7C%20Python%20%7C%20Go%20%7C%20any-blue" alt="多语言插件">
|
|
13
|
-
<img src="https://img.shields.io/badge/version-1.0.
|
|
13
|
+
<img src="https://img.shields.io/badge/version-1.0.13-blueviolet" alt="版本 1.0.13">
|
|
14
14
|
<img src="https://img.shields.io/badge/license-AGPL--3.0--only-blue" alt="AGPL-3.0-only">
|
|
15
15
|
<a href="https://github.com/tdcq9594/qq-bot-roost/actions"><img src="https://img.shields.io/github/actions/workflow/status/tdcq9594/qq-bot-roost/ci.yml?branch=master" alt="CI"></a>
|
|
16
16
|
|
|
@@ -493,7 +493,7 @@ openid 完全不同。共享 `roles.json` 等于所有权限记录全部对不
|
|
|
493
493
|
## 开发
|
|
494
494
|
|
|
495
495
|
```bash
|
|
496
|
-
npm test #
|
|
496
|
+
npm test # 自检 682 + qrlogin 8 + deps 11,另跑 17 个 node:test 文件(共 216 项)
|
|
497
497
|
npm run test:e2e # 端到端 168 项(起 mock 服务打全部接口,跑在临时目录)
|
|
498
498
|
npm run test:all # 全量约 618 项:自检 + 扫码 + 依赖 + e2e(真机驱动要真机,没配就跳过)
|
|
499
499
|
npm run check:secrets # 扫硬编码凭据(CI 也跑这个,提交前建议过一遍)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "qq-bot-roost",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.13",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "栖 Roost:零依赖的 QQ 官方机器人框架,填 AppID/AppSecret 即连,插件可写任意语言",
|
|
6
6
|
"license": "AGPL-3.0-only",
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
"start": "node src/main.js",
|
|
30
30
|
"mock": "node src/main.js --mock",
|
|
31
31
|
"check": "node src/main.js --check",
|
|
32
|
-
"test": "node test/selftest.mjs && node test/qrlogin.mjs && node test/deps.mjs && node --test test/trust.mjs && node --test test/manifest.mjs && node --test test/trace.mjs && node --test test/fuzz-tar.mjs && node --test test/group-name.mjs && node --test test/identity.mjs && node --test test/identity-commands.mjs && node --test test/mail.mjs && node --test test/ledger-outbound.mjs && node --test test/api-record.mjs && node --test test/reply-auto.mjs",
|
|
32
|
+
"test": "node test/selftest.mjs && node test/qrlogin.mjs && node test/deps.mjs && node --test test/trust.mjs && node --test test/manifest.mjs && node --test test/market-cache.mjs && node --test test/proxy.mjs && node --test test/trace.mjs && node --test test/fuzz-tar.mjs && node --test test/group-name.mjs && node --test test/identity.mjs && node --test test/identity-commands.mjs && node --test test/mail.mjs && node --test test/ledger-outbound.mjs && node --test test/api-record.mjs && node --test test/reply-auto.mjs && node --test test/plugin-observability.mjs && node --test test/outbound-dry.mjs",
|
|
33
33
|
"test:e2e": "node test/e2e.mjs",
|
|
34
|
-
"test:all": "node test/selftest.mjs && node test/qrlogin.mjs && node test/deps.mjs && node --test test/trust.mjs && node --test test/manifest.mjs && node --test test/trace.mjs && node --test test/fuzz-tar.mjs && node --test test/group-name.mjs && node --test test/identity.mjs && node --test test/identity-commands.mjs && node --test test/mail.mjs && node --test test/ledger-outbound.mjs && node --test test/api-record.mjs && node --test test/reply-auto.mjs && node test/e2e.mjs && node test/live-driver.mjs",
|
|
34
|
+
"test:all": "node test/selftest.mjs && node test/qrlogin.mjs && node test/deps.mjs && node --test test/trust.mjs && node --test test/manifest.mjs && node --test test/market-cache.mjs && node --test test/proxy.mjs && node --test test/trace.mjs && node --test test/fuzz-tar.mjs && node --test test/group-name.mjs && node --test test/identity.mjs && node --test test/identity-commands.mjs && node --test test/mail.mjs && node --test test/ledger-outbound.mjs && node --test test/api-record.mjs && node --test test/reply-auto.mjs && node test/e2e.mjs && node test/live-driver.mjs",
|
|
35
35
|
"check:secrets": "node scripts/check-secrets.mjs",
|
|
36
36
|
"create": "node scripts/create-plugin.mjs",
|
|
37
37
|
"test:plugin": "node scripts/test-plugin.mjs",
|
package/src/bot.js
CHANGED
|
@@ -813,6 +813,11 @@ export class BotRuntime {
|
|
|
813
813
|
bot: this,
|
|
814
814
|
});
|
|
815
815
|
} catch (e) {
|
|
816
|
+
/** 事件监听器也算运行期错误;以前只有消息 listener 留痕,这里会静默丢。
|
|
817
|
+
* 发送侧的已知限制不是插件写错,别刷运行期错误卡。 */
|
|
818
|
+
if (!['offline', 'expired', 'quota', 'rate'].includes(e?.code)) {
|
|
819
|
+
this.plugins?.noteRuntimeError?.(l.pluginId, e);
|
|
820
|
+
}
|
|
816
821
|
this.metrics.bump('errors');
|
|
817
822
|
this.log.error(`监听器 ${l.pluginId} 处理 ${eventName} 出错:`, e.stack || e.message);
|
|
818
823
|
}
|
|
@@ -1005,6 +1010,8 @@ export class BotRuntime {
|
|
|
1005
1010
|
this.log.warn(`命令 ${commandEntry.name} 回复失败: ${e.message}`);
|
|
1006
1011
|
return;
|
|
1007
1012
|
}
|
|
1013
|
+
/** 命令 handler 抛错也要在面板留痕(已知发送限制不记,免得刷屏) */
|
|
1014
|
+
this.plugins?.noteRuntimeError?.(commandEntry.pluginId, e);
|
|
1008
1015
|
this.log.error(
|
|
1009
1016
|
`命令 ${commandEntry.name}(插件 ${commandEntry.pluginId})执行出错:`,
|
|
1010
1017
|
e.stack || e.message,
|
|
@@ -1060,6 +1067,11 @@ export class BotRuntime {
|
|
|
1060
1067
|
if (ret === true) msg.claim();
|
|
1061
1068
|
if (ret === true || msg.replied) handled = true;
|
|
1062
1069
|
} catch (e) {
|
|
1070
|
+
// 运行期错误也要留痕:以前只进日志,面板上看不出插件在反复抛错。
|
|
1071
|
+
// 发送侧的已知限制不算插件异常,跟命令 handler 保持同一口径。
|
|
1072
|
+
if (!['offline', 'expired', 'quota', 'rate'].includes(e?.code)) {
|
|
1073
|
+
this.plugins?.noteRuntimeError?.(l.pluginId, e);
|
|
1074
|
+
}
|
|
1063
1075
|
this.metrics.bump('errors');
|
|
1064
1076
|
this.log.error(`监听器 ${l.pluginId} 处理 ${evt} 出错:`, e.stack || e.message);
|
|
1065
1077
|
}
|