@lih-x-x/kmr 1.0.61 → 1.0.62
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.
|
@@ -47,6 +47,15 @@ var UserResolver = class {
|
|
|
47
47
|
console.error(`[user-resolver] \u52A0\u8F7D\u7FA4\u6210\u5458\u5931\u8D25:`, err.message);
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
|
+
/**
|
|
51
|
+
* 根据 open_id 反查姓名
|
|
52
|
+
*/
|
|
53
|
+
resolveName(openId) {
|
|
54
|
+
for (const [name, id] of this.nameMap) {
|
|
55
|
+
if (id === openId) return name;
|
|
56
|
+
}
|
|
57
|
+
return void 0;
|
|
58
|
+
}
|
|
50
59
|
/**
|
|
51
60
|
* 获取当前所有已缓存的映射
|
|
52
61
|
*/
|
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.
|
|
9
|
+
if (data.version && data.version !== "1.0.62") {
|
|
10
10
|
console.log(`
|
|
11
|
-
\u2B06\uFE0F \u65B0\u7248\u672C\u53EF\u7528: ${"1.0.
|
|
11
|
+
\u2B06\uFE0F \u65B0\u7248\u672C\u53EF\u7528: ${"1.0.62"} \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.
|
|
59
|
+
console.log("1.0.62");
|
|
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-
|
|
166
|
+
const { UserResolver } = await import("./userResolver-SDRJIVT2.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-
|
|
31
|
+
} from "./chunk-23UVH7BV.js";
|
|
32
32
|
|
|
33
33
|
// src/index.ts
|
|
34
34
|
import fs3 from "fs";
|
|
@@ -634,7 +634,8 @@ var SessionManager = class {
|
|
|
634
634
|
const sessionName = await this.ensureSession(userId);
|
|
635
635
|
let fullText = text;
|
|
636
636
|
if (context) {
|
|
637
|
-
const
|
|
637
|
+
const senderHint = context.senderName ? `\u53D1\u9001\u8005\uFF1A${context.senderName}\uFF08open_id: ${userId}\uFF09` : `\u53D1\u9001\u8005 open_id: ${userId}`;
|
|
638
|
+
const env = context.isGroup ? `\u3010\u5F53\u524D\u73AF\u5883\uFF1A\u7FA4\u804A\u3002${senderHint}\u3002\u4F60\u7684\u56DE\u590D\u4F1A\u53D1\u9001\u5230\u7FA4\u91CC\uFF0C\u5982\u679C\u9700\u8981\u6307\u5B9A\u5BF9\u8C61\u5BF9\u8BDD\uFF0C\u53EF\u4EE5\u76F4\u63A5\u7528 @\u59D3\u540D \u6765\u63D0\u9192\u7FA4\u5185\u6210\u5458\u3002\u3011` : `\u3010\u5F53\u524D\u73AF\u5883\uFF1A\u79C1\u804A\u3002${senderHint}\u3002\u65E0\u6CD5\u76F4\u63A5 @\u4ED6\u4EBA\uFF0C\u5982\u9700\u901A\u77E5\u4ED6\u4EBA\u8BF7\u62DF\u5236\u6D88\u606F\u5185\u5BB9\u8BA9\u7528\u6237\u8F6C\u53D1\u3002\u3011`;
|
|
638
639
|
fullText = `${env}
|
|
639
640
|
${text}`;
|
|
640
641
|
}
|
|
@@ -1059,7 +1060,8 @@ async function main() {
|
|
|
1059
1060
|
}
|
|
1060
1061
|
console.log(`[process] \u81EA\u7531\u5BF9\u8BDD, userId=${senderId}`);
|
|
1061
1062
|
const reactionId = await messenger.addReaction(messageId, "OnIt");
|
|
1062
|
-
const
|
|
1063
|
+
const senderName = userResolver.resolveName(senderId);
|
|
1064
|
+
const reply = await sessionManager.handleMessage(senderId, text, { isGroup: meta.isGroup, senderName });
|
|
1063
1065
|
await messenger.removeReaction(messageId, reactionId);
|
|
1064
1066
|
await messenger.replyText(messageId, reply);
|
|
1065
1067
|
break;
|