@nestim/koishi-plugin-qq-group-manager 0.1.7 → 0.1.8
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/commands.js +14 -166
- package/lib/index.d.ts +1 -3
- package/lib/index.js +24 -51
- package/lib/service.d.ts +7 -21
- package/lib/service.js +886 -666
- package/package.json +2 -2
- package/readme.md +104 -33
package/lib/commands.js
CHANGED
|
@@ -1,170 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* 指令注册层。
|
|
4
|
+
*
|
|
5
|
+
* 说明:所有群管指令均为「方括号直连」语法(如 [mute] 12345 10 广告),
|
|
6
|
+
* 由 service.routeBracketCommand 在消息监听中直接处理。
|
|
7
|
+
*
|
|
8
|
+
* 这里**不再**用 ctx.command 注册 [bot]:一旦注册,Koishi 会在 [bot] 消息下
|
|
9
|
+
* 自动追加一份它自己生成的子指令列表(旧菜单),与插件自己的英文菜单同时
|
|
10
|
+
* 出现,导致发一次 [bot] 冒出新旧两个菜单。现在 [bot] 完全由 routeBracketCommand
|
|
11
|
+
* 处理,只输出一份菜单。
|
|
12
|
+
*/
|
|
2
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
14
|
exports.registerCommands = registerCommands;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
return `喵~ ${text}`;
|
|
8
|
-
}
|
|
9
|
-
function formatAction(result, config, displayTarget) {
|
|
10
|
-
let text = result.message;
|
|
11
|
-
if (displayTarget && result.plan?.targetId) {
|
|
12
|
-
text = text.split(result.plan.targetId).join(displayTarget);
|
|
13
|
-
}
|
|
14
|
-
return styleText(text, config);
|
|
15
|
-
}
|
|
16
|
-
function registerCommands(ctx, service, config) {
|
|
17
|
-
ctx.command(`${config.menuCommand} [keyword:text]`, '查看 Meow 图片菜单')
|
|
18
|
-
.action(async ({ session }, keyword) => {
|
|
19
|
-
if (!keyword)
|
|
20
|
-
service.armMenuPairing(session, 30_000);
|
|
21
|
-
const result = await service.renderMenu(keyword, session);
|
|
22
|
-
service.logCommandResult('menu', { ok: true, message: 'menu rendered' }, session, { keyword });
|
|
23
|
-
return result;
|
|
24
|
-
});
|
|
25
|
-
ctx.command(`${config.command}菜单`, `查看 ${config.command} 分类菜单`)
|
|
26
|
-
.action(async ({ session }) => {
|
|
27
|
-
const result = await service.renderMenu(`${config.command}菜单`, session);
|
|
28
|
-
service.logCommandResult('menu-parent-shortcut', { ok: true, message: 'parent menu shortcut rendered' }, session, { parent: config.command });
|
|
29
|
-
return result;
|
|
30
|
-
});
|
|
31
|
-
const root = ctx.command(config.command, 'QQ群管理命令入口');
|
|
32
|
-
root
|
|
33
|
-
.subcommand('查图', '识图调试:查看本条消息中被识别的图片信息')
|
|
34
|
-
.action(async ({ session }) => {
|
|
35
|
-
const auth = await service.authorizeCommand('img-debug', session);
|
|
36
|
-
if (!auth.ok)
|
|
37
|
-
return auth.userMessage ?? '权限不足或上下文不符合要求。';
|
|
38
|
-
const info = service.describeImageMessage(session);
|
|
39
|
-
const lines = [];
|
|
40
|
-
lines.push(`图片元素数量: ${info.elementImages.length}`);
|
|
41
|
-
lines.push(`CQ图片段: ${info.rawCq.length} 个`);
|
|
42
|
-
lines.push(`可发送链接: ${info.extractableUrls.length} 个`);
|
|
43
|
-
if (info.extractableUrls.length) {
|
|
44
|
-
info.extractableUrls.forEach((u, i) => lines.push(` ${i + 1}. ${u}`));
|
|
45
|
-
}
|
|
46
|
-
else if (info.rawCq.length) {
|
|
47
|
-
lines.push('CQ图片原始片段:');
|
|
48
|
-
info.rawCq.forEach((c, i) => lines.push(` ${i + 1}. ${c}`));
|
|
49
|
-
}
|
|
50
|
-
else if (info.elementImages.length) {
|
|
51
|
-
lines.push('图片元素原始字段:');
|
|
52
|
-
info.elementImages.forEach((im, i) => lines.push(` ${i + 1}. ${JSON.stringify(im)}`));
|
|
53
|
-
}
|
|
54
|
-
else {
|
|
55
|
-
lines.push('本条消息未检测到图片。请在群内发送一张图片(可同时附加该指令)后重试。');
|
|
56
|
-
}
|
|
57
|
-
return styleText('识图诊断:\n' + lines.join('\n'), config);
|
|
58
|
-
});
|
|
59
|
-
root
|
|
60
|
-
.subcommand('kick <target:string>', '踢出群成员')
|
|
61
|
-
.option('reject', '-r 拒绝再次加群请求')
|
|
62
|
-
.option('reason', '-m <reason:string> 操作原因')
|
|
63
|
-
.action(async ({ session, options }, target) => {
|
|
64
|
-
if (!target)
|
|
65
|
-
return '请提供目标 QQ 号或 @目标。';
|
|
66
|
-
const auth = await service.authorizeCommand('kick', session);
|
|
67
|
-
if (!auth.ok)
|
|
68
|
-
return auth.userMessage ?? '权限不足或上下文不符合要求。';
|
|
69
|
-
const result = await service.kick(session, target, options.reject, options.reason);
|
|
70
|
-
service.logCommandResult('kick', result, session, { target, reject: options.reject });
|
|
71
|
-
const displayTarget = await service.formatTargetDisplay(session, result.plan?.targetId, target);
|
|
72
|
-
return formatAction(result, config, displayTarget);
|
|
73
|
-
});
|
|
74
|
-
root
|
|
75
|
-
.subcommand('mute [target:string] [duration:string]', '禁言群成员(@用户或QQ号 + 时长,如 10分钟/1小时/1天)')
|
|
76
|
-
.option('reason', '-r <reason:string> 操作原因')
|
|
77
|
-
.action(async ({ session, options }) => {
|
|
78
|
-
// 参数由 service 从原始消息中智能解析,避免把禁言时长误判为目标 QQ 号
|
|
79
|
-
const parsed = await service.parseMuteArguments(session);
|
|
80
|
-
if (!parsed.ok) {
|
|
81
|
-
service.logCommandResult('mute', { ok: false, message: parsed.message }, session, { target: parsed.targetId });
|
|
82
|
-
return styleText(parsed.message, config);
|
|
83
|
-
}
|
|
84
|
-
const targetId = parsed.targetId;
|
|
85
|
-
const minutes = parsed.minutes;
|
|
86
|
-
if (await service.shouldSelfGag(session, targetId)) {
|
|
87
|
-
const result = await service.selfGag(session, 'mute-self-trigger');
|
|
88
|
-
service.logCommandResult('self-gag', result, session, { source: 'mute', target: targetId, minutes });
|
|
89
|
-
const displayTarget = await service.formatTargetDisplay(session, result.plan?.targetId, targetId);
|
|
90
|
-
return formatAction(result, config, displayTarget);
|
|
91
|
-
}
|
|
92
|
-
const auth = await service.authorizeCommand('mute', session);
|
|
93
|
-
if (!auth.ok) {
|
|
94
|
-
const punished = await service.punishUnauthorizedMuteAttempt(session, targetId);
|
|
95
|
-
if (punished) {
|
|
96
|
-
service.logCommandResult('punish-unauthorized-mute', punished, session, { source: 'mute', target: targetId, minutes });
|
|
97
|
-
const displayTarget = await service.formatTargetDisplay(session, punished.plan?.targetId, session?.userId);
|
|
98
|
-
return formatAction(punished, config, displayTarget);
|
|
99
|
-
}
|
|
100
|
-
return auth.userMessage ?? '权限不足或上下文不符合要求。';
|
|
101
|
-
}
|
|
102
|
-
const result = await service.mute(session, targetId, minutes, options.reason);
|
|
103
|
-
service.logCommandResult('mute', result, session, { target: targetId, minutes });
|
|
104
|
-
const displayTarget = await service.formatTargetDisplay(session, result.plan?.targetId, targetId);
|
|
105
|
-
return formatAction(result, config, displayTarget);
|
|
106
|
-
});
|
|
107
|
-
root
|
|
108
|
-
.subcommand('gag [target:string]', '自我约束(随机 1~60 分钟禁言)')
|
|
109
|
-
.alias('自我约束')
|
|
110
|
-
.option('reason', '-r <reason:string> 操作原因')
|
|
111
|
-
.action(async ({ session, options }, target) => {
|
|
112
|
-
if (!config.enableSelfGag)
|
|
113
|
-
return '自我约束功能未启用。';
|
|
114
|
-
if (!session?.userId)
|
|
115
|
-
return '无法识别当前账号。';
|
|
116
|
-
if (config.allowedUserIds.includes(session.userId))
|
|
117
|
-
return '喵~ 白名单用户不参与自我约束。';
|
|
118
|
-
const resolvedTarget = target || session.userId;
|
|
119
|
-
if (await service.shouldSelfGag(session, resolvedTarget)) {
|
|
120
|
-
const result = await service.selfGag(session, 'gag-trigger');
|
|
121
|
-
service.logCommandResult('self-gag', result, session, { source: 'gag', target: resolvedTarget });
|
|
122
|
-
const displayTarget = await service.formatTargetDisplay(session, result.plan?.targetId, resolvedTarget);
|
|
123
|
-
return formatAction(result, config, displayTarget);
|
|
124
|
-
}
|
|
125
|
-
const auth = await service.authorizeCommand('gag', session);
|
|
126
|
-
if (!auth.ok)
|
|
127
|
-
return auth.userMessage ?? '权限不足或上下文不符合要求。';
|
|
128
|
-
const randomMinutes = Math.floor(Math.random() * 60) + 1;
|
|
129
|
-
const result = await service.mute(session, resolvedTarget, randomMinutes, options.reason ?? 'gag');
|
|
130
|
-
service.logCommandResult('gag', result, session, { target: resolvedTarget, randomMinutes });
|
|
131
|
-
const displayTarget = await service.formatTargetDisplay(session, result.plan?.targetId, resolvedTarget);
|
|
132
|
-
return formatAction(result, config, displayTarget);
|
|
133
|
-
});
|
|
134
|
-
root
|
|
135
|
-
.subcommand('unmute <target:string>', '解除群成员禁言')
|
|
136
|
-
.option('reason', '-r <reason:string> 操作原因')
|
|
137
|
-
.action(async ({ session, options }, target) => {
|
|
138
|
-
if (!target)
|
|
139
|
-
return '请提供目标 QQ 号或 @目标。';
|
|
140
|
-
const auth = await service.authorizeCommand('unmute', session);
|
|
141
|
-
if (!auth.ok)
|
|
142
|
-
return auth.userMessage ?? '权限不足或上下文不符合要求。';
|
|
143
|
-
const result = await service.unmute(session, target, options.reason);
|
|
144
|
-
service.logCommandResult('unmute', result, session, { target });
|
|
145
|
-
const displayTarget = await service.formatTargetDisplay(session, result.plan?.targetId, target);
|
|
146
|
-
return formatAction(result, config, displayTarget);
|
|
147
|
-
});
|
|
148
|
-
root
|
|
149
|
-
.subcommand('admin <target:string> [state:string]', '设置或取消群管理员', {
|
|
150
|
-
dependencies: ['qqgm-admin'],
|
|
151
|
-
showWarning: false,
|
|
152
|
-
})
|
|
153
|
-
.option('reason', '-r <reason:string> 操作原因')
|
|
154
|
-
.action(async ({ session, options }, target, state) => {
|
|
155
|
-
if (!target)
|
|
156
|
-
return '请提供目标 QQ 号或 @目标。';
|
|
157
|
-
const auth = await service.authorizeCommand('admin', session);
|
|
158
|
-
if (!auth.ok)
|
|
159
|
-
return auth.userMessage ?? '权限不足或上下文不符合要求。';
|
|
160
|
-
const available = await service.canUseAdminCommand(session);
|
|
161
|
-
if (!available.ok)
|
|
162
|
-
return available.userMessage ?? '当前场景不可用该子命令。';
|
|
163
|
-
const normalized = (state ?? 'on').toLowerCase();
|
|
164
|
-
const enable = !(normalized === 'off' || normalized === '0' || normalized === 'false');
|
|
165
|
-
const result = await service.setAdmin(session, target, enable, options.reason);
|
|
166
|
-
service.logCommandResult('admin', result, session, { target, state: normalized });
|
|
167
|
-
const displayTarget = await service.formatTargetDisplay(session, result.plan?.targetId, target);
|
|
168
|
-
return formatAction(result, config, displayTarget);
|
|
169
|
-
});
|
|
15
|
+
|
|
16
|
+
function registerCommands(_ctx, _service, _config) {
|
|
17
|
+
// 无需注册任何 Koishi 指令,保留此导出以兼容既有调用方。
|
|
170
18
|
}
|
package/lib/index.d.ts
CHANGED
|
@@ -5,9 +5,6 @@ export declare const inject: {
|
|
|
5
5
|
};
|
|
6
6
|
export interface Config {
|
|
7
7
|
command: string;
|
|
8
|
-
menuCommand: string;
|
|
9
|
-
replaceHelpAsImageMenu: boolean;
|
|
10
|
-
replaceStatusAsImage: boolean;
|
|
11
8
|
platformFilter: string[];
|
|
12
9
|
responseStyle: 'plain' | 'meow';
|
|
13
10
|
dryRun: boolean;
|
|
@@ -52,6 +49,7 @@ export interface Config {
|
|
|
52
49
|
repeaterEnableGetMsgRefetch: boolean;
|
|
53
50
|
enableJoinRequestReview: boolean;
|
|
54
51
|
joinRequestReviewTtlMinutes: number;
|
|
52
|
+
pendingJoinFileName: string;
|
|
55
53
|
bannedWords: string[];
|
|
56
54
|
blockCardMessage: boolean;
|
|
57
55
|
blockForwardMessage: boolean;
|
package/lib/index.js
CHANGED
|
@@ -11,10 +11,15 @@ exports.inject = {
|
|
|
11
11
|
};
|
|
12
12
|
exports.Config = koishi_1.Schema.intersect([
|
|
13
13
|
koishi_1.Schema.object({
|
|
14
|
-
command: koishi_1.Schema.string().default('
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
command: koishi_1.Schema.string().default('[bot]').description('菜单指令:单独发送该前缀即返回命令菜单(菜单内容仅英文与数字)。'),
|
|
15
|
+
cmdMute: koishi_1.Schema.string().default('[mute]').description('禁言指令前缀,用法:[mute] qq|@某人 duration [reason]。时长必填,原因选填。'),
|
|
16
|
+
cmdUnmute: koishi_1.Schema.string().default('[unmute]').description('解除禁言指令前缀,用法:[unmute] qq|@某人 [reason]。'),
|
|
17
|
+
cmdKick: koishi_1.Schema.string().default('[kick]').description('踢人指令前缀,用法:[kick] qq|@某人 [reason]。'),
|
|
18
|
+
cmdMemory: koishi_1.Schema.string().default('[memory]').description('记忆指令前缀,用法:[memory] content 保存 / [memory] list 列出 / [memory] search keyword 查询 / [memory] delete keyword 删除。'),
|
|
19
|
+
cmdBan: koishi_1.Schema.string().default('[ban]').description('拉黑指令前缀,用法:[ban] qq|@某人 [reason]。'),
|
|
20
|
+
cmdUnban: koishi_1.Schema.string().default('[unban]').description('解除拉黑指令前缀,用法:[unban] qq|@某人 [reason]。'),
|
|
21
|
+
cmdBanList: koishi_1.Schema.string().default('[banlist]').description('黑名单查询指令前缀,单独发送即列出本群黑名单。'),
|
|
22
|
+
cmdCustom: koishi_1.Schema.string().default('[custom]').description('自定义指令集前缀,用法:[custom]。未配置自定义指令时提示「目前还没有指令」。'),
|
|
18
23
|
platformFilter: koishi_1.Schema.array(String).default(['onebot']).description('允许启用管理功能的平台列表。'),
|
|
19
24
|
responseStyle: koishi_1.Schema.union([
|
|
20
25
|
koishi_1.Schema.const('plain').description('普通输出'),
|
|
@@ -46,6 +51,7 @@ exports.Config = koishi_1.Schema.intersect([
|
|
|
46
51
|
autoKickThreshold: koishi_1.Schema.natural().description('该群触发自动踢人的违规次数(留空则跟随全局设置)。'),
|
|
47
52
|
autoViolationWindowMinutes: koishi_1.Schema.natural().description('该群违规计数统计窗口(分钟,留空则跟随全局设置)。'),
|
|
48
53
|
enableJoinRequestReview: koishi_1.Schema.boolean().description('该群是否启用入群审核(留空则跟随全局设置)。'),
|
|
54
|
+
blacklistEnabled: koishi_1.Schema.boolean().description('该群是否启用黑名单(留空则跟随全局 enableBlacklist;即使全局关闭,此处设为 true 也能单独启用)。'),
|
|
49
55
|
})).role('table').default([]).description('按群覆盖消息管控策略(未命中群号时使用全局默认)。'),
|
|
50
56
|
}).description('消息管控'),
|
|
51
57
|
koishi_1.Schema.object({
|
|
@@ -57,10 +63,17 @@ exports.Config = koishi_1.Schema.intersect([
|
|
|
57
63
|
autoViolationWindowMinutes: koishi_1.Schema.natural().default(60).description('违规计数统计窗口(分钟):窗口内连续违规才累计,超时未违规则重新计数。'),
|
|
58
64
|
}).description('自动管控'),
|
|
59
65
|
koishi_1.Schema.object({
|
|
60
|
-
enableMemory: koishi_1.Schema.boolean().default(true).description('启用记忆库:群内发送 [
|
|
66
|
+
enableMemory: koishi_1.Schema.boolean().default(true).description('启用记忆库:群内发送 [memory] 内容 保存到 Memory.md,[memory] search 关键词 查询、[memory] delete 关键词 删除,AI 回复可引用。'),
|
|
61
67
|
memoryFileName: koishi_1.Schema.string().default('Memory.md').description('记忆库文件名(保存在 Koishi 数据目录)。请直接使用控制台左侧「探索器 Explorer」打开该文件查看/编辑记忆库内容。'),
|
|
62
68
|
memoryInAi: koishi_1.Schema.boolean().default(true).description('AI 回复/识图时是否参考记忆库内容。'),
|
|
63
69
|
}).description('记忆库'),
|
|
70
|
+
koishi_1.Schema.object({
|
|
71
|
+
enableBlacklist: koishi_1.Schema.boolean().default(true).description('全局黑名单系统开关。单个群未单独设置时跟随此值;单个群设置后以该群为准(全局关着也能为某群单独开启)。'),
|
|
72
|
+
blacklistFileName: koishi_1.Schema.string().default('banMember.md').description('黑名单文件名(保存在 Koishi 数据目录,可用控制台左侧「探索器 Explorer」查看/编辑)。'),
|
|
73
|
+
banCommand: koishi_1.Schema.string().default('[ban]').description('(兼容字段)黑名单指令前缀,等同 cmdBan。'),
|
|
74
|
+
banKickOnJoin: koishi_1.Schema.boolean().default(true).description('有人入群时是否自动比对黑名单,命中则立即踢出并提示。'),
|
|
75
|
+
banRecordOnKick: koishi_1.Schema.boolean().default(true).description('发生踢人时(bot 踢人、群主/管理员踢人)是否自动把被踢者加入黑名单。'),
|
|
76
|
+
}).description('黑名单'),
|
|
64
77
|
koishi_1.Schema.object({
|
|
65
78
|
enableSelfGag: koishi_1.Schema.boolean().default(true).description('启用口球娱乐:普通成员对自己使用 mute/gag 时随机 1~60 分钟禁言。'),
|
|
66
79
|
enableUnauthorizedMutePunish: koishi_1.Schema.boolean().default(true).description('启用违规惩罚:普通成员反复尝试禁言他人时禁言本人。'),
|
|
@@ -76,10 +89,11 @@ exports.Config = koishi_1.Schema.intersect([
|
|
|
76
89
|
repeaterEnableGetMsgRefetch: koishi_1.Schema.boolean().default(true).description('复读图片缺少可发送引用时,是否通过 get_msg 回查原消息提取图片引用。'),
|
|
77
90
|
enableJoinRequestReview: koishi_1.Schema.boolean().default(true).description('收到新的入群申请时,自动在群内发起管理员审核。'),
|
|
78
91
|
joinRequestReviewTtlMinutes: koishi_1.Schema.natural().default(30).description('入群申请审核编号的有效期(分钟)。'),
|
|
92
|
+
pendingJoinFileName: koishi_1.Schema.string().default('JoinRequests.md').description('待审入群申请的落盘文件名(保存在 Koishi 数据目录)。插件会把待审单写入该文件,重启后自动恢复,超过有效期或已处理的会被清理。'),
|
|
79
93
|
}).description('群聊互动'),
|
|
80
94
|
koishi_1.Schema.object({
|
|
81
95
|
customCommands: koishi_1.Schema.array(koishi_1.Schema.object({
|
|
82
|
-
trigger: koishi_1.Schema.string().required().description('触发词,需用方括号包裹,如 [
|
|
96
|
+
trigger: koishi_1.Schema.string().required().description('触发词,需用方括号包裹,如 [hello]。只有整条消息与之完全相同(忽略首尾空白)才会触发。无任何自定义指令时,[custom] 会提示「目前还没有指令」。'),
|
|
83
97
|
replies: koishi_1.Schema.array(String).role('table').default([]).description('回复内容,可配置多条。每条支持 {user} 发送者昵称、{at} @发送者、{group} 群号。'),
|
|
84
98
|
enabled: koishi_1.Schema.boolean().default(true).description('是否启用该命令。'),
|
|
85
99
|
groups: koishi_1.Schema.array(String).role('table').default([]).description('限定生效的群号;留空表示所有群生效。'),
|
|
@@ -155,50 +169,9 @@ function apply(ctx, config) {
|
|
|
155
169
|
ctx.on('dispose', () => {
|
|
156
170
|
dispose();
|
|
157
171
|
});
|
|
172
|
+
// 卸载/重启时先把待审入群申请刷盘,避免内存单丢失
|
|
173
|
+
ctx.on('dispose', () => {
|
|
174
|
+
service.flushPendingJoinRequests();
|
|
175
|
+
});
|
|
158
176
|
(0, commands_1.registerCommands)(ctx, service, config);
|
|
159
|
-
if (config.replaceHelpAsImageMenu) {
|
|
160
|
-
let help;
|
|
161
|
-
try {
|
|
162
|
-
help = ctx.$commander.get('help');
|
|
163
|
-
}
|
|
164
|
-
catch {
|
|
165
|
-
help = null;
|
|
166
|
-
}
|
|
167
|
-
if (help) {
|
|
168
|
-
help.action(async (argv) => {
|
|
169
|
-
const keyword = typeof argv.args?.[0] === 'string' ? argv.args[0] : '';
|
|
170
|
-
if (!keyword)
|
|
171
|
-
service.armMenuPairing(argv.session, 30_000);
|
|
172
|
-
return service.renderMenu(keyword, argv.session);
|
|
173
|
-
}, true);
|
|
174
|
-
}
|
|
175
|
-
else {
|
|
176
|
-
ctx.command('help [keyword:text]', '查看图片菜单(由 qq-group-manager 提供)')
|
|
177
|
-
.action(async (argv, keyword) => {
|
|
178
|
-
if (!keyword)
|
|
179
|
-
service.armMenuPairing(argv.session, 30_000);
|
|
180
|
-
return service.renderMenu(keyword, argv.session);
|
|
181
|
-
});
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
if (config.replaceStatusAsImage) {
|
|
185
|
-
let status;
|
|
186
|
-
try {
|
|
187
|
-
status = ctx.$commander.get('status');
|
|
188
|
-
}
|
|
189
|
-
catch {
|
|
190
|
-
status = null;
|
|
191
|
-
}
|
|
192
|
-
if (status) {
|
|
193
|
-
status.action(async (argv) => {
|
|
194
|
-
return service.renderStatusCard(argv.session);
|
|
195
|
-
}, true);
|
|
196
|
-
}
|
|
197
|
-
else {
|
|
198
|
-
ctx.command('status', '查看系统状态(由 qq-group-manager 提供)')
|
|
199
|
-
.action(async (argv) => {
|
|
200
|
-
return service.renderStatusCard(argv.session);
|
|
201
|
-
});
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
177
|
}
|
package/lib/service.d.ts
CHANGED
|
@@ -11,7 +11,6 @@ export declare class QQGroupManagerService extends Service {
|
|
|
11
11
|
config: Config;
|
|
12
12
|
private _logger;
|
|
13
13
|
private unauthorizedMuteAttempts;
|
|
14
|
-
private menuPairings;
|
|
15
14
|
private aiBuffers;
|
|
16
15
|
private aiCounters;
|
|
17
16
|
private aiLastReplyAt;
|
|
@@ -28,11 +27,6 @@ export declare class QQGroupManagerService extends Service {
|
|
|
28
27
|
isPlatformAllowed(platform?: string): boolean;
|
|
29
28
|
private sessionTag;
|
|
30
29
|
private styleText;
|
|
31
|
-
private escapeHtml;
|
|
32
|
-
private collectCategories;
|
|
33
|
-
private resolveMenuCategory;
|
|
34
|
-
private pairingKey;
|
|
35
|
-
armMenuPairing(session?: Session, ttlMs?: number): void;
|
|
36
30
|
private getMessageText;
|
|
37
31
|
private aiGroupKey;
|
|
38
32
|
private resolveAiEnabled;
|
|
@@ -85,26 +79,12 @@ export declare class QQGroupManagerService extends Service {
|
|
|
85
79
|
private callOpenAiCompatibleWithImages;
|
|
86
80
|
private generateAiReply;
|
|
87
81
|
private maybeReplyWithAi;
|
|
88
|
-
private
|
|
89
|
-
private fetchOnlineClientsCount;
|
|
90
|
-
private formatRssKbToMb;
|
|
91
|
-
private fetchProcessUsageByHints;
|
|
92
|
-
private fetchDockerUsageByHints;
|
|
93
|
-
private fetchLlbotClientUsage;
|
|
94
|
-
private fetchQqClientUsage;
|
|
95
|
-
private handleMenuPairing;
|
|
96
|
-
private getPuppeteer;
|
|
97
|
-
private formatBytes;
|
|
98
|
-
private sampleCpuUsage;
|
|
99
|
-
renderStatusCard(session?: Session): Promise<string>;
|
|
100
|
-
private renderCategoryHtml;
|
|
101
|
-
renderMenu(keyword?: string, session?: Session): Promise<string>;
|
|
82
|
+
private isBotOwnerInGroup;
|
|
102
83
|
private logAuth;
|
|
103
84
|
logCommandResult(command: string, result: ActionResult, session?: Session, extra?: Record<string, unknown>): void;
|
|
104
85
|
authorizeCommand(command: string, session?: Session): Promise<AuthorizationResult>;
|
|
105
86
|
authorize(session?: Session): Promise<AuthorizationResult>;
|
|
106
87
|
canUseAdminCommand(session?: Session): Promise<AuthorizationResult>;
|
|
107
|
-
private isBotOwnerInGroup;
|
|
108
88
|
private resolveMemberRole;
|
|
109
89
|
private normalizeRole;
|
|
110
90
|
private parseTargetId;
|
|
@@ -152,6 +132,12 @@ export declare class QQGroupManagerService extends Service {
|
|
|
152
132
|
private clearViolationRecord;
|
|
153
133
|
private autoModerationPunish;
|
|
154
134
|
private handleGroupModeration;
|
|
135
|
+
private getPendingJoinFilePath;
|
|
136
|
+
private buildPendingJoinFileContent;
|
|
137
|
+
persistPendingJoinRequestsNow(): Promise<void>;
|
|
138
|
+
private schedulePendingJoinPersist;
|
|
139
|
+
flushPendingJoinRequests(): void;
|
|
140
|
+
loadPendingJoinRequests(): void;
|
|
155
141
|
private cleanupPendingJoinRequests;
|
|
156
142
|
private generateJoinRequestCode;
|
|
157
143
|
private parseJoinRequestReviewText;
|