koishi-plugin-group-analysis-mx 1.8.1 → 1.8.2
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/config.js +1 -1
- package/lib/plugins/command.js +0 -6
- package/lib/service/message.js +11 -9
- package/package.json +2 -1
package/lib/config.js
CHANGED
|
@@ -214,7 +214,7 @@ exports.Config = koishi_1.Schema.intersect([
|
|
|
214
214
|
.default([]),
|
|
215
215
|
personaBlacklist: koishi_1.Schema.array(String)
|
|
216
216
|
.role('table')
|
|
217
|
-
.description('
|
|
217
|
+
.description('用户画像黑名单。只影响用户画像(不采集、不分析、不可查询),不影响群分析的统计与报告。')
|
|
218
218
|
.default([])
|
|
219
219
|
}).description('用户画像设置'),
|
|
220
220
|
koishi_1.Schema.object({
|
package/lib/plugins/command.js
CHANGED
|
@@ -36,9 +36,6 @@ function apply(ctx, config) {
|
|
|
36
36
|
authority: 3
|
|
37
37
|
})
|
|
38
38
|
.action(async ({ session, options }, query) => {
|
|
39
|
-
if (config.personaBlacklist.includes(session.userId)) {
|
|
40
|
-
return '您无权使用本插件。';
|
|
41
|
-
}
|
|
42
39
|
if (session.isDirect && !options.group && !options.channel) {
|
|
43
40
|
return '私聊中请使用 -g 或 -c 指定目标群或频道。';
|
|
44
41
|
}
|
|
@@ -220,9 +217,6 @@ function apply(ctx, config) {
|
|
|
220
217
|
authority: 3
|
|
221
218
|
})
|
|
222
219
|
.action(async ({ session, options }, days) => {
|
|
223
|
-
if (config.personaBlacklist.includes(session.userId)) {
|
|
224
|
-
return '您无权使用本插件。';
|
|
225
|
-
}
|
|
226
220
|
if (session.isDirect && !options.group && !options.channel) {
|
|
227
221
|
return '私聊中请使用 -g 或 -c 指定目标群或频道。';
|
|
228
222
|
}
|
package/lib/service/message.js
CHANGED
|
@@ -65,10 +65,7 @@ class MessageService extends koishi_1.Service {
|
|
|
65
65
|
return result;
|
|
66
66
|
}
|
|
67
67
|
async handleMessage(session) {
|
|
68
|
-
//
|
|
69
|
-
if (this.config.personaBlacklist?.includes(session.userId)) {
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
68
|
+
// 黑名单只限制用户画像(见 handleIncomingMessageForPersona),消息本身仍需入库供群分析统计
|
|
72
69
|
// 清洗掉官方 bot 的原始表情/协议标签,只保留正常文字
|
|
73
70
|
const cleanContent = (0, utils_1.cleanContent)(session.content);
|
|
74
71
|
// 腾讯官方 bot 的签名等非聊天垃圾内容,不记录
|
|
@@ -211,8 +208,8 @@ class MessageService extends koishi_1.Service {
|
|
|
211
208
|
// Filter out users in personaUserFilter for user persona
|
|
212
209
|
purposeFilter = !this.config.personaUserFilter.includes(msg.userId);
|
|
213
210
|
}
|
|
214
|
-
//
|
|
215
|
-
if (this.config.personaBlacklist?.includes(msg.userId)) {
|
|
211
|
+
// 黑名单仅作用于用户画像,不影响群分析统计
|
|
212
|
+
if (filter.purpose === 'user-persona' && this.config.personaBlacklist?.includes(msg.userId)) {
|
|
216
213
|
purposeFilter = false;
|
|
217
214
|
}
|
|
218
215
|
return (withinTimeRange &&
|
|
@@ -346,8 +343,8 @@ class MessageService extends koishi_1.Service {
|
|
|
346
343
|
purposeFilter =
|
|
347
344
|
!this.config.personaUserFilter.includes(userId);
|
|
348
345
|
}
|
|
349
|
-
//
|
|
350
|
-
if (this.config.personaBlacklist?.includes(userId)) {
|
|
346
|
+
// 黑名单仅作用于用户画像,不影响群分析统计
|
|
347
|
+
if (filter.purpose === 'user-persona' && this.config.personaBlacklist?.includes(userId)) {
|
|
351
348
|
purposeFilter = false;
|
|
352
349
|
}
|
|
353
350
|
return (withinTimeRange &&
|
|
@@ -412,7 +409,12 @@ class MessageService extends koishi_1.Service {
|
|
|
412
409
|
query.timestamp.$lte = filter.endTime;
|
|
413
410
|
}
|
|
414
411
|
// 用户条件:显式指定的用户 ∩ 排除名单。所有排除项合并,而不是互相覆盖。
|
|
415
|
-
|
|
412
|
+
// 黑名单只影响用户画像,群分析不排除这些用户
|
|
413
|
+
const excluded = new Set();
|
|
414
|
+
if (filter.purpose === 'user-persona') {
|
|
415
|
+
for (const id of (this.config.personaBlacklist || []))
|
|
416
|
+
excluded.add(String(id));
|
|
417
|
+
}
|
|
416
418
|
if (filter.purpose === 'group-analysis') {
|
|
417
419
|
for (const id of (this.config.userFilter || []))
|
|
418
420
|
excluded.add(String(id));
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "koishi-plugin-group-analysis-mx",
|
|
3
3
|
"description": "群聊分析插件 - 生成精美群聊统计报告,支持 AI 话题总结(独立版,不依赖 ChatLuna)",
|
|
4
|
-
"version": "1.8.
|
|
4
|
+
"version": "1.8.2",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib/index.mjs",
|
|
7
7
|
"typings": "lib/index.d.ts",
|
|
@@ -66,3 +66,4 @@
|
|
|
66
66
|
|
|
67
67
|
|
|
68
68
|
|
|
69
|
+
|