mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-18 05:20:48 +00:00
37 lines
1.1 KiB
TypeScript
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 };
|
|
}
|