koishi-plugin-onebot-group-manage 0.0.6 → 0.0.7
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/lib/index.js +13 -11
- package/package.json +2 -2
package/lib/index.js
CHANGED
|
@@ -43,11 +43,11 @@ var GroupMuteTool = class extends import_tools.StructuredTool {
|
|
|
43
43
|
__name(this, "GroupMuteTool");
|
|
44
44
|
}
|
|
45
45
|
name = "group_mute";
|
|
46
|
-
description = "
|
|
46
|
+
description = "在群内禁言成员,duration为0表示取消禁言";
|
|
47
47
|
schema = import_zod.z.object({
|
|
48
|
-
groupId: import_zod.z.string().
|
|
49
|
-
userId: import_zod.z.string().
|
|
50
|
-
duration: import_zod.z.number().int().
|
|
48
|
+
groupId: import_zod.z.string().describe("目标群号,不填则使用当前会话群").optional(),
|
|
49
|
+
userId: import_zod.z.string().describe("要禁言的成员 QQ 号"),
|
|
50
|
+
duration: import_zod.z.number().int().min(0).describe("禁言时长(秒)")
|
|
51
51
|
});
|
|
52
52
|
async _call(input, _runManager, runnableConfig) {
|
|
53
53
|
const session = runnableConfig?.configurable?.session;
|
|
@@ -83,9 +83,9 @@ var GroupTitleTool = class extends import_tools.StructuredTool {
|
|
|
83
83
|
name = "group_set_title";
|
|
84
84
|
description = "为成员设置群头衔(需群主权限)";
|
|
85
85
|
schema = import_zod.z.object({
|
|
86
|
-
groupId: import_zod.z.string().
|
|
87
|
-
userId: import_zod.z.string().
|
|
88
|
-
title: import_zod.z.string().
|
|
86
|
+
groupId: import_zod.z.string().describe("目标群号,不填则使用当前会话群").optional(),
|
|
87
|
+
userId: import_zod.z.string().describe("要设置头衔的成员 QQ 号"),
|
|
88
|
+
title: import_zod.z.string().describe("头衔文案")
|
|
89
89
|
});
|
|
90
90
|
async _call(input, _runManager, runnableConfig) {
|
|
91
91
|
const session = runnableConfig?.configurable?.session;
|
|
@@ -357,9 +357,11 @@ async function performMute(ctx, session, params, config, logger, verbose) {
|
|
|
357
357
|
const targetId = params.targetId ?? parseTargetId(params.targetRaw || "", session);
|
|
358
358
|
if (!targetId) return "请提供要禁言的用户(@ 或 QQ 号)";
|
|
359
359
|
const seconds = Number(params.duration);
|
|
360
|
-
if (!Number.isFinite(seconds) || seconds
|
|
361
|
-
|
|
362
|
-
|
|
360
|
+
if (!Number.isFinite(seconds) || seconds < 0) return "禁言时长必须为大于等于 0 的整数(秒)";
|
|
361
|
+
if (!params.skipPermCheck) {
|
|
362
|
+
const msg = await verifyCaller(session, config.mute, logger, verbose, guildId);
|
|
363
|
+
if (msg) return msg;
|
|
364
|
+
}
|
|
363
365
|
verbose && logger.info(
|
|
364
366
|
`mute: guild=${guildId} caller=${session.userId} bot=${botKey(session.bot)} target=${targetId} seconds=${seconds}`
|
|
365
367
|
);
|
|
@@ -567,7 +569,7 @@ function apply(ctx, config) {
|
|
|
567
569
|
const result = await performMute(
|
|
568
570
|
ctx,
|
|
569
571
|
session,
|
|
570
|
-
{ targetId: session.userId, duration: seconds, guildId: session.guildId },
|
|
572
|
+
{ targetId: session.userId, duration: seconds, guildId: session.guildId, skipPermCheck: true },
|
|
571
573
|
config,
|
|
572
574
|
logger,
|
|
573
575
|
verbose
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "koishi-plugin-onebot-group-manage",
|
|
3
3
|
"description": "主要针对多bot环境的群管插件,自动使用有权限的bot",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.7",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
7
7
|
"files": [
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
"plugin"
|
|
16
16
|
],
|
|
17
17
|
"peerDependencies": {
|
|
18
|
-
"koishi": "^4.18.7",
|
|
19
18
|
"@langchain/core": "^0.3.0",
|
|
19
|
+
"koishi": "^4.18.7",
|
|
20
20
|
"koishi-plugin-chatluna": "^1.3.0",
|
|
21
21
|
"zod": "^3.23.8"
|
|
22
22
|
}
|