fix(feishu): handle card.action.trigger callbacks (openclaw#17863)

Co-authored-by: Kai <clawborn@users.noreply.github.com>
This commit is contained in:
Clawborn
2026-02-28 13:24:11 +08:00
committed by GitHub
parent 60bf56517f
commit 49cf2bceb6
3 changed files with 162 additions and 0 deletions

View File

@@ -9,6 +9,7 @@ import {
} from "openclaw/plugin-sdk";
import { resolveFeishuAccount, listEnabledFeishuAccounts } from "./accounts.js";
import { handleFeishuMessage, type FeishuMessageEvent, type FeishuBotAddedEvent } from "./bot.js";
import { handleFeishuCardAction, type FeishuCardActionEvent } from "./card-action.js";
import { createFeishuWSClient, createEventDispatcher } from "./client.js";
import { probeFeishu } from "./probe.js";
import { getMessageFeishu } from "./send.js";
@@ -350,6 +351,27 @@ function registerEventHandlers(
"im.message.reaction.deleted_v1": async () => {
// Ignore reaction removals
},
"card.action.trigger": async (data) => {
try {
const event = data as unknown as FeishuCardActionEvent;
const promise = handleFeishuCardAction({
cfg,
event,
botOpenId: botOpenIds.get(accountId),
runtime,
accountId,
});
if (fireAndForget) {
promise.catch((err) => {
error(`feishu[${accountId}]: error handling card action: ${String(err)}`);
});
} else {
await promise;
}
} catch (err) {
error(`feishu[${accountId}]: error handling card action: ${String(err)}`);
}
},
});
}