@nestim/koishi-plugin-qq-group-manager 0.1.15 → 0.1.16
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 +2 -1
- package/lib/service.js +36 -0
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -75,7 +75,8 @@ exports.Config = koishi_1.Schema.intersect([
|
|
|
75
75
|
banRecordOnKick: koishi_1.Schema.boolean().default(true).description('有人被移出群聊时是否自动把被踢者加入黑名单。只处理明确判定为「被踢」的事件(subtype=passive/kick),主动退群(leave/quit)与 subtype 缺失一律不记录;bot 自己永不记入。设为 false 则关闭该自动拉黑,只保留手动 [ban]。'),
|
|
76
76
|
}).description('黑名单'),
|
|
77
77
|
koishi_1.Schema.object({
|
|
78
|
-
eyeSelfId: koishi_1.Schema.string().default('').description('耳目号(小号)的 QQ。填写后,本插件会接收 nestim-eye 上报的「拉人事件 + QQ
|
|
78
|
+
eyeSelfId: koishi_1.Schema.string().default('').description('耳目号(小号)的 QQ。填写后,本插件会接收 nestim-eye 上报的「拉人事件 + QQ 号」,并由**主号直接执行处罚**。'),
|
|
79
|
+
eyeNotifyGuildId: koishi_1.Schema.string().default('').description('执法台账发送到哪个群(填群号,用主号发送)。每次处罚后发一条简短记录;耳目号自身全程不发言。留空 = 不发台账。'),
|
|
79
80
|
eyePunishGroups: koishi_1.Schema.array(String).role('table').default([]).description('耳目上报后,对拉人者执行「拉黑 + 踢人」的群号列表(主号必须在这些群里有管理员/群主权限才能踢人;无权限时仍会拉黑)。留空 = 不执行处罚,只写日志。'),
|
|
80
81
|
eyePunishCooldownMinutes: koishi_1.Schema.natural().default(10).description('同一个人被处罚的冷却时间(分钟),避免重复踢同一个人。'),
|
|
81
82
|
}).description('耳目联动'),
|
package/lib/service.js
CHANGED
|
@@ -345,6 +345,42 @@ class QQGroupManagerService extends koishi_1.Service {
|
|
|
345
345
|
}
|
|
346
346
|
this._eyePunishAt.set(qq, Date.now());
|
|
347
347
|
this._logger.info(`[eye] 已处罚 qq=${qq} 原因=${punReason} 来源=${kind} 拉黑=[${banned.join(',')}] 踢出=[${kicked.join(',')}] 失败=[${failed.join('; ')}] 证据="${evidence}"`);
|
|
348
|
+
// 执法台账:处罚后往指定群发一条简短记录(耳目号依旧不发言,这条由主号发出)
|
|
349
|
+
await this.sendEyeLedger({ qq, kind, evidence, banned, kicked, failed, reason: punReason });
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* 发一条「执法台账」到 eyeNotifyGuildId 指定的群。
|
|
353
|
+
* 仅由主号发出;耳目号全程静默。发送失败只记日志,不影响处罚结果。
|
|
354
|
+
*/
|
|
355
|
+
async sendEyeLedger(info) {
|
|
356
|
+
const target = String(this.config.eyeNotifyGuildId || '').replace(/\D/g, '');
|
|
357
|
+
if (!target)
|
|
358
|
+
return false;
|
|
359
|
+
const bot = this.resolveMainBot();
|
|
360
|
+
if (!bot || typeof bot.sendMessage !== 'function')
|
|
361
|
+
return false;
|
|
362
|
+
const lines = [
|
|
363
|
+
'【耳目执法】',
|
|
364
|
+
`对象:${info.qq}`,
|
|
365
|
+
`原因:${info.reason}`,
|
|
366
|
+
`触发:${info.kind === 'private' ? '私聊小号拉人' : '小号被拉进新群'}`,
|
|
367
|
+
];
|
|
368
|
+
if (info.evidence)
|
|
369
|
+
lines.push(`证据:${info.evidence}`);
|
|
370
|
+
lines.push(`拉黑:${info.banned.length ? info.banned.join(',') : '无'}`);
|
|
371
|
+
lines.push(`踢出:${info.kicked.length ? info.kicked.join(',') : '无'}`);
|
|
372
|
+
if (info.failed.length)
|
|
373
|
+
lines.push(`未完成:${info.failed.join('; ')}`);
|
|
374
|
+
lines.push(`时间:${new Date().toLocaleString('zh-CN', { hour12: false })}`);
|
|
375
|
+
try {
|
|
376
|
+
await bot.sendMessage(target, lines.join('\n'));
|
|
377
|
+
this._logger.info(`[eye] 执法台账已发到群 ${target}`);
|
|
378
|
+
return true;
|
|
379
|
+
}
|
|
380
|
+
catch (error) {
|
|
381
|
+
this._logger.warn(`[eye] 执法台账发送失败: ${String(error)}`);
|
|
382
|
+
return false;
|
|
383
|
+
}
|
|
348
384
|
}
|
|
349
385
|
isPlatformAllowed(platform) {
|
|
350
386
|
if (!platform)
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nestim/koishi-plugin-qq-group-manager",
|
|
3
3
|
"description": "Koishi QQ群管理插件(OneBot/LLOneBot):群管命令、权限校验、文本菜单、复读、AI群聊回复、记忆库、识图与自动管控(禁言/踢人)。",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.16",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
7
7
|
"files": [
|