@superbenxxxh/feishu 2.0.0 → 2.0.1
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/package.json +1 -1
- package/src/bot.ts +35 -21
package/package.json
CHANGED
package/src/bot.ts
CHANGED
|
@@ -428,27 +428,41 @@ export async function handleFeishuMessage(params: {
|
|
|
428
428
|
feishuCfg?.historyLimit ?? cfg.messages?.groupChat?.historyLimit ?? DEFAULT_GROUP_HISTORY_LIMIT,
|
|
429
429
|
);
|
|
430
430
|
|
|
431
|
-
if (isGroup) {
|
|
432
|
-
const groupPolicy = feishuCfg?.groupPolicy ?? "open";
|
|
433
|
-
const groupAllowFrom = feishuCfg?.groupAllowFrom ?? [];
|
|
434
|
-
const groupConfig = resolveFeishuGroupConfig({ cfg: feishuCfg, groupId: ctx.chatId });
|
|
435
|
-
|
|
436
|
-
const
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
431
|
+
if (isGroup) {
|
|
432
|
+
const groupPolicy = feishuCfg?.groupPolicy ?? "open";
|
|
433
|
+
const groupAllowFrom = feishuCfg?.groupAllowFrom ?? [];
|
|
434
|
+
const groupConfig = resolveFeishuGroupConfig({ cfg: feishuCfg, groupId: ctx.chatId });
|
|
435
|
+
|
|
436
|
+
const groupAllowed = isFeishuGroupAllowed({
|
|
437
|
+
groupPolicy,
|
|
438
|
+
allowFrom: groupAllowFrom,
|
|
439
|
+
senderId: ctx.chatId,
|
|
440
|
+
senderName: undefined,
|
|
441
|
+
});
|
|
442
|
+
|
|
443
|
+
if (!groupAllowed) {
|
|
444
|
+
log(`feishu: group ${ctx.chatId} not in allowlist`);
|
|
445
|
+
return;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
const senderAllowFrom = groupConfig?.allowFrom ?? [];
|
|
449
|
+
if (senderAllowFrom.length > 0) {
|
|
450
|
+
const senderAllowed = isFeishuGroupAllowed({
|
|
451
|
+
groupPolicy: "allowlist",
|
|
452
|
+
allowFrom: senderAllowFrom,
|
|
453
|
+
senderId: ctx.senderOpenId,
|
|
454
|
+
senderName: ctx.senderName,
|
|
455
|
+
});
|
|
456
|
+
|
|
457
|
+
if (!senderAllowed) {
|
|
458
|
+
log(`feishu: sender ${ctx.senderOpenId} not in group ${ctx.chatId} allowlist`);
|
|
459
|
+
return;
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
const { requireMention } = resolveFeishuReplyPolicy({
|
|
464
|
+
isDirectMessage: false,
|
|
465
|
+
globalConfig: feishuCfg,
|
|
452
466
|
groupConfig,
|
|
453
467
|
});
|
|
454
468
|
|