Files
openclaw/src/plugin-sdk/discord-send.ts
2026-03-16 01:05:51 -07:00

37 lines
1.1 KiB
TypeScript

import type { DiscordSendResult } from "../../extensions/discord/src/send.types.js";
type DiscordSendOptionInput = {
replyToId?: string | null;
accountId?: string | null;
silent?: boolean;
};
type DiscordSendMediaOptionInput = DiscordSendOptionInput & {
mediaUrl?: string;
mediaLocalRoots?: readonly string[];
};
/** Build the common Discord send options from SDK-level reply payload fields. */
export function buildDiscordSendOptions(input: DiscordSendOptionInput) {
return {
verbose: false,
replyTo: input.replyToId ?? undefined,
accountId: input.accountId ?? undefined,
silent: input.silent ?? undefined,
};
}
/** Extend the base Discord send options with media-specific fields. */
export function buildDiscordSendMediaOptions(input: DiscordSendMediaOptionInput) {
return {
...buildDiscordSendOptions(input),
mediaUrl: input.mediaUrl,
mediaLocalRoots: input.mediaLocalRoots,
};
}
/** Stamp raw Discord send results with the channel id expected by shared outbound flows. */
export function tagDiscordChannelResult(result: DiscordSendResult) {
return { channel: "discord" as const, ...result };
}