























@@ -13,6 +13,7 @@ import {
1313} from "openclaw/plugin-sdk/interactive-runtime";
1414import { normalizeOptionalStringifiedId } from "openclaw/plugin-sdk/string-coerce-runtime";
1515import { handleDiscordAction } from "../../action-runtime-api.js";
16+import { notifyDiscordInboundEventOutboundSuccess } from "../inbound-event-delivery.js";
1617import {
1718buildDiscordInteractiveComponents,
1819buildDiscordPresentationComponents,
@@ -45,6 +46,8 @@ export async function handleDiscordMessageAction(
4546| "mediaAccess"
4647| "mediaLocalRoots"
4748| "mediaReadFile"
49+| "sessionKey"
50+| "inboundEventKind"
4851>,
4952): Promise<AgentToolResult<unknown>> {
5053const { action, params, cfg } = ctx;
@@ -54,6 +57,13 @@ export async function handleDiscordMessageAction(
5457mediaLocalRoots: ctx.mediaLocalRoots,
5558mediaReadFile: ctx.mediaReadFile,
5659} as const;
60+const notifyVisibleOutbound = (to: string, fallbackSessionKey?: string) =>
61+notifyDiscordInboundEventOutboundSuccess({
62+sessionKey: ctx.sessionKey ?? fallbackSessionKey ?? undefined,
63+ to,
64+ accountId,
65+inboundEventKind: ctx.inboundEventKind,
66+});
57675868const readTarget = () => {
5969const target =
@@ -106,7 +116,7 @@ export async function handleDiscordMessageAction(
106116const sessionKey = readStringParam(params, "__sessionKey");
107117const agentId = readStringParam(params, "__agentId");
108118const threadName = readStringParam(params, "threadName");
109-return await handleDiscordAction(
119+const result = await handleDiscordAction(
110120{
111121action: "sendMessage",
112122accountId: accountId ?? undefined,
@@ -127,6 +137,8 @@ export async function handleDiscordMessageAction(
127137cfg,
128138actionOptions,
129139);
140+notifyVisibleOutbound(to, sessionKey);
141+return result;
130142}
131143132144if (action === "upload-file") {
@@ -147,7 +159,7 @@ export async function handleDiscordMessageAction(
147159const suppressEmbeds = readBooleanParam(params, "suppressEmbeds");
148160const sessionKey = readStringParam(params, "__sessionKey");
149161const agentId = readStringParam(params, "__agentId");
150-return await handleDiscordAction(
162+const result = await handleDiscordAction(
151163{
152164action: "sendMessage",
153165accountId: accountId ?? undefined,
@@ -164,6 +176,8 @@ export async function handleDiscordMessageAction(
164176cfg,
165177actionOptions,
166178);
179+notifyVisibleOutbound(to, sessionKey);
180+return result;
167181}
168182169183if (action === "poll") {
@@ -177,7 +191,7 @@ export async function handleDiscordMessageAction(
177191integer: true,
178192strict: true,
179193});
180-return await handleDiscordAction(
194+const result = await handleDiscordAction(
181195{
182196action: "poll",
183197accountId: accountId ?? undefined,
@@ -191,6 +205,8 @@ export async function handleDiscordMessageAction(
191205cfg,
192206actionOptions,
193207);
208+notifyVisibleOutbound(to);
209+return result;
194210}
195211196212if (action === "react") {
@@ -315,7 +331,7 @@ export async function handleDiscordMessageAction(
315331integer: true,
316332});
317333const appliedTags = readStringArrayParam(params, "appliedTags");
318-return await handleDiscordAction(
334+const result = await handleDiscordAction(
319335{
320336action: "threadCreate",
321337accountId: accountId ?? undefined,
@@ -329,25 +345,30 @@ export async function handleDiscordMessageAction(
329345cfg,
330346actionOptions,
331347);
348+notifyVisibleOutbound(resolveChannelId());
349+return result;
332350}
333351334352if (action === "sticker") {
353+const to = readStringParam(params, "to", { required: true });
335354const stickerIds =
336355readStringArrayParam(params, "stickerId", {
337356required: true,
338357label: "sticker-id",
339358}) ?? [];
340-return await handleDiscordAction(
359+const result = await handleDiscordAction(
341360{
342361action: "sticker",
343362accountId: accountId ?? undefined,
344-to: readStringParam(params, "to", { required: true }),
363+ to,
345364 stickerIds,
346365content: readStringParam(params, "message"),
347366},
348367cfg,
349368actionOptions,
350369);
370+notifyVisibleOutbound(to);
371+return result;
351372}
352373353374if (action === "set-presence") {
@@ -371,6 +392,9 @@ export async function handleDiscordMessageAction(
371392 resolveChannelId,
372393});
373394if (adminResult !== undefined) {
395+if (action === "thread-reply") {
396+notifyVisibleOutbound(readStringParam(params, "threadId") ?? readTarget());
397+}
374398return adminResult;
375399}
376400此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。