mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 17:04:32 +00:00
refactor: centralize outbound policy + target schema
This commit is contained in:
24
src/infra/outbound/channel-adapters.ts
Normal file
24
src/infra/outbound/channel-adapters.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
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;
|
||||
}
|
||||
Reference in New Issue
Block a user