koishi-plugin-chatluna-toolbox 0.0.16 → 0.0.17
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 +4 -4
- package/lib/index.js +22 -27
- package/package.json +14 -13
package/README.md
CHANGED
|
@@ -58,15 +58,15 @@ QQ 头像工具会把 HTTP/HTTPS 图片先转为 OneBot `base64://` 文件再提
|
|
|
58
58
|
### 4. 构建
|
|
59
59
|
|
|
60
60
|
```bash
|
|
61
|
-
|
|
61
|
+
yarn build
|
|
62
62
|
```
|
|
63
63
|
|
|
64
64
|
## 开发命令
|
|
65
65
|
|
|
66
66
|
```bash
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
yarn typecheck
|
|
68
|
+
yarn build
|
|
69
|
+
yarn test
|
|
70
70
|
```
|
|
71
71
|
|
|
72
72
|
## 仓库地址
|
package/lib/index.js
CHANGED
|
@@ -457,8 +457,10 @@ var import_koishi5 = require("koishi");
|
|
|
457
457
|
// src/schema/basic-settings.ts
|
|
458
458
|
var import_koishi = require("koishi");
|
|
459
459
|
var BasicSettingsSchema = import_koishi.Schema.object({
|
|
460
|
-
|
|
461
|
-
|
|
460
|
+
oneBotProtocol: import_koishi.Schema.union([
|
|
461
|
+
import_koishi.Schema.const("napcat").description("NapCat"),
|
|
462
|
+
import_koishi.Schema.const("llbot").description("LLBot")
|
|
463
|
+
]).default("napcat").description("\u9009\u62E9 OneBot \u534F\u8BAE")
|
|
462
464
|
}).description("\u57FA\u7840\u8BBE\u7F6E");
|
|
463
465
|
|
|
464
466
|
// src/schema/native-tools.ts
|
|
@@ -477,47 +479,47 @@ var DEFAULT_DELETE_MESSAGE_TOOL_DESCRIPTION = "\u6839\u636E\u6D88\u606F ID \u64A
|
|
|
477
479
|
// src/schema/native-tools.ts
|
|
478
480
|
var NativeToolsSchema = import_koishi2.Schema.object({
|
|
479
481
|
poke: import_koishi2.Schema.object({
|
|
480
|
-
enabled: import_koishi2.Schema.boolean().default(false).description(
|
|
482
|
+
enabled: import_koishi2.Schema.boolean().default(false).description(`\u6CE8\u518C ChatLuna \u539F\u751F\u5DE5\u5177\uFF1A\u6233\u4E00\u6233\uFF0C\u4E0E**XML \u6233\u4E00\u6233\u8C03\u7528**\u4E8C\u9009\u4E00`),
|
|
481
483
|
toolName: import_koishi2.Schema.string().default("poke_user").description("\u5DE5\u5177\u540D\u79F0"),
|
|
482
484
|
description: import_koishi2.Schema.string().default(DEFAULT_POKE_TOOL_DESCRIPTION).description("\u5DE5\u5177\u63CF\u8FF0")
|
|
483
485
|
}).description("\u6233\u4E00\u6233\u5DE5\u5177").collapse(),
|
|
484
486
|
setSelfProfile: import_koishi2.Schema.object({
|
|
485
487
|
enabled: import_koishi2.Schema.boolean().default(false).description(
|
|
486
|
-
|
|
488
|
+
`\u6CE8\u518C ChatLuna \u539F\u751F\u5DE5\u5177\uFF1A\u4FEE\u6539\u81EA\u8EAB\u8D26\u6237\u4FE1\u606F\uFF0C\u652F\u6301\u6635\u79F0 / \u7B7E\u540D / \u6027\u522B`
|
|
487
489
|
),
|
|
488
490
|
toolName: import_koishi2.Schema.string().default("set_self_profile").description("\u5DE5\u5177\u540D\u79F0"),
|
|
489
491
|
description: import_koishi2.Schema.string().default(DEFAULT_SET_SELF_PROFILE_TOOL_DESCRIPTION).description("\u5DE5\u5177\u63CF\u8FF0")
|
|
490
492
|
}).description("\u4FEE\u6539\u81EA\u8EAB\u8D26\u6237\u4FE1\u606F\u5DE5\u5177").collapse(),
|
|
491
493
|
setQQAvatar: import_koishi2.Schema.object({
|
|
492
|
-
enabled: import_koishi2.Schema.boolean().default(false).description("\u6CE8\u518C ChatLuna \u5DE5\u5177\uFF1A\u4FEE\u6539\u673A\u5668\u4EBA QQ \u5934\u50CF"),
|
|
494
|
+
enabled: import_koishi2.Schema.boolean().default(false).description("\u6CE8\u518C ChatLuna \u539F\u751F\u5DE5\u5177\uFF1A\u4FEE\u6539\u673A\u5668\u4EBA QQ \u5934\u50CF"),
|
|
493
495
|
toolName: import_koishi2.Schema.string().default("set_qq_avatar").description("\u5DE5\u5177\u540D\u79F0"),
|
|
494
496
|
description: import_koishi2.Schema.string().default(DEFAULT_SET_QQ_AVATAR_TOOL_DESCRIPTION).description("\u5DE5\u5177\u63CF\u8FF0")
|
|
495
497
|
}).description("\u4FEE\u6539 QQ \u5934\u50CF\u5DE5\u5177").collapse(),
|
|
496
498
|
setGroupCard: import_koishi2.Schema.object({
|
|
497
|
-
enabled: import_koishi2.Schema.boolean().default(false).description("\u6CE8\u518C ChatLuna \u5DE5\u5177\uFF1A\u4FEE\u6539\u7FA4\u6210\u5458\u6635\u79F0"),
|
|
499
|
+
enabled: import_koishi2.Schema.boolean().default(false).description("\u6CE8\u518C ChatLuna \u539F\u751F\u5DE5\u5177\uFF1A\u4FEE\u6539\u7FA4\u6210\u5458\u6635\u79F0"),
|
|
498
500
|
toolName: import_koishi2.Schema.string().default("set_group_card").description("\u5DE5\u5177\u540D\u79F0"),
|
|
499
501
|
description: import_koishi2.Schema.string().default(DEFAULT_SET_GROUP_CARD_TOOL_DESCRIPTION).description("\u5DE5\u5177\u63CF\u8FF0")
|
|
500
502
|
}).description("\u4FEE\u6539\u7FA4\u6210\u5458\u6635\u79F0\u5DE5\u5177").collapse(),
|
|
501
503
|
setGroupBan: import_koishi2.Schema.object({
|
|
502
|
-
enabled: import_koishi2.Schema.boolean().default(false).description("\u6CE8\u518C ChatLuna \u5DE5\u5177\uFF1A\u7981\u8A00\u7FA4\u6210\u5458"),
|
|
504
|
+
enabled: import_koishi2.Schema.boolean().default(false).description("\u6CE8\u518C ChatLuna \u539F\u751F\u5DE5\u5177\uFF1A\u7981\u8A00\u7FA4\u6210\u5458"),
|
|
503
505
|
toolName: import_koishi2.Schema.string().default("set_group_ban").description("\u5DE5\u5177\u540D\u79F0"),
|
|
504
506
|
description: import_koishi2.Schema.string().default(DEFAULT_SET_GROUP_BAN_TOOL_DESCRIPTION).description("\u5DE5\u5177\u63CF\u8FF0")
|
|
505
507
|
}).description("\u7981\u8A00\u5DE5\u5177").collapse(),
|
|
506
508
|
setGroupSpecialTitle: import_koishi2.Schema.object({
|
|
507
|
-
enabled: import_koishi2.Schema.boolean().default(false).description("\u6CE8\u518C ChatLuna \u5DE5\u5177\uFF1A\u4FEE\u6539\u7FA4\u6210\u5458\u4E13\u5C5E\u5934\u8854"),
|
|
509
|
+
enabled: import_koishi2.Schema.boolean().default(false).description("\u6CE8\u518C ChatLuna \u539F\u751F\u5DE5\u5177\uFF1A\u4FEE\u6539\u7FA4\u6210\u5458\u4E13\u5C5E\u5934\u8854"),
|
|
508
510
|
toolName: import_koishi2.Schema.string().default("set_group_special_title").description("\u5DE5\u5177\u540D\u79F0"),
|
|
509
511
|
description: import_koishi2.Schema.string().default(DEFAULT_SET_GROUP_SPECIAL_TITLE_TOOL_DESCRIPTION).description("\u5DE5\u5177\u63CF\u8FF0")
|
|
510
512
|
}).description("\u4FEE\u6539\u7FA4\u6210\u5458\u4E13\u5C5E\u5934\u8854\u5DE5\u5177").collapse(),
|
|
511
513
|
setMsgEmoji: import_koishi2.Schema.object({
|
|
512
514
|
enabled: import_koishi2.Schema.boolean().default(false).description(
|
|
513
|
-
|
|
515
|
+
`\u6CE8\u518C ChatLuna \u539F\u751F\u5DE5\u5177\uFF1A\u7ED9\u6D88\u606F\u6DFB\u52A0\u8868\u60C5\uFF0C\u9700\`chatluna-character\`\u5F00\u542F\`enableMessageId\`\uFF0C\u4E0E**XML \u8868\u60C5\u56DE\u5E94\u8C03\u7528**\u4E8C\u9009\u4E00\uFF0C\u70B9\u51FB\u67E5\u770B[\u8868\u60C5\u5BF9\u7167\u8868](https://bot.q.qq.com/wiki/develop/pythonsdk/model/emoji.html)`
|
|
514
516
|
),
|
|
515
517
|
toolName: import_koishi2.Schema.string().default("set_msg_emoji").description("\u5DE5\u5177\u540D\u79F0"),
|
|
516
518
|
description: import_koishi2.Schema.string().default(DEFAULT_SET_MSG_EMOJI_TOOL_DESCRIPTION).description("\u5DE5\u5177\u63CF\u8FF0")
|
|
517
519
|
}).description("\u6D88\u606F\u8868\u60C5\u5DE5\u5177").collapse(),
|
|
518
520
|
deleteMessage: import_koishi2.Schema.object({
|
|
519
521
|
enabled: import_koishi2.Schema.boolean().default(false).description(
|
|
520
|
-
|
|
522
|
+
`\u6CE8\u518C ChatLuna \u539F\u751F\u5DE5\u5177\uFF1A\u64A4\u56DE\u6D88\u606F\uFF0C\u9700\`chatluna-character\`\u5F00\u542F\`enableMessageId\`\uFF0C\u4E0E**XML \u6D88\u606F\u64A4\u56DE\u8C03\u7528**\u4E8C\u9009\u4E00`
|
|
521
523
|
),
|
|
522
524
|
toolName: import_koishi2.Schema.string().default("delete_msg").description("\u5DE5\u5177\u540D\u79F0"),
|
|
523
525
|
description: import_koishi2.Schema.string().default(DEFAULT_DELETE_MESSAGE_TOOL_DESCRIPTION).description("\u5DE5\u5177\u63CF\u8FF0")
|
|
@@ -606,18 +608,18 @@ var DEFAULT_XML_REFERENCE_PROMPT = `## \u52A8\u4F5C\u6307\u4EE4
|
|
|
606
608
|
</actions>
|
|
607
609
|
\`\`\``;
|
|
608
610
|
var XmlToolsSchema = import_koishi3.Schema.object({
|
|
609
|
-
injectXmlToolAsReplyTool: import_koishi3.Schema.boolean().default(false).description("\u5C06 XML \u5DE5\u5177\
|
|
610
|
-
enablePokeXmlTool: import_koishi3.Schema.boolean().default(false).description(
|
|
611
|
+
injectXmlToolAsReplyTool: import_koishi3.Schema.boolean().default(false).description("\u5C06 XML \u5DE5\u5177\u6CE8\u5165\u5B9E\u9A8C\u6027[\u5DE5\u5177\u8C03\u7528\u56DE\u590D](https://chatluna.chat/ecosystem/other/character.html#%E9%A2%84%E8%AE%BE)\u7684\u53C2\u6570\u4E2D"),
|
|
612
|
+
enablePokeXmlTool: import_koishi3.Schema.boolean().default(false).description(`\u542F\u7528 XML \u6233\u4E00\u6233\u8C03\u7528\uFF0C\u4E0E**\u6233\u4E00\u6233\u5DE5\u5177**\u4E8C\u9009\u4E00`),
|
|
611
613
|
enableEmojiXmlTool: import_koishi3.Schema.boolean().default(false).description(
|
|
612
|
-
|
|
614
|
+
`\u542F\u7528 XML \u6D88\u606F\u8868\u60C5\u8C03\u7528\uFF0C\u9700\`chatluna-character\`\u5F00\u542F\`enableMessageId\`\uFF0C\u4E0E**\u6D88\u606F\u8868\u60C5\u5DE5\u5177**\u4E8C\u9009\u4E00\uFF0C\u70B9\u51FB\u67E5\u770B[emoji_id \u5BF9\u7167\u8868](https://bot.q.qq.com/wiki/develop/pythonsdk/model/emoji.html)`
|
|
613
615
|
),
|
|
614
616
|
enableDeleteXmlTool: import_koishi3.Schema.boolean().default(false).description(
|
|
615
|
-
|
|
617
|
+
`\u542F\u7528 XML \u6D88\u606F\u64A4\u56DE\u8C03\u7528\uFF0C\u9700\`chatluna-character\`\u5F00\u542F\`enableMessageId\`\uFF0C\u4E0E**\u64A4\u56DE\u6D88\u606F\u5DE5\u5177**\u4E8C\u9009\u4E00`
|
|
616
618
|
),
|
|
617
619
|
enableBanXmlTool: import_koishi3.Schema.boolean().default(false).description(
|
|
618
|
-
|
|
620
|
+
`\u542F\u7528 XML \u7FA4\u6210\u5458\u7981\u8A00\u8C03\u7528\uFF0C\u4E0E**\u7981\u8A00\u5DE5\u5177**\u4E8C\u9009\u4E00`
|
|
619
621
|
),
|
|
620
|
-
referencePrompt: import_koishi3.Schema.string().role("textarea").default(DEFAULT_XML_REFERENCE_PROMPT).description("\u6A21\u578B\u56DE\u590D XML \u53C2\u8003\u63D0\u793A\u8BCD\
|
|
622
|
+
referencePrompt: import_koishi3.Schema.string().role("textarea").default(DEFAULT_XML_REFERENCE_PROMPT).description("\u6A21\u578B\u56DE\u590D XML \u53C2\u8003\u63D0\u793A\u8BCD\u3002\u81EA\u884C\u5199\u5165\u63D0\u793A\u8BCD\u4E2D\uFF0C\u4E0D\u4F1A\u81EA\u52A8\u6CE8\u5165\uFF1B\u82E5\u5F00\u542F\u201C\u5C06 XML \u5DE5\u5177\u6CE8\u5165\u5B9E\u9A8C\u6027[\u5DE5\u5177\u8C03\u7528\u56DE\u590D](https://chatluna.chat/ecosystem/other/character.html#%E9%A2%84%E8%AE%BE)\u7684\u53C2\u6570\u4E2D\u201D\uFF0C\u5219\u65E0\u9700\u589E\u52A0\u989D\u5916\u63D0\u793A\u8BCD")
|
|
621
623
|
}).description("XML \u5DE5\u5177");
|
|
622
624
|
|
|
623
625
|
// src/schema/variables.ts
|
|
@@ -662,7 +664,7 @@ var VariablesSchema = import_koishi4.Schema.object({
|
|
|
662
664
|
import_koishi4.Schema.const("joinTime").description("\u5165\u7FA4\u65F6\u95F4"),
|
|
663
665
|
import_koishi4.Schema.const("lastSentTime").description("\u6700\u540E\u53D1\u8A00\u65F6\u95F4")
|
|
664
666
|
])
|
|
665
|
-
).role("checkbox").default([...DEFAULT_MEMBER_INFO_ITEMS]).description("\u663E\u793A\u7684\u8BE6\u7EC6\u4FE1\u606F\u9879")
|
|
667
|
+
).role("checkbox").default([...DEFAULT_MEMBER_INFO_ITEMS]).description("\u9009\u62E9\u7528\u6237\u4FE1\u606F\u53D8\u91CF\u4E2D\u663E\u793A\u7684\u8BE6\u7EC6\u4FE1\u606F\u9879")
|
|
666
668
|
}).description("\u7528\u6237\u4FE1\u606F\u53D8\u91CF").collapse(),
|
|
667
669
|
botInfo: import_koishi4.Schema.object({
|
|
668
670
|
variableName: import_koishi4.Schema.string().default("botInfo").description("\u53D8\u91CF\u540D\u79F0"),
|
|
@@ -679,7 +681,7 @@ var VariablesSchema = import_koishi4.Schema.object({
|
|
|
679
681
|
import_koishi4.Schema.const("joinTime").description("\u5165\u7FA4\u65F6\u95F4"),
|
|
680
682
|
import_koishi4.Schema.const("lastSentTime").description("\u6700\u540E\u53D1\u8A00\u65F6\u95F4")
|
|
681
683
|
])
|
|
682
|
-
).role("checkbox").default([...DEFAULT_MEMBER_INFO_ITEMS]).description("\
|
|
684
|
+
).role("checkbox").default([...DEFAULT_MEMBER_INFO_ITEMS]).description("\u9009\u62E9\u673A\u5668\u4EBA\u4FE1\u606F\u53D8\u91CF\u4E2D\u663E\u793A\u7684\u8BE6\u7EC6\u4FE1\u606F\u9879")
|
|
683
685
|
}).description("\u673A\u5668\u4EBA\u4FE1\u606F\u53D8\u91CF").collapse(),
|
|
684
686
|
groupInfo: import_koishi4.Schema.object({
|
|
685
687
|
variableName: import_koishi4.Schema.string().default("groupInfo").description("\u53D8\u91CF\u540D\u79F0"),
|
|
@@ -692,7 +694,7 @@ var VariablesSchema = import_koishi4.Schema.object({
|
|
|
692
694
|
import_koishi4.Schema.const("ownerList").description("\u7FA4\u4E3B\u540D\u5355"),
|
|
693
695
|
import_koishi4.Schema.const("adminList").description("\u7BA1\u7406\u5458\u540D\u5355")
|
|
694
696
|
])
|
|
695
|
-
).role("checkbox").default([...DEFAULT_GROUP_INFO_ITEMS]).description("\u663E\u793A\u7684\u7FA4\u4FE1\u606F\u9879")
|
|
697
|
+
).role("checkbox").default([...DEFAULT_GROUP_INFO_ITEMS]).description("\u9009\u62E9\u7FA4\u4FE1\u606F\u53D8\u91CF\u4E2D\u663E\u793A\u7684\u7FA4\u4FE1\u606F\u9879")
|
|
696
698
|
}).description("\u7FA4\u4FE1\u606F\u53D8\u91CF").collapse(),
|
|
697
699
|
groupShutList: import_koishi4.Schema.object({
|
|
698
700
|
variableName: import_koishi4.Schema.string().default("groupShutList").description("\u53D8\u91CF\u540D\u79F0")
|
|
@@ -1324,14 +1326,7 @@ function resolveToolDescription(value, fallback) {
|
|
|
1324
1326
|
return trimmedValue || fallback;
|
|
1325
1327
|
}
|
|
1326
1328
|
function resolveOneBotProtocol(config, log) {
|
|
1327
|
-
|
|
1328
|
-
log?.("warn", "NapCat \u4E0E LLBot \u534F\u8BAE\u540C\u65F6\u542F\u7528\uFF0C\u5C06\u4F18\u5148\u4F7F\u7528 LLBot\u3002");
|
|
1329
|
-
return "llbot";
|
|
1330
|
-
}
|
|
1331
|
-
if (config.enableLlbotProtocol) return "llbot";
|
|
1332
|
-
if (config.enableNapCatProtocol) return "napcat";
|
|
1333
|
-
log?.("warn", "\u672A\u542F\u7528 OneBot \u534F\u8BAE\u9009\u9879\uFF0C\u9ED8\u8BA4\u4F7F\u7528 NapCat\u3002");
|
|
1334
|
-
return "napcat";
|
|
1329
|
+
return config.oneBotProtocol;
|
|
1335
1330
|
}
|
|
1336
1331
|
function registerNativeTools(deps) {
|
|
1337
1332
|
const { ctx, config, plugin, protocol, log } = deps;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "koishi-plugin-chatluna-toolbox",
|
|
3
3
|
"description": "为 ChatLuna 提供更多原生工具、XML 工具与变量,仅支持 onebot 平台。",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.17",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
7
7
|
"files": [
|
|
@@ -15,6 +15,12 @@
|
|
|
15
15
|
"type": "git",
|
|
16
16
|
"url": "https://github.com/Sor85/AAAAACAT-chatluna-plugins.git"
|
|
17
17
|
},
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "tsup && vite build",
|
|
20
|
+
"watch": "tsup --watch",
|
|
21
|
+
"typecheck": "yarn workspace shared-chatluna-xmltools build && NODE_OPTIONS=--max-old-space-size=8192 tsc -p tsconfig.test.json",
|
|
22
|
+
"test": "vitest run"
|
|
23
|
+
},
|
|
18
24
|
"keywords": [
|
|
19
25
|
"chatbot",
|
|
20
26
|
"koishi",
|
|
@@ -22,16 +28,16 @@
|
|
|
22
28
|
"chatluna"
|
|
23
29
|
],
|
|
24
30
|
"peerDependencies": {
|
|
31
|
+
"@koishijs/plugin-console": "^5.30.0",
|
|
25
32
|
"koishi": "^4.18.7",
|
|
26
33
|
"koishi-plugin-chatluna": "*",
|
|
27
|
-
"koishi-plugin-chatluna-character": "*"
|
|
28
|
-
"@koishijs/plugin-console": "^5.30.0"
|
|
34
|
+
"koishi-plugin-chatluna-character": "*"
|
|
29
35
|
},
|
|
30
36
|
"peerDependenciesMeta": {
|
|
31
|
-
"
|
|
37
|
+
"@koishijs/plugin-console": {
|
|
32
38
|
"optional": true
|
|
33
39
|
},
|
|
34
|
-
"
|
|
40
|
+
"koishi-plugin-chatluna-character": {
|
|
35
41
|
"optional": true
|
|
36
42
|
}
|
|
37
43
|
},
|
|
@@ -44,17 +50,12 @@
|
|
|
44
50
|
"@types/node": "^22.10.1",
|
|
45
51
|
"@vitejs/plugin-vue": "^6.0.2",
|
|
46
52
|
"sass": "^1.77.0",
|
|
53
|
+
"shared-chatluna-xmltools": "0.0.1",
|
|
54
|
+
"shared-nav": "0.0.1",
|
|
47
55
|
"tsup": "^8.0.0",
|
|
48
56
|
"typescript": "^5.7.2",
|
|
49
57
|
"vite": "^6.0.0",
|
|
50
58
|
"vitest": "^3.2.4",
|
|
51
|
-
"
|
|
52
|
-
"shared-nav": "0.0.1"
|
|
53
|
-
},
|
|
54
|
-
"scripts": {
|
|
55
|
-
"build": "tsup && vite build",
|
|
56
|
-
"watch": "tsup --watch",
|
|
57
|
-
"typecheck": "NODE_OPTIONS=--max-old-space-size=8192 tsc -p tsconfig.test.json",
|
|
58
|
-
"test": "vitest run"
|
|
59
|
+
"vue": "^3.5.21"
|
|
59
60
|
}
|
|
60
61
|
}
|