mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 03:10:43 +00:00
29 lines
890 B
TypeScript
29 lines
890 B
TypeScript
import { defineChannelMessageAdapter } from "openclaw/plugin-sdk/channel-message";
|
|
import { sendMessageIrc } from "./send.js";
|
|
import type { CoreConfig } from "./types.js";
|
|
|
|
export const ircMessageAdapter = defineChannelMessageAdapter({
|
|
id: "irc",
|
|
durableFinal: {
|
|
capabilities: {
|
|
text: true,
|
|
media: true,
|
|
replyTo: true,
|
|
},
|
|
},
|
|
send: {
|
|
text: async ({ cfg, to, text, accountId, replyToId }) =>
|
|
await sendMessageIrc(to, text, {
|
|
cfg: cfg as CoreConfig,
|
|
accountId: accountId ?? undefined,
|
|
replyTo: replyToId ?? undefined,
|
|
}),
|
|
media: async ({ cfg, to, text, mediaUrl, accountId, replyToId }) =>
|
|
await sendMessageIrc(to, mediaUrl ? `${text}\n\nAttachment: ${mediaUrl}` : text, {
|
|
cfg: cfg as CoreConfig,
|
|
accountId: accountId ?? undefined,
|
|
replyTo: replyToId ?? undefined,
|
|
}),
|
|
},
|
|
});
|