qq-bot-roost 1.0.2 → 1.0.4
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 +2 -2
- package/package.json +57 -57
- package/src/bot.js +10 -1
- package/src/config.js +741 -730
- package/src/ledger.js +905 -554
- package/src/message.js +998 -900
- package/src/outbound.js +791 -690
- package/src/plugin/api-record.js +129 -0
- package/src/plugin/context.js +990 -976
- package/src/storage/events-schema.js +124 -99
- package/src/web/server.js +3494 -3280
- package/web/app.js +4372 -4053
- package/web/index.html +1203 -1116
- package/web/style.css +44 -0
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-796%20passed-brightgreen" alt="测试 796 项">
|
|
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.4-blueviolet" alt="版本 1.0.4">
|
|
14
14
|
<img src="https://img.shields.io/badge/license-Non--Commercial-red" alt="禁止商用">
|
|
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
|
|
package/package.json
CHANGED
|
@@ -1,57 +1,57 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "qq-bot-roost",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"type": "module",
|
|
5
|
-
"description": "栖 Roost:零依赖的 QQ 官方机器人框架,填 AppID/AppSecret 即连,插件可写任意语言",
|
|
6
|
-
"license": "SEE LICENSE IN LICENSE",
|
|
7
|
-
"repository": {
|
|
8
|
-
"type": "git",
|
|
9
|
-
"url": "git+https://github.com/tdcq9594/qq-bot-roost.git"
|
|
10
|
-
},
|
|
11
|
-
"bugs": {
|
|
12
|
-
"url": "https://github.com/tdcq9594/qq-bot-roost/issues"
|
|
13
|
-
},
|
|
14
|
-
"homepage": "https://github.com/tdcq9594/qq-bot-roost#readme",
|
|
15
|
-
"keywords": [
|
|
16
|
-
"qq-bot",
|
|
17
|
-
"qqbot",
|
|
18
|
-
"bot-framework",
|
|
19
|
-
"qq-official-bot",
|
|
20
|
-
"roost",
|
|
21
|
-
"multi-bot",
|
|
22
|
-
"plugin",
|
|
23
|
-
"zero-dependency"
|
|
24
|
-
],
|
|
25
|
-
"engines": {
|
|
26
|
-
"node": ">=22.13"
|
|
27
|
-
},
|
|
28
|
-
"scripts": {
|
|
29
|
-
"start": "node src/main.js",
|
|
30
|
-
"mock": "node src/main.js --mock",
|
|
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",
|
|
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/e2e.mjs && node test/live-driver.mjs",
|
|
35
|
-
"check:secrets": "node scripts/check-secrets.mjs",
|
|
36
|
-
"create": "node scripts/create-plugin.mjs",
|
|
37
|
-
"test:plugin": "node scripts/test-plugin.mjs",
|
|
38
|
-
"live": "node scripts/live-test.mjs",
|
|
39
|
-
"market:index": "node scripts/build-market-index.mjs",
|
|
40
|
-
"sums": "node scripts/build-sums.mjs",
|
|
41
|
-
"sums:check": "node scripts/build-sums.mjs --check",
|
|
42
|
-
"sums:verify": "node scripts/build-sums.mjs --verify",
|
|
43
|
-
"test:coverage": "node --experimental-test-coverage --test-coverage-lines=95 --test-coverage-branches=80 --test-coverage-include=src/trust.js --test-coverage-include=src/plugin/manifest.js --test-coverage-include=src/trace.js --test test/trust.mjs test/manifest.mjs test/trace.mjs"
|
|
44
|
-
},
|
|
45
|
-
"author": {
|
|
46
|
-
"name": "倦飞之鸟"
|
|
47
|
-
},
|
|
48
|
-
"files": [
|
|
49
|
-
"src",
|
|
50
|
-
"web",
|
|
51
|
-
"sdk",
|
|
52
|
-
"types",
|
|
53
|
-
"config/*.example.json",
|
|
54
|
-
"README.md",
|
|
55
|
-
"LICENSE"
|
|
56
|
-
]
|
|
57
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "qq-bot-roost",
|
|
3
|
+
"version": "1.0.4",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "栖 Roost:零依赖的 QQ 官方机器人框架,填 AppID/AppSecret 即连,插件可写任意语言",
|
|
6
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/tdcq9594/qq-bot-roost.git"
|
|
10
|
+
},
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/tdcq9594/qq-bot-roost/issues"
|
|
13
|
+
},
|
|
14
|
+
"homepage": "https://github.com/tdcq9594/qq-bot-roost#readme",
|
|
15
|
+
"keywords": [
|
|
16
|
+
"qq-bot",
|
|
17
|
+
"qqbot",
|
|
18
|
+
"bot-framework",
|
|
19
|
+
"qq-official-bot",
|
|
20
|
+
"roost",
|
|
21
|
+
"multi-bot",
|
|
22
|
+
"plugin",
|
|
23
|
+
"zero-dependency"
|
|
24
|
+
],
|
|
25
|
+
"engines": {
|
|
26
|
+
"node": ">=22.13"
|
|
27
|
+
},
|
|
28
|
+
"scripts": {
|
|
29
|
+
"start": "node src/main.js",
|
|
30
|
+
"mock": "node src/main.js --mock",
|
|
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",
|
|
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/e2e.mjs && node test/live-driver.mjs",
|
|
35
|
+
"check:secrets": "node scripts/check-secrets.mjs",
|
|
36
|
+
"create": "node scripts/create-plugin.mjs",
|
|
37
|
+
"test:plugin": "node scripts/test-plugin.mjs",
|
|
38
|
+
"live": "node scripts/live-test.mjs",
|
|
39
|
+
"market:index": "node scripts/build-market-index.mjs",
|
|
40
|
+
"sums": "node scripts/build-sums.mjs",
|
|
41
|
+
"sums:check": "node scripts/build-sums.mjs --check",
|
|
42
|
+
"sums:verify": "node scripts/build-sums.mjs --verify",
|
|
43
|
+
"test:coverage": "node --experimental-test-coverage --test-coverage-lines=95 --test-coverage-branches=80 --test-coverage-include=src/trust.js --test-coverage-include=src/plugin/manifest.js --test-coverage-include=src/trace.js --test test/trust.mjs test/manifest.mjs test/trace.mjs"
|
|
44
|
+
},
|
|
45
|
+
"author": {
|
|
46
|
+
"name": "倦飞之鸟"
|
|
47
|
+
},
|
|
48
|
+
"files": [
|
|
49
|
+
"src",
|
|
50
|
+
"web",
|
|
51
|
+
"sdk",
|
|
52
|
+
"types",
|
|
53
|
+
"config/*.example.json",
|
|
54
|
+
"README.md",
|
|
55
|
+
"LICENSE"
|
|
56
|
+
]
|
|
57
|
+
}
|
package/src/bot.js
CHANGED
|
@@ -232,9 +232,18 @@ export class BotRuntime {
|
|
|
232
232
|
file: this.paths.events,
|
|
233
233
|
botId: this.id,
|
|
234
234
|
enabled: cfg.ledger?.enabled !== false,
|
|
235
|
-
retentionDays: cfg.ledger?.retentionDays ??
|
|
235
|
+
retentionDays: cfg.ledger?.retentionDays ?? 0,
|
|
236
236
|
});
|
|
237
237
|
|
|
238
|
+
/**
|
|
239
|
+
* 后置注入:`outbound` 在 193 行就构造好了(它不依赖账本),
|
|
240
|
+
* 而账本要等 `paths.events` 就绪,所以只能在这里补引用。
|
|
241
|
+
*
|
|
242
|
+
* 照 278 行 `this.outbound.delivery = this.delivery` 的同一做法——
|
|
243
|
+
* 走构造函数参数的话拿到的是 `undefined`,表现是「出站永远不记,也不报错」。
|
|
244
|
+
*/
|
|
245
|
+
if (this.outbound) this.outbound.ledger = this.ledger;
|
|
246
|
+
|
|
238
247
|
this.plugins = new PluginManager({
|
|
239
248
|
pluginsDir: DIRS.plugins,
|
|
240
249
|
paths: this.paths,
|