@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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/bot.ts +35 -21
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superbenxxxh/feishu",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "type": "module",
5
5
  "description": "OpenClaw Feishu/Lark channel plugin",
6
6
  "license": "MIT",
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 senderAllowFrom = groupConfig?.allowFrom ?? groupAllowFrom;
437
- const allowed = isFeishuGroupAllowed({
438
- groupPolicy,
439
- allowFrom: senderAllowFrom,
440
- senderId: ctx.senderOpenId,
441
- senderName: ctx.senderName,
442
- });
443
-
444
- if (!allowed) {
445
- log(`feishu: sender ${ctx.senderOpenId} not in group allowlist`);
446
- return;
447
- }
448
-
449
- const { requireMention } = resolveFeishuReplyPolicy({
450
- isDirectMessage: false,
451
- globalConfig: feishuCfg,
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