33 lines
1.1 KiB
TypeScript
33 lines
1.1 KiB
TypeScript
import { sendMessageDiscord, sendPollDiscord } from "../../../discord/send.js";
|
|
import type { ChannelOutboundAdapter } from "../types.js";
|
|
|
|
export const discordOutbound: ChannelOutboundAdapter = {
|
|
deliveryMode: "direct",
|
|
chunker: null,
|
|
textChunkLimit: 2000,
|
|
pollMaxOptions: 10,
|
|
sendText: async ({ to, text, accountId, deps, replyToId }) => {
|
|
const send = deps?.sendDiscord ?? sendMessageDiscord;
|
|
const result = await send(to, text, {
|
|
verbose: false,
|
|
replyTo: replyToId ?? undefined,
|
|
accountId: accountId ?? undefined,
|
|
});
|
|
return { channel: "discord", ...result };
|
|
},
|
|
sendMedia: async ({ to, text, mediaUrl, accountId, deps, replyToId }) => {
|
|
const send = deps?.sendDiscord ?? sendMessageDiscord;
|
|
const result = await send(to, text, {
|
|
verbose: false,
|
|
mediaUrl,
|
|
replyTo: replyToId ?? undefined,
|
|
accountId: accountId ?? undefined,
|
|
});
|
|
return { channel: "discord", ...result };
|
|
},
|
|
sendPoll: async ({ to, poll, accountId }) =>
|
|
await sendPollDiscord(to, poll, {
|
|
accountId: accountId ?? undefined,
|
|
}),
|
|
};
|