@lih-x-x/kmr 1.0.62 → 1.0.63

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.
@@ -56,6 +56,26 @@ var UserResolver = class {
56
56
  }
57
57
  return void 0;
58
58
  }
59
+ /**
60
+ * 根据 open_id 反查姓名,缓存中没有则调飞书接口查询
61
+ */
62
+ async resolveNameById(openId) {
63
+ const cached = this.resolveName(openId);
64
+ if (cached) return cached;
65
+ try {
66
+ const res = await this.client.contact.user.get({
67
+ path: { user_id: openId },
68
+ params: { user_id_type: "open_id" }
69
+ });
70
+ const name = res.data?.user?.name;
71
+ if (name) {
72
+ this.nameMap.set(name, openId);
73
+ return name;
74
+ }
75
+ } catch {
76
+ }
77
+ return void 0;
78
+ }
59
79
  /**
60
80
  * 获取当前所有已缓存的映射
61
81
  */
package/dist/cli.js CHANGED
@@ -6,9 +6,9 @@ async function checkUpdate() {
6
6
  try {
7
7
  const res = await fetch(`https://registry.npmjs.org/${"@lih-x-x/kmr"}/latest`, { signal: AbortSignal.timeout(3e3) });
8
8
  const data = await res.json();
9
- if (data.version && data.version !== "1.0.62") {
9
+ if (data.version && data.version !== "1.0.63") {
10
10
  console.log(`
11
- \u2B06\uFE0F \u65B0\u7248\u672C\u53EF\u7528: ${"1.0.62"} \u2192 ${data.version}`);
11
+ \u2B06\uFE0F \u65B0\u7248\u672C\u53EF\u7528: ${"1.0.63"} \u2192 ${data.version}`);
12
12
  console.log(` \u8FD0\u884C npm install -g ${"@lih-x-x/kmr"} \u66F4\u65B0
13
13
  `);
14
14
  }
@@ -56,7 +56,7 @@ KMR\uFF08Key Meetings Record\uFF09\u2014 \u4F1A\u8BAE\u6316\u6398\u673A
56
56
  kmr --help \u663E\u793A\u5E2E\u52A9
57
57
  `);
58
58
  } else if (command === "--version" || command === "-v") {
59
- console.log("1.0.62");
59
+ console.log("1.0.63");
60
60
  } else if (command === "list") {
61
61
  const { loadConfig } = await import("./config-WIQGW5OC.js");
62
62
  const { JsonStore } = await import("./jsonStore-AL73KEUG.js");
@@ -163,7 +163,7 @@ KMR\uFF08Key Meetings Record\uFF09\u2014 \u4F1A\u8BAE\u6316\u6398\u673A
163
163
  const { loadConfig } = await import("./config-WIQGW5OC.js");
164
164
  const { createLarkClient } = await import("./client-DFBBDD77.js");
165
165
  const { TaskCreator } = await import("./taskCreator-TCI3VB5D.js");
166
- const { UserResolver } = await import("./userResolver-SDRJIVT2.js");
166
+ const { UserResolver } = await import("./userResolver-F76R3ZMT.js");
167
167
  const { JsonStore } = await import("./jsonStore-AL73KEUG.js");
168
168
  const config = loadConfig();
169
169
  const client = createLarkClient(config);
package/dist/index.js CHANGED
@@ -28,7 +28,7 @@ import {
28
28
  } from "./chunk-XQVLJTP4.js";
29
29
  import {
30
30
  UserResolver
31
- } from "./chunk-23UVH7BV.js";
31
+ } from "./chunk-GRHQV2FL.js";
32
32
 
33
33
  // src/index.ts
34
34
  import fs3 from "fs";
@@ -875,6 +875,8 @@ async function main() {
875
875
  const dispatcher = createEventDispatcher(botOpenId, async (messageId, text, chatId, senderId, meta) => {
876
876
  const parsed = parseMessage(text);
877
877
  console.log(`[message] \u6536\u5230\u6D88\u606F: "${text}" (chatId=${chatId}, senderId=${senderId})`);
878
+ userResolver.loadChatMembers(chatId).catch(() => {
879
+ });
878
880
  if (meta.isGroup && !meta.isMentioned && parsed.type === "document_link" /* DOCUMENT_LINK */) {
879
881
  const title = await docReader.getDocumentTitle(parsed.documentId);
880
882
  const isMeetingNote = /纪要|会议记录|meeting/i.test(title) || /from=vc_assistant/.test(text);
@@ -1060,7 +1062,7 @@ async function main() {
1060
1062
  }
1061
1063
  console.log(`[process] \u81EA\u7531\u5BF9\u8BDD, userId=${senderId}`);
1062
1064
  const reactionId = await messenger.addReaction(messageId, "OnIt");
1063
- const senderName = userResolver.resolveName(senderId);
1065
+ const senderName = await userResolver.resolveNameById(senderId);
1064
1066
  const reply = await sessionManager.handleMessage(senderId, text, { isGroup: meta.isGroup, senderName });
1065
1067
  await messenger.removeReaction(messageId, reactionId);
1066
1068
  await messenger.replyText(messageId, reply);
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  UserResolver
3
- } from "./chunk-23UVH7BV.js";
3
+ } from "./chunk-GRHQV2FL.js";
4
4
  export {
5
5
  UserResolver
6
6
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lih-x-x/kmr",
3
- "version": "1.0.62",
3
+ "version": "1.0.63",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {