



















@@ -38,7 +38,11 @@ import {
3838sendVoiceMessageDiscord,
3939unpinMessageDiscord,
4040} from "../send.js";
41-import type { DiscordSendComponents, DiscordSendEmbeds } from "../send.shared.js";
41+import {
42+resolveDiscordTargetChannelId,
43+type DiscordSendComponents,
44+type DiscordSendEmbeds,
45+} from "../send.shared.js";
4246import { resolveDiscordChannelId } from "../targets.js";
43474448export const discordMessagingActionRuntime = {
@@ -56,6 +60,7 @@ export const discordMessagingActionRuntime = {
5660 readMessagesDiscord,
5761 removeOwnReactionsDiscord,
5862 removeReactionDiscord,
63+ resolveDiscordReactionTargetChannelId,
5964 resolveDiscordChannelId,
6065 searchMessagesDiscord,
6166 sendDiscordComponentMessage,
@@ -66,6 +71,23 @@ export const discordMessagingActionRuntime = {
6671 unpinMessageDiscord,
6772};
687374+export async function resolveDiscordReactionTargetChannelId(params: {
75+target: string;
76+cfg: OpenClawConfig;
77+accountId?: string;
78+}): Promise<string> {
79+try {
80+return resolveDiscordChannelId(params.target);
81+} catch {
82+return (
83+await resolveDiscordTargetChannelId(params.target, {
84+cfg: params.cfg,
85+accountId: params.accountId,
86+})
87+).channelId;
88+}
89+}
90+6991function hasDiscordComponentObjectKeys(value: unknown): value is Record<string, unknown> {
7092return Boolean(
7193value &&
@@ -114,6 +136,15 @@ export async function handleDiscordMessagingAction(
114136}
115137const cfgOptions = { cfg };
116138const resolvedReactionAccountId = accountId ?? resolveDefaultDiscordAccountId(cfg);
139+const resolveReactionChannelId = async () => {
140+const target =
141+readStringParam(params, "channelId") ?? readStringParam(params, "to", { required: true });
142+return await discordMessagingActionRuntime.resolveDiscordReactionTargetChannelId({
143+ target,
144+ cfg,
145+accountId: resolvedReactionAccountId,
146+});
147+};
117148const reactionRuntimeOptions = resolvedReactionAccountId
118149 ? createDiscordRuntimeAccountContext({
119150 cfg,
@@ -138,7 +169,7 @@ export async function handleDiscordMessagingAction(
138169if (!isActionEnabled("reactions")) {
139170throw new Error("Discord reactions are disabled.");
140171}
141-const channelId = resolveChannelId();
172+const channelId = await resolveReactionChannelId();
142173const messageId = readStringParam(params, "messageId", {
143174required: true,
144175});
@@ -174,7 +205,7 @@ export async function handleDiscordMessagingAction(
174205if (!isActionEnabled("reactions")) {
175206throw new Error("Discord reactions are disabled.");
176207}
177-const channelId = resolveChannelId();
208+const channelId = await resolveReactionChannelId();
178209const messageId = readStringParam(params, "messageId", {
179210required: true,
180211});
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。