koishi-plugin-chatluna-toolbox 0.0.13 → 0.0.15
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 -0
- package/lib/index.js +227 -14
- package/package.json +4 -4
package/README.md
CHANGED
package/lib/index.js
CHANGED
|
@@ -423,8 +423,10 @@ __export(index_exports, {
|
|
|
423
423
|
createRandomProvider: () => createRandomProvider,
|
|
424
424
|
createSetGroupBanTool: () => createSetGroupBanTool,
|
|
425
425
|
createSetGroupCardTool: () => createSetGroupCardTool,
|
|
426
|
+
createSetGroupSpecialTitleTool: () => createSetGroupSpecialTitleTool,
|
|
426
427
|
createSetMsgEmojiTool: () => createSetMsgEmojiTool,
|
|
427
428
|
createSetProfileTool: () => createSetProfileTool,
|
|
429
|
+
createSetQQAvatarTool: () => createSetQQAvatarTool,
|
|
428
430
|
createUserInfoProvider: () => createUserInfoProvider,
|
|
429
431
|
createXmlProcessor: () => createXmlProcessor,
|
|
430
432
|
ensureOneBotSession: () => ensureOneBotSession,
|
|
@@ -443,7 +445,9 @@ __export(index_exports, {
|
|
|
443
445
|
sendMsgEmoji: () => sendMsgEmoji,
|
|
444
446
|
sendPoke: () => sendPoke,
|
|
445
447
|
sendSetGroupCard: () => sendSetGroupCard,
|
|
446
|
-
|
|
448
|
+
sendSetGroupSpecialTitle: () => sendSetGroupSpecialTitle,
|
|
449
|
+
sendSetProfile: () => sendSetProfile,
|
|
450
|
+
sendSetQQAvatar: () => sendSetQQAvatar
|
|
447
451
|
});
|
|
448
452
|
module.exports = __toCommonJS(index_exports);
|
|
449
453
|
|
|
@@ -463,8 +467,10 @@ var import_koishi2 = require("koishi");
|
|
|
463
467
|
// src/features/native-tools/defaults.ts
|
|
464
468
|
var DEFAULT_POKE_TOOL_DESCRIPTION = "\u5BF9\u6307\u5B9A\u7528\u6237\u6267\u884C\u6233\u4E00\u6233\u3002";
|
|
465
469
|
var DEFAULT_SET_SELF_PROFILE_TOOL_DESCRIPTION = "\u4FEE\u6539\u81EA\u5DF1\u7684 QQ \u8D44\u6599\uFF0C\u53EF\u8BBE\u7F6E\u6635\u79F0\u3001\u7B7E\u540D\u548C\u6027\u522B\u3002";
|
|
470
|
+
var DEFAULT_SET_QQ_AVATAR_TOOL_DESCRIPTION = "\u4FEE\u6539\u673A\u5668\u4EBA QQ \u5934\u50CF\u3002\u63D0\u4F9B imageUrl\uFF1BHTTP/HTTPS \u56FE\u7247\u4F1A\u5148\u7531 Koishi \u8BFB\u53D6\u5E76\u8F6C\u4E3A OneBot base64 \u6587\u4EF6\uFF0C\u907F\u514D\u4E34\u65F6 URL \u8FC7\u671F\u6216 OneBot \u7AEF\u65E0\u6CD5\u8BBF\u95EE\u3002";
|
|
466
471
|
var DEFAULT_SET_GROUP_CARD_TOOL_DESCRIPTION = "\u4FEE\u6539\u7FA4\u6210\u5458\u7684\u7FA4\u6635\u79F0\u3002";
|
|
467
472
|
var DEFAULT_SET_GROUP_BAN_TOOL_DESCRIPTION = "\u7528\u4E8E\u7BA1\u7406\u7FA4\u6210\u5458\u7981\u8A00\u72B6\u6001\uFF0C\u53EF\u8BBE\u7F6E\u7981\u8A00\u65F6\u957F\u6216\u89E3\u9664\u7981\u8A00\u3002";
|
|
473
|
+
var DEFAULT_SET_GROUP_SPECIAL_TITLE_TOOL_DESCRIPTION = "\u4FEE\u6539\u6216\u6E05\u9664\u7FA4\u6210\u5458\u7684 QQ \u7FA4\u4E13\u5C5E\u5934\u8854\u3002";
|
|
468
474
|
var DEFAULT_SET_MSG_EMOJI_TOOL_DESCRIPTION = "\u5BF9\u6307\u5B9A\u6D88\u606F\u6DFB\u52A0\u8868\u60C5\u56DE\u5E94\u3002";
|
|
469
475
|
var DEFAULT_DELETE_MESSAGE_TOOL_DESCRIPTION = "\u6839\u636E\u6D88\u606F ID \u64A4\u56DE\u6307\u5B9A\u6D88\u606F\u3002";
|
|
470
476
|
|
|
@@ -482,6 +488,11 @@ var NativeToolsSchema = import_koishi2.Schema.object({
|
|
|
482
488
|
toolName: import_koishi2.Schema.string().default("set_self_profile").description("\u5DE5\u5177\u540D\u79F0"),
|
|
483
489
|
description: import_koishi2.Schema.string().default(DEFAULT_SET_SELF_PROFILE_TOOL_DESCRIPTION).description("\u5DE5\u5177\u63CF\u8FF0")
|
|
484
490
|
}).description("\u4FEE\u6539\u81EA\u8EAB\u8D26\u6237\u4FE1\u606F\u5DE5\u5177").collapse(),
|
|
491
|
+
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"),
|
|
493
|
+
toolName: import_koishi2.Schema.string().default("set_qq_avatar").description("\u5DE5\u5177\u540D\u79F0"),
|
|
494
|
+
description: import_koishi2.Schema.string().default(DEFAULT_SET_QQ_AVATAR_TOOL_DESCRIPTION).description("\u5DE5\u5177\u63CF\u8FF0")
|
|
495
|
+
}).description("\u4FEE\u6539 QQ \u5934\u50CF\u5DE5\u5177").collapse(),
|
|
485
496
|
setGroupCard: import_koishi2.Schema.object({
|
|
486
497
|
enabled: import_koishi2.Schema.boolean().default(false).description("\u6CE8\u518C ChatLuna \u5DE5\u5177\uFF1A\u4FEE\u6539\u7FA4\u6210\u5458\u6635\u79F0"),
|
|
487
498
|
toolName: import_koishi2.Schema.string().default("set_group_card").description("\u5DE5\u5177\u540D\u79F0"),
|
|
@@ -492,6 +503,11 @@ var NativeToolsSchema = import_koishi2.Schema.object({
|
|
|
492
503
|
toolName: import_koishi2.Schema.string().default("set_group_ban").description("\u5DE5\u5177\u540D\u79F0"),
|
|
493
504
|
description: import_koishi2.Schema.string().default(DEFAULT_SET_GROUP_BAN_TOOL_DESCRIPTION).description("\u5DE5\u5177\u63CF\u8FF0")
|
|
494
505
|
}).description("\u7981\u8A00\u5DE5\u5177").collapse(),
|
|
506
|
+
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"),
|
|
508
|
+
toolName: import_koishi2.Schema.string().default("set_group_special_title").description("\u5DE5\u5177\u540D\u79F0"),
|
|
509
|
+
description: import_koishi2.Schema.string().default(DEFAULT_SET_GROUP_SPECIAL_TITLE_TOOL_DESCRIPTION).description("\u5DE5\u5177\u63CF\u8FF0")
|
|
510
|
+
}).description("\u4FEE\u6539\u7FA4\u6210\u5458\u4E13\u5C5E\u5934\u8854\u5DE5\u5177").collapse(),
|
|
495
511
|
setMsgEmoji: import_koishi2.Schema.object({
|
|
496
512
|
enabled: import_koishi2.Schema.boolean().default(false).description(
|
|
497
513
|
"\u6CE8\u518C ChatLuna \u5DE5\u5177\uFF1A\u7ED9\u6D88\u606F\u6DFB\u52A0\u8868\u60C5\uFF08\u9700 chatluna-character \u5F00\u542F enableMessageId\uFF0C\u4E0E XML\u5DE5\u5177 \u4E8C\u9009\u4E00\uFF0C\u8868\u60C5\u5BF9\u7167\u8868\uFF1Ahttps://bot.q.qq.com/wiki/develop/pythonsdk/model/emoji.html \uFF09"
|
|
@@ -517,6 +533,11 @@ var NativeToolsSchema = import_koishi2.Schema.object({
|
|
|
517
533
|
toolName: "set_self_profile",
|
|
518
534
|
description: DEFAULT_SET_SELF_PROFILE_TOOL_DESCRIPTION
|
|
519
535
|
},
|
|
536
|
+
setQQAvatar: {
|
|
537
|
+
enabled: false,
|
|
538
|
+
toolName: "set_qq_avatar",
|
|
539
|
+
description: DEFAULT_SET_QQ_AVATAR_TOOL_DESCRIPTION
|
|
540
|
+
},
|
|
520
541
|
setGroupCard: {
|
|
521
542
|
enabled: false,
|
|
522
543
|
toolName: "set_group_card",
|
|
@@ -527,6 +548,11 @@ var NativeToolsSchema = import_koishi2.Schema.object({
|
|
|
527
548
|
toolName: "set_group_ban",
|
|
528
549
|
description: DEFAULT_SET_GROUP_BAN_TOOL_DESCRIPTION
|
|
529
550
|
},
|
|
551
|
+
setGroupSpecialTitle: {
|
|
552
|
+
enabled: false,
|
|
553
|
+
toolName: "set_group_special_title",
|
|
554
|
+
description: DEFAULT_SET_GROUP_SPECIAL_TITLE_TOOL_DESCRIPTION
|
|
555
|
+
},
|
|
530
556
|
setMsgEmoji: {
|
|
531
557
|
enabled: false,
|
|
532
558
|
toolName: "set_msg_emoji",
|
|
@@ -1014,9 +1040,73 @@ function createSetGroupCardTool(deps) {
|
|
|
1014
1040
|
}();
|
|
1015
1041
|
}
|
|
1016
1042
|
|
|
1017
|
-
// src/features/native-tools/tools/set-
|
|
1043
|
+
// src/features/native-tools/tools/set-group-special-title.ts
|
|
1018
1044
|
var import_zod5 = require("zod");
|
|
1019
1045
|
var import_tools4 = require("@langchain/core/tools");
|
|
1046
|
+
function resolveGroupId2(session, groupId) {
|
|
1047
|
+
return groupId?.trim() || (session.guildId || "").trim() || (session.channelId || "").trim() || (session.roomId || "").trim();
|
|
1048
|
+
}
|
|
1049
|
+
async function sendSetGroupSpecialTitle(params) {
|
|
1050
|
+
try {
|
|
1051
|
+
const { session, userId, groupId, title, log } = params;
|
|
1052
|
+
const {
|
|
1053
|
+
error,
|
|
1054
|
+
internal,
|
|
1055
|
+
session: validatedSession
|
|
1056
|
+
} = ensureOneBotSession(session);
|
|
1057
|
+
if (error) return error;
|
|
1058
|
+
const resolvedGroupId = resolveGroupId2(validatedSession, groupId);
|
|
1059
|
+
if (!resolvedGroupId) {
|
|
1060
|
+
return "Missing groupId. Provide groupId explicitly or run inside a group session.";
|
|
1061
|
+
}
|
|
1062
|
+
const userIdRaw = userId.trim();
|
|
1063
|
+
if (!userIdRaw) return "userId is required.";
|
|
1064
|
+
const titleRaw = title.trim();
|
|
1065
|
+
await callOneBotAPI(
|
|
1066
|
+
internal,
|
|
1067
|
+
"set_group_special_title",
|
|
1068
|
+
{
|
|
1069
|
+
group_id: resolvedGroupId,
|
|
1070
|
+
user_id: userIdRaw,
|
|
1071
|
+
special_title: titleRaw
|
|
1072
|
+
},
|
|
1073
|
+
["setGroupSpecialTitle"]
|
|
1074
|
+
);
|
|
1075
|
+
const message = titleRaw ? `\u7FA4\u4E13\u5C5E\u5934\u8854\u5DF2\u66F4\u65B0\uFF1A${userIdRaw} -> ${titleRaw}` : `\u7FA4\u4E13\u5C5E\u5934\u8854\u5DF2\u6E05\u9664\uFF1A${userIdRaw}`;
|
|
1076
|
+
log?.("info", message);
|
|
1077
|
+
return message;
|
|
1078
|
+
} catch (error) {
|
|
1079
|
+
params.log?.("warn", "set_group_special_title failed", error);
|
|
1080
|
+
return `set_group_special_title failed: ${error.message}`;
|
|
1081
|
+
}
|
|
1082
|
+
}
|
|
1083
|
+
function createSetGroupSpecialTitleTool(deps) {
|
|
1084
|
+
const { toolName, description, protocol, log } = deps;
|
|
1085
|
+
return new class extends import_tools4.StructuredTool {
|
|
1086
|
+
name = toolName || "set_group_special_title";
|
|
1087
|
+
description = description || DEFAULT_SET_GROUP_SPECIAL_TITLE_TOOL_DESCRIPTION;
|
|
1088
|
+
schema = import_zod5.z.object({
|
|
1089
|
+
groupId: import_zod5.z.string().optional().describe("Target group ID. Defaults to current session group."),
|
|
1090
|
+
userId: import_zod5.z.string().min(1, "userId is required").describe("Target member user ID."),
|
|
1091
|
+
title: import_zod5.z.string().describe("New special title. Use an empty string to clear it.")
|
|
1092
|
+
});
|
|
1093
|
+
async _call(input, _manager, runnable) {
|
|
1094
|
+
const session = getSession(runnable);
|
|
1095
|
+
return sendSetGroupSpecialTitle({
|
|
1096
|
+
session,
|
|
1097
|
+
userId: input.userId,
|
|
1098
|
+
title: input.title,
|
|
1099
|
+
groupId: input.groupId,
|
|
1100
|
+
protocol,
|
|
1101
|
+
log
|
|
1102
|
+
});
|
|
1103
|
+
}
|
|
1104
|
+
}();
|
|
1105
|
+
}
|
|
1106
|
+
|
|
1107
|
+
// src/features/native-tools/tools/set-msg-emoji.ts
|
|
1108
|
+
var import_zod6 = require("zod");
|
|
1109
|
+
var import_tools5 = require("@langchain/core/tools");
|
|
1020
1110
|
async function sendMsgEmoji(params) {
|
|
1021
1111
|
try {
|
|
1022
1112
|
const { session, messageId, emojiId, log, protocol } = params;
|
|
@@ -1047,12 +1137,12 @@ async function sendMsgEmoji(params) {
|
|
|
1047
1137
|
}
|
|
1048
1138
|
function createSetMsgEmojiTool(deps) {
|
|
1049
1139
|
const { toolName, description, log, protocol } = deps;
|
|
1050
|
-
return new class extends
|
|
1140
|
+
return new class extends import_tools5.StructuredTool {
|
|
1051
1141
|
name = toolName || "set_msg_emoji";
|
|
1052
1142
|
description = description || DEFAULT_SET_MSG_EMOJI_TOOL_DESCRIPTION;
|
|
1053
|
-
schema =
|
|
1054
|
-
messageId:
|
|
1055
|
-
emojiId:
|
|
1143
|
+
schema = import_zod6.z.object({
|
|
1144
|
+
messageId: import_zod6.z.string().min(1, "message_id is required").describe("Target message ID."),
|
|
1145
|
+
emojiId: import_zod6.z.string().min(1, "emoji_id is required").describe("Emoji ID to send.")
|
|
1056
1146
|
});
|
|
1057
1147
|
async _call(input, _manager, runnable) {
|
|
1058
1148
|
const session = getSession(runnable);
|
|
@@ -1068,8 +1158,8 @@ function createSetMsgEmojiTool(deps) {
|
|
|
1068
1158
|
}
|
|
1069
1159
|
|
|
1070
1160
|
// src/features/native-tools/tools/profile.ts
|
|
1071
|
-
var
|
|
1072
|
-
var
|
|
1161
|
+
var import_zod7 = require("zod");
|
|
1162
|
+
var import_tools6 = require("@langchain/core/tools");
|
|
1073
1163
|
var genders = {
|
|
1074
1164
|
unknown: "0",
|
|
1075
1165
|
male: "1",
|
|
@@ -1096,13 +1186,13 @@ async function sendSetProfile(params) {
|
|
|
1096
1186
|
}
|
|
1097
1187
|
function createSetProfileTool(deps) {
|
|
1098
1188
|
const { toolName, description, log, protocol } = deps;
|
|
1099
|
-
return new class extends
|
|
1189
|
+
return new class extends import_tools6.StructuredTool {
|
|
1100
1190
|
name = toolName || "set_self_profile";
|
|
1101
1191
|
description = description || DEFAULT_SET_SELF_PROFILE_TOOL_DESCRIPTION;
|
|
1102
|
-
schema =
|
|
1103
|
-
nickname:
|
|
1104
|
-
signature:
|
|
1105
|
-
gender:
|
|
1192
|
+
schema = import_zod7.z.object({
|
|
1193
|
+
nickname: import_zod7.z.string().min(1, "nickname is required").describe("The new nickname for the bot."),
|
|
1194
|
+
signature: import_zod7.z.string().optional().describe("Optional: the new personal signature."),
|
|
1195
|
+
gender: import_zod7.z.enum(["unknown", "male", "female"]).optional().describe("Optional: the new gender.")
|
|
1106
1196
|
});
|
|
1107
1197
|
async _call(input, _manager, runnable) {
|
|
1108
1198
|
return sendSetProfile({
|
|
@@ -1117,6 +1207,84 @@ function createSetProfileTool(deps) {
|
|
|
1117
1207
|
}();
|
|
1118
1208
|
}
|
|
1119
1209
|
|
|
1210
|
+
// src/features/native-tools/tools/set-qq-avatar.ts
|
|
1211
|
+
var import_zod8 = require("zod");
|
|
1212
|
+
var import_tools7 = require("@langchain/core/tools");
|
|
1213
|
+
function isHttpUrl(value) {
|
|
1214
|
+
return /^https?:\/\//i.test(value);
|
|
1215
|
+
}
|
|
1216
|
+
function toBuffer(data) {
|
|
1217
|
+
if (Buffer.isBuffer(data)) return data;
|
|
1218
|
+
if (data instanceof ArrayBuffer) return Buffer.from(data);
|
|
1219
|
+
if (ArrayBuffer.isView(data)) {
|
|
1220
|
+
return Buffer.from(data.buffer, data.byteOffset, data.byteLength);
|
|
1221
|
+
}
|
|
1222
|
+
if (typeof data === "string") return Buffer.from(data);
|
|
1223
|
+
throw new Error("unsupported image response body.");
|
|
1224
|
+
}
|
|
1225
|
+
async function fetchImageAsOneBotFile(ctx, imageUrl) {
|
|
1226
|
+
if (!isHttpUrl(imageUrl)) return imageUrl;
|
|
1227
|
+
try {
|
|
1228
|
+
const http = ctx?.http;
|
|
1229
|
+
const data = typeof http?.get === "function" ? await http.get(imageUrl, { responseType: "arraybuffer" }) : await fetch(imageUrl).then(async (response) => {
|
|
1230
|
+
if (!response.ok) {
|
|
1231
|
+
throw new Error(`HTTP ${response.status}`);
|
|
1232
|
+
}
|
|
1233
|
+
return response.arrayBuffer();
|
|
1234
|
+
});
|
|
1235
|
+
return `base64://${toBuffer(data).toString("base64")}`;
|
|
1236
|
+
} catch (error) {
|
|
1237
|
+
throw new Error(`\u65E0\u6CD5\u8BFB\u53D6\u5934\u50CF\u56FE\u7247\uFF1A${error.message}`);
|
|
1238
|
+
}
|
|
1239
|
+
}
|
|
1240
|
+
function assertOneBotSuccess(result) {
|
|
1241
|
+
const response = result;
|
|
1242
|
+
if (!response || typeof response !== "object") return;
|
|
1243
|
+
const failed = response.status === "failed" || typeof response.retcode === "number" && response.retcode !== 0;
|
|
1244
|
+
if (!failed) return;
|
|
1245
|
+
const reason = response.wording || response.message || response.status;
|
|
1246
|
+
const retcode = typeof response.retcode === "number" ? ` (retcode: ${response.retcode})` : "";
|
|
1247
|
+
throw new Error(`${reason || "OneBot returned failed"}${retcode}`);
|
|
1248
|
+
}
|
|
1249
|
+
async function sendSetQQAvatar(params) {
|
|
1250
|
+
const { ctx, session, log } = params;
|
|
1251
|
+
try {
|
|
1252
|
+
const imageUrl = params.imageUrl.trim();
|
|
1253
|
+
if (!imageUrl) return "imageUrl is required.";
|
|
1254
|
+
const { error, internal } = ensureOneBotSession(session);
|
|
1255
|
+
if (error) return error;
|
|
1256
|
+
const file = await fetchImageAsOneBotFile(ctx, imageUrl);
|
|
1257
|
+
const result = await callOneBotAPI(internal, "set_qq_avatar", { file }, [
|
|
1258
|
+
"setQQAvatar"
|
|
1259
|
+
]);
|
|
1260
|
+
assertOneBotSuccess(result);
|
|
1261
|
+
const message = "QQ \u5934\u50CF\u5DF2\u66F4\u65B0\u3002";
|
|
1262
|
+
log?.("info", message);
|
|
1263
|
+
return message;
|
|
1264
|
+
} catch (error) {
|
|
1265
|
+
log?.("warn", "set_qq_avatar failed", error);
|
|
1266
|
+
return `set_qq_avatar failed: ${error.message}`;
|
|
1267
|
+
}
|
|
1268
|
+
}
|
|
1269
|
+
function createSetQQAvatarTool(deps) {
|
|
1270
|
+
const { ctx, toolName, description, log } = deps;
|
|
1271
|
+
return new class extends import_tools7.StructuredTool {
|
|
1272
|
+
name = toolName || "set_qq_avatar";
|
|
1273
|
+
description = description || DEFAULT_SET_QQ_AVATAR_TOOL_DESCRIPTION;
|
|
1274
|
+
schema = import_zod8.z.object({
|
|
1275
|
+
imageUrl: import_zod8.z.string().min(1, "imageUrl is required").describe("Image URL or local file path readable by the OneBot side.")
|
|
1276
|
+
});
|
|
1277
|
+
async _call(input, _manager, runnable) {
|
|
1278
|
+
return sendSetQQAvatar({
|
|
1279
|
+
session: getSession(runnable),
|
|
1280
|
+
imageUrl: input.imageUrl,
|
|
1281
|
+
ctx,
|
|
1282
|
+
log
|
|
1283
|
+
});
|
|
1284
|
+
}
|
|
1285
|
+
}();
|
|
1286
|
+
}
|
|
1287
|
+
|
|
1120
1288
|
// src/features/native-tools/register.ts
|
|
1121
1289
|
var NATIVE_TOOL_DEFAULT_AVAILABILITY = {
|
|
1122
1290
|
enabled: true,
|
|
@@ -1185,6 +1353,24 @@ function registerNativeTools(deps) {
|
|
|
1185
1353
|
});
|
|
1186
1354
|
log?.("info", `\u8BBE\u7F6E\u8D44\u6599\u5DE5\u5177\u5DF2\u6CE8\u518C: ${toolName}`);
|
|
1187
1355
|
}
|
|
1356
|
+
if (config.setQQAvatar.enabled) {
|
|
1357
|
+
const toolName = resolveToolName(
|
|
1358
|
+
config.setQQAvatar.toolName,
|
|
1359
|
+
"set_qq_avatar"
|
|
1360
|
+
);
|
|
1361
|
+
const description = resolveToolDescription(
|
|
1362
|
+
config.setQQAvatar.description,
|
|
1363
|
+
DEFAULT_SET_QQ_AVATAR_TOOL_DESCRIPTION
|
|
1364
|
+
);
|
|
1365
|
+
plugin.registerTool(toolName, {
|
|
1366
|
+
selector: () => true,
|
|
1367
|
+
authorization: (session) => session?.platform === "onebot",
|
|
1368
|
+
description,
|
|
1369
|
+
createTool: () => createSetQQAvatarTool({ ctx, toolName, description, log }),
|
|
1370
|
+
meta: createNativeToolMeta("onebot", ["profile"])
|
|
1371
|
+
});
|
|
1372
|
+
log?.("info", `QQ \u5934\u50CF\u5DE5\u5177\u5DF2\u6CE8\u518C: ${toolName}`);
|
|
1373
|
+
}
|
|
1188
1374
|
if (config.setGroupCard.enabled) {
|
|
1189
1375
|
const toolName = resolveToolName(
|
|
1190
1376
|
config.setGroupCard.toolName,
|
|
@@ -1221,6 +1407,29 @@ function registerNativeTools(deps) {
|
|
|
1221
1407
|
});
|
|
1222
1408
|
log?.("info", `\u7FA4\u6210\u5458\u7981\u8A00\u5DE5\u5177\u5DF2\u6CE8\u518C: ${toolName}`);
|
|
1223
1409
|
}
|
|
1410
|
+
if (config.setGroupSpecialTitle.enabled) {
|
|
1411
|
+
const toolName = resolveToolName(
|
|
1412
|
+
config.setGroupSpecialTitle.toolName,
|
|
1413
|
+
"set_group_special_title"
|
|
1414
|
+
);
|
|
1415
|
+
const description = resolveToolDescription(
|
|
1416
|
+
config.setGroupSpecialTitle.description,
|
|
1417
|
+
DEFAULT_SET_GROUP_SPECIAL_TITLE_TOOL_DESCRIPTION
|
|
1418
|
+
);
|
|
1419
|
+
plugin.registerTool(toolName, {
|
|
1420
|
+
selector: () => true,
|
|
1421
|
+
authorization: (session) => session?.platform === "onebot",
|
|
1422
|
+
description,
|
|
1423
|
+
createTool: () => createSetGroupSpecialTitleTool({
|
|
1424
|
+
toolName,
|
|
1425
|
+
description,
|
|
1426
|
+
log,
|
|
1427
|
+
protocol
|
|
1428
|
+
}),
|
|
1429
|
+
meta: createNativeToolMeta("onebot", ["group"])
|
|
1430
|
+
});
|
|
1431
|
+
log?.("info", `\u7FA4\u4E13\u5C5E\u5934\u8854\u5DE5\u5177\u5DF2\u6CE8\u518C: ${toolName}`);
|
|
1432
|
+
}
|
|
1224
1433
|
if (config.setMsgEmoji.enabled) {
|
|
1225
1434
|
const toolName = resolveToolName(
|
|
1226
1435
|
config.setMsgEmoji.toolName,
|
|
@@ -2669,8 +2878,10 @@ function apply(ctx, config) {
|
|
|
2669
2878
|
createRandomProvider,
|
|
2670
2879
|
createSetGroupBanTool,
|
|
2671
2880
|
createSetGroupCardTool,
|
|
2881
|
+
createSetGroupSpecialTitleTool,
|
|
2672
2882
|
createSetMsgEmojiTool,
|
|
2673
2883
|
createSetProfileTool,
|
|
2884
|
+
createSetQQAvatarTool,
|
|
2674
2885
|
createUserInfoProvider,
|
|
2675
2886
|
createXmlProcessor,
|
|
2676
2887
|
ensureOneBotSession,
|
|
@@ -2689,5 +2900,7 @@ function apply(ctx, config) {
|
|
|
2689
2900
|
sendMsgEmoji,
|
|
2690
2901
|
sendPoke,
|
|
2691
2902
|
sendSetGroupCard,
|
|
2692
|
-
|
|
2903
|
+
sendSetGroupSpecialTitle,
|
|
2904
|
+
sendSetProfile,
|
|
2905
|
+
sendSetQQAvatar
|
|
2693
2906
|
});
|
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.15",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
7
7
|
"files": [
|
|
@@ -10,10 +10,10 @@
|
|
|
10
10
|
"client"
|
|
11
11
|
],
|
|
12
12
|
"license": "MIT",
|
|
13
|
-
"homepage": "https://github.com/Sor85/
|
|
13
|
+
"homepage": "https://github.com/Sor85/AAAAACAT-chatluna-plugins",
|
|
14
14
|
"repository": {
|
|
15
15
|
"type": "git",
|
|
16
|
-
"url": "https://github.com/Sor85/
|
|
16
|
+
"url": "https://github.com/Sor85/AAAAACAT-chatluna-plugins.git"
|
|
17
17
|
},
|
|
18
18
|
"keywords": [
|
|
19
19
|
"chatbot",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"scripts": {
|
|
55
55
|
"build": "tsup && vite build",
|
|
56
56
|
"watch": "tsup --watch",
|
|
57
|
-
"typecheck": "NODE_OPTIONS=--max-old-space-size=8192 tsc
|
|
57
|
+
"typecheck": "NODE_OPTIONS=--max-old-space-size=8192 tsc -p tsconfig.test.json",
|
|
58
58
|
"test": "vitest run"
|
|
59
59
|
}
|
|
60
60
|
}
|