@nextclaw/channel-runtime 0.1.27 → 0.1.29
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/dist/index.js +21 -6
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1273,6 +1273,9 @@ var MSG_TYPE_MAP = {
|
|
|
1273
1273
|
sticker: "[sticker]"
|
|
1274
1274
|
};
|
|
1275
1275
|
var TABLE_RE = /((?:^[ \t]*\|.+\|[ \t]*\n)(?:^[ \t]*\|[-:\s|]+\|[ \t]*\n)(?:^[ \t]*\|.+\|[ \t]*\n?)+)/gm;
|
|
1276
|
+
function isRecord(value) {
|
|
1277
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
1278
|
+
}
|
|
1276
1279
|
var FeishuChannel = class extends BaseChannel {
|
|
1277
1280
|
name = "feishu";
|
|
1278
1281
|
client = null;
|
|
@@ -1331,16 +1334,21 @@ var FeishuChannel = class extends BaseChannel {
|
|
|
1331
1334
|
});
|
|
1332
1335
|
}
|
|
1333
1336
|
async handleIncoming(data) {
|
|
1334
|
-
const
|
|
1335
|
-
const
|
|
1337
|
+
const root = isRecord(data.event) ? data.event : data;
|
|
1338
|
+
const message = root.message ?? data.message ?? {};
|
|
1339
|
+
const sender = root.sender ?? message.sender ?? data.sender ?? {};
|
|
1336
1340
|
const senderIdObj = sender.sender_id ?? {};
|
|
1337
|
-
const
|
|
1341
|
+
const senderOpenId = senderIdObj.open_id || sender.open_id || "";
|
|
1342
|
+
const senderUserId = senderIdObj.user_id || sender.user_id || "";
|
|
1343
|
+
const senderUnionId = senderIdObj.union_id || sender.union_id || "";
|
|
1344
|
+
const senderId = senderOpenId || senderUserId || senderUnionId || "";
|
|
1338
1345
|
const senderType = sender.sender_type ?? sender.senderType;
|
|
1339
1346
|
if (senderType === "bot") {
|
|
1340
1347
|
return;
|
|
1341
1348
|
}
|
|
1342
1349
|
const chatId = message.chat_id ?? "";
|
|
1343
1350
|
const chatType = message.chat_type ?? "";
|
|
1351
|
+
const isGroup = chatType === "group";
|
|
1344
1352
|
const msgType = message.msg_type ?? message.message_type ?? "";
|
|
1345
1353
|
const messageId = message.message_id ?? "";
|
|
1346
1354
|
if (!senderId || !chatId) {
|
|
@@ -1370,16 +1378,23 @@ var FeishuChannel = class extends BaseChannel {
|
|
|
1370
1378
|
if (!content) {
|
|
1371
1379
|
return;
|
|
1372
1380
|
}
|
|
1373
|
-
const replyTo = chatType === "group" ? chatId : String(senderId);
|
|
1374
1381
|
await this.handleMessage({
|
|
1375
1382
|
senderId: String(senderId),
|
|
1376
|
-
|
|
1383
|
+
// Always route by Feishu chat_id so DM/group sessions are stable.
|
|
1384
|
+
chatId,
|
|
1377
1385
|
content,
|
|
1378
1386
|
attachments: [],
|
|
1379
1387
|
metadata: {
|
|
1380
1388
|
message_id: messageId,
|
|
1389
|
+
chat_id: chatId,
|
|
1381
1390
|
chat_type: chatType,
|
|
1382
|
-
msg_type: msgType
|
|
1391
|
+
msg_type: msgType,
|
|
1392
|
+
is_group: isGroup,
|
|
1393
|
+
peer_kind: isGroup ? "group" : "direct",
|
|
1394
|
+
peer_id: chatId,
|
|
1395
|
+
sender_open_id: senderOpenId || void 0,
|
|
1396
|
+
sender_user_id: senderUserId || void 0,
|
|
1397
|
+
sender_union_id: senderUnionId || void 0
|
|
1383
1398
|
}
|
|
1384
1399
|
});
|
|
1385
1400
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nextclaw/channel-runtime",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.29",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Runtime implementations for NextClaw builtin channel plugins.",
|
|
6
6
|
"type": "module",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
],
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@larksuiteoapi/node-sdk": "^1.58.0",
|
|
18
|
-
"@nextclaw/core": "^0.
|
|
18
|
+
"@nextclaw/core": "^0.7.0",
|
|
19
19
|
"@slack/socket-mode": "^1.3.3",
|
|
20
20
|
"@slack/web-api": "^7.6.0",
|
|
21
21
|
"dingtalk-stream": "^2.1.4",
|