@karinjs/adapter-qqbot 2.2.1 → 3.0.0
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/dist/apps/cleanup.d.ts +6 -2
- package/dist/apps/cleanup.js +5 -10
- package/dist/apps/login.js +2 -2
- package/dist/{config-B_Gc9JKZ.js → config-BUuU6FnQ.js} +46 -6
- package/dist/index.d.ts +426 -232
- package/dist/index.js +252 -257
- package/dist/message-BTGL3TSn.js +1843 -0
- package/dist/{onboard-BXQ1cG8h.js → onboard-vIEoe9dB.js} +1 -1
- package/dist/utils-N9PNiHjE.js +4 -0
- package/dist/web.config.d.ts +3 -0
- package/dist/web.config.js +46 -3
- package/package.json +7 -5
- package/dist/message-Dt4QkDYn.js +0 -1739
- package/dist/utils-DIq0lGMt.js +0 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as getDefaultConfig, m as log, n as config, o as writeConfig } from "./config-
|
|
1
|
+
import { i as getDefaultConfig, m as log, n as config, o as writeConfig } from "./config-BUuU6FnQ.js";
|
|
2
2
|
import { a as sleep } from "./common-by1GpV0b.js";
|
|
3
3
|
import qrcode from "qrcode";
|
|
4
4
|
import axios from "node-karin/axios";
|
package/dist/web.config.d.ts
CHANGED
|
@@ -14,6 +14,9 @@ type WebQQBotInput = {
|
|
|
14
14
|
'markdown:enable': unknown;
|
|
15
15
|
'messageCache:enable': unknown;
|
|
16
16
|
'messageCache:self': unknown;
|
|
17
|
+
'messageCache:level': unknown;
|
|
18
|
+
'messageCache:ttlHours': unknown;
|
|
19
|
+
'messageCache:maxRows': unknown;
|
|
17
20
|
'event:type': unknown;
|
|
18
21
|
};
|
|
19
22
|
type WebConfigInput = {
|
package/dist/web.config.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as readConfigFile, f as pkg, i as getDefaultConfig, n as config, o as writeConfig, s as buildFallbackWsUrlFromApi, u as normalizeProxyConfig } from "./config-
|
|
2
|
-
import "./utils-
|
|
1
|
+
import { a as readConfigFile, f as pkg, i as getDefaultConfig, n as config, o as writeConfig, s as buildFallbackWsUrlFromApi, u as normalizeProxyConfig } from "./config-BUuU6FnQ.js";
|
|
2
|
+
import "./utils-N9PNiHjE.js";
|
|
3
3
|
import { components, defineConfig } from "node-karin";
|
|
4
4
|
|
|
5
5
|
//#region src/web.config.ts
|
|
@@ -117,6 +117,9 @@ var web_config_default = defineConfig({
|
|
|
117
117
|
"markdown:enable": item.markdown?.enable !== false,
|
|
118
118
|
"messageCache:enable": item.messageCache?.enable === true,
|
|
119
119
|
"messageCache:self": item.messageCache?.self === true,
|
|
120
|
+
"messageCache:level": item.messageCache?.level || "standard",
|
|
121
|
+
"messageCache:ttlHours": String(item.messageCache?.ttlHours ?? 24),
|
|
122
|
+
"messageCache:maxRows": String(item.messageCache?.maxRows ?? 2e5),
|
|
120
123
|
...getBotProxyInput(item)
|
|
121
124
|
});
|
|
122
125
|
});
|
|
@@ -230,6 +233,36 @@ var web_config_default = defineConfig({
|
|
|
230
233
|
description: "只有开启“缓存收到的消息到数据库”后才生效。开启后,机器人发送成功的消息也会写入缓存,方便之后通过消息 ID 查询。",
|
|
231
234
|
defaultSelected: false
|
|
232
235
|
}),
|
|
236
|
+
components.radio.group("messageCache:level", {
|
|
237
|
+
label: "缓存存储分级",
|
|
238
|
+
description: "控制每条消息落库的内容多少,直接影响数据库体积。撤回和引用解析在任何分级下都可用。",
|
|
239
|
+
defaultValue: "standard",
|
|
240
|
+
radio: [
|
|
241
|
+
components.radio.create("minimal", {
|
|
242
|
+
label: "最小",
|
|
243
|
+
value: "minimal",
|
|
244
|
+
description: "只记录消息 ID 映射与引用关系,不保存正文和媒体,体积最小。"
|
|
245
|
+
}),
|
|
246
|
+
components.radio.create("standard", {
|
|
247
|
+
label: "标准(推荐)",
|
|
248
|
+
value: "standard",
|
|
249
|
+
description: "保存文本、表情和媒体本地文件,不保存 markdown 原文。"
|
|
250
|
+
}),
|
|
251
|
+
components.radio.create("full", {
|
|
252
|
+
label: "完整",
|
|
253
|
+
value: "full",
|
|
254
|
+
description: "所有支持的消息段原样保存,包含 markdown 原文,体积最大。"
|
|
255
|
+
})
|
|
256
|
+
]
|
|
257
|
+
}),
|
|
258
|
+
components.input.create("messageCache:ttlHours", {
|
|
259
|
+
label: "缓存保留小时数",
|
|
260
|
+
description: "超过该时长的消息会被清理任务删除。范围 1~720 小时,默认 24。多个机器人同时开启缓存时按最大值生效。"
|
|
261
|
+
}),
|
|
262
|
+
components.input.create("messageCache:maxRows", {
|
|
263
|
+
label: "缓存最大消息条数",
|
|
264
|
+
description: "数据库消息行数硬上限,超出后从最旧的消息开始删除,保证磁盘占用可预期。范围 1000~5000000,默认 200000。"
|
|
265
|
+
}),
|
|
233
266
|
components.divider.horizontal("bot-proxy-section", {
|
|
234
267
|
description: "连接代理(高级设置:通常只在使用 Webhook 转 WebSocket 服务时填写,除非你知道你在做什么,否则不建议更改)",
|
|
235
268
|
descPosition: 5
|
|
@@ -265,6 +298,13 @@ var web_config_default = defineConfig({
|
|
|
265
298
|
const markdownEnable = toBool(item["markdown:enable"], previous?.markdown?.enable ?? true);
|
|
266
299
|
const messageCacheEnable = toBool(item["messageCache:enable"], previous?.messageCache?.enable ?? false);
|
|
267
300
|
const messageCacheSelf = toBool(item["messageCache:self"], previous?.messageCache?.self ?? false);
|
|
301
|
+
/** 枚举与数值范围由 writeConfig 内的 formatConfig 统一校验回落。 */
|
|
302
|
+
const messageCacheLevel = toStringValue(item["messageCache:level"], previous?.messageCache?.level ?? "standard");
|
|
303
|
+
/** 输入被清空时回落上次值/默认值,避免 Number('') = 0 被夹到范围下限。 */
|
|
304
|
+
const ttlHoursRaw = toStringValue(item["messageCache:ttlHours"]).trim();
|
|
305
|
+
const messageCacheTtlHours = ttlHoursRaw ? Number(ttlHoursRaw) : previous?.messageCache?.ttlHours ?? 24;
|
|
306
|
+
const maxRowsRaw = toStringValue(item["messageCache:maxRows"]).trim();
|
|
307
|
+
const messageCacheMaxRows = maxRowsRaw ? Number(maxRowsRaw) : previous?.messageCache?.maxRows ?? 2e5;
|
|
268
308
|
const regex = toStringList(item.regex).map((str) => {
|
|
269
309
|
const parts = str.split(" ");
|
|
270
310
|
return {
|
|
@@ -287,7 +327,10 @@ var web_config_default = defineConfig({
|
|
|
287
327
|
markdown: { enable: markdownEnable },
|
|
288
328
|
messageCache: {
|
|
289
329
|
enable: messageCacheEnable,
|
|
290
|
-
self: messageCacheSelf
|
|
330
|
+
self: messageCacheSelf,
|
|
331
|
+
level: messageCacheLevel,
|
|
332
|
+
ttlHours: messageCacheTtlHours,
|
|
333
|
+
maxRows: messageCacheMaxRows
|
|
291
334
|
},
|
|
292
335
|
event: { type: eventType }
|
|
293
336
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@karinjs/adapter-qqbot",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "karin adapter for QQ Official Bot (2.0)",
|
|
5
5
|
"homepage": "https://github.com/KarinJS/karin-plugin-adapter-qqbot",
|
|
6
6
|
"bugs": {
|
|
@@ -24,7 +24,8 @@
|
|
|
24
24
|
"lint": "eslint src",
|
|
25
25
|
"lint:fix": "eslint src --fix",
|
|
26
26
|
"pub": "npm publish --access public",
|
|
27
|
-
"sort": "npx sort-package-json"
|
|
27
|
+
"sort": "npx sort-package-json",
|
|
28
|
+
"test": "node tests/schema-sql.test.mjs && node tests/codec.test.mjs && node tests/store.test.mjs"
|
|
28
29
|
},
|
|
29
30
|
"dependencies": {
|
|
30
31
|
"@karinjs/geturls": "^1.0.2",
|
|
@@ -35,14 +36,15 @@
|
|
|
35
36
|
"tweetnacl": "^1.0.3"
|
|
36
37
|
},
|
|
37
38
|
"devDependencies": {
|
|
39
|
+
"@tencent-connect/qqbot-nodejs": "^1.0.4",
|
|
38
40
|
"@types/express": "5.0.6",
|
|
39
|
-
"@types/node": "^24.13.
|
|
41
|
+
"@types/node": "^24.13.3",
|
|
40
42
|
"@types/qrcode": "^1.5.6",
|
|
41
43
|
"eslint": "^9.39.4",
|
|
42
44
|
"neostandard": "^0.13.0",
|
|
43
45
|
"node-karin": "1.16.3",
|
|
44
|
-
"tsdown": "^0.22.
|
|
45
|
-
"tsx": "^4.23.
|
|
46
|
+
"tsdown": "^0.22.13",
|
|
47
|
+
"tsx": "^4.23.1",
|
|
46
48
|
"typescript": "^6.0.3"
|
|
47
49
|
},
|
|
48
50
|
"publishConfig": {
|