openclaw/src/infra/outbound/channel-adapters.ts
2026-01-17 03:33:56 +00:00

25 lines
636 B
TypeScript

import type { ChannelId } from "../../channels/plugins/types.js";
export type ChannelMessageAdapter = {
supportsEmbeds: boolean;
buildCrossContextEmbeds?: (originLabel: string) => unknown[];
};
const DEFAULT_ADAPTER: ChannelMessageAdapter = {
supportsEmbeds: false,
};
const DISCORD_ADAPTER: ChannelMessageAdapter = {
supportsEmbeds: true,
buildCrossContextEmbeds: (originLabel: string) => [
{
description: `From ${originLabel}`,
},
],
};
export function getChannelMessageAdapter(channel: ChannelId): ChannelMessageAdapter {
if (channel === "discord") return DISCORD_ADAPTER;
return DEFAULT_ADAPTER;
}