Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 25 additions & 6 deletions src/messaging/outbound/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import type {
OpenClawConfig,
} from 'openclaw/plugin-sdk';
import type { ChannelMessageToolSchemaContribution, ChannelThreadingToolContext } from 'openclaw/plugin-sdk/channel-contract';
import { resolveReactionMessageId } from 'openclaw/plugin-sdk/channel-actions';
import { extractToolSend } from 'openclaw/plugin-sdk/tool-send';
import { readStringParam } from 'openclaw/plugin-sdk/param-readers';
import { Type } from '@sinclair/typebox';
Expand Down Expand Up @@ -201,9 +202,9 @@ export const feishuMessageActions: ChannelMessageActionAdapter = {
case 'send':
return await deliverMessage(cfg, readFeishuSendParams(params, toolContext), aid, ctx.mediaLocalRoots);
case 'react':
return await handleReact(cfg, params, aid);
return await handleReact(cfg, params, aid, toolContext);
case 'reactions':
return await handleReactions(cfg, params, aid);
return await handleReactions(cfg, params, aid, toolContext);
case 'delete':
case 'unsend':
return await handleDelete(cfg, params, aid);
Expand Down Expand Up @@ -335,8 +336,17 @@ async function deliverMedia(
// Reaction handlers
// ---------------------------------------------------------------------------

async function handleReact(cfg: OpenClawConfig, params: Record<string, unknown>, accountId?: string) {
const messageId = readStringParam(params, 'messageId', { required: true });
async function handleReact(
cfg: OpenClawConfig,
params: Record<string, unknown>,
accountId?: string,
toolContext?: ChannelThreadingToolContext,
) {
const resolvedMessageId = resolveReactionMessageId({ args: params, toolContext });
if (resolvedMessageId == null) {
throw new Error('messageId required. Provide messageId explicitly or react to the current inbound message.');
}
const messageId = String(resolvedMessageId);
const { emoji, remove, isEmpty } = readReactionParams(params, {
removeErrorMessage: 'Emoji is required to remove a Feishu reaction.',
});
Expand Down Expand Up @@ -373,8 +383,17 @@ async function handleReact(cfg: OpenClawConfig, params: Record<string, unknown>,
return jsonResult({ ok: true, reactionId });
}

async function handleReactions(cfg: OpenClawConfig, params: Record<string, unknown>, accountId?: string) {
const messageId = readStringParam(params, 'messageId', { required: true });
async function handleReactions(
cfg: OpenClawConfig,
params: Record<string, unknown>,
accountId?: string,
toolContext?: ChannelThreadingToolContext,
) {
const resolvedMessageId = resolveReactionMessageId({ args: params, toolContext });
if (resolvedMessageId == null) {
throw new Error('messageId required. Provide messageId explicitly or react to the current inbound message.');
}
const messageId = String(resolvedMessageId);
const emojiType = readStringParam(params, 'emoji');

const reactions = await listReactionsFeishu({
Expand Down