koishi-plugin-group-analysis-mx 1.7.1 → 1.7.3

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.
@@ -912,12 +912,18 @@ class AnalysisService extends koishi_1.Service {
912
912
  }
913
913
  const resolveTopicName = (raw) => {
914
914
  const sVal = String(raw || '').trim();
915
- // 形如 "昵称(openid)":只取昵称部分
916
- const m = sVal.match(/^(.+?)\s*[((]([0-9A-Fa-f]{16,})[))]\s*$/);
915
+ // 形如 "昵称 ([openid])" / "昵称(openid)":取昵称(昵称本身是 openid 时回填)
916
+ const m = sVal.match(/^(.*?)\s*[((]\s*\[?\s*([0-9A-Fa-f]{16,})\s*\]?\s*[))]\s*$/);
917
917
  if (m) {
918
918
  const nick = m[1].trim();
919
- return nick || topicIdToName.get(m[2]) || '群友';
919
+ if (nick && !/^[0-9A-Fa-f]{16,}$/.test(nick))
920
+ return nick;
921
+ return topicIdToName.get(m[2]) || '群友';
920
922
  }
923
+ // 纯 [openid] / openid
924
+ const only = sVal.replace(/^[\[((]+|[\]))]+$/g, '').trim();
925
+ if (/^[0-9A-Fa-f]{16,}$/.test(only))
926
+ return topicIdToName.get(only) || '群友';
921
927
  const cleaned = sVal.replace(/[\[\]()()]/g, '').trim();
922
928
  if (topicIdToName.has(cleaned))
923
929
  return topicIdToName.get(cleaned);
@@ -954,8 +960,9 @@ class AnalysisService extends koishi_1.Service {
954
960
  if (realName)
955
961
  title.name = realName;
956
962
  }
957
- if (title && !title.avatar && avatarMap.has(String(title.id))) {
958
- title.avatar = avatarMap.get(String(title.id));
963
+ if (title && !title.avatar) {
964
+ const tn = (0, utils_1.normalizeNickname)(title.name);
965
+ title.avatar = nicknameAvatarMap.get(title.name) || (tn ? nicknameAvatarMap.get(tn) : '') || avatarMap.get(String(title.id)) || '';
959
966
  }
960
967
  });
961
968
  }
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.7.1",
4
+ "version": "1.7.3",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/index.mjs",
7
7
  "typings": "lib/index.d.ts",
@@ -58,3 +58,5 @@
58
58
 
59
59
 
60
60
 
61
+
62
+