refactor: migrate messaging plugins to sdk
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { chunkText } from "../../../auto-reply/chunk.js";
|
||||
import { shouldLogVerbose } from "../../../globals.js";
|
||||
import { sendMessageWhatsApp, sendPollWhatsApp } from "../../../web/outbound.js";
|
||||
import { sendPollWhatsApp } from "../../../web/outbound.js";
|
||||
import { isWhatsAppGroupJid, normalizeWhatsAppTarget } from "../../../whatsapp/normalize.js";
|
||||
import type { ChannelOutboundAdapter } from "../types.js";
|
||||
import { missingTargetError } from "../../../infra/outbound/target-errors.js";
|
||||
@@ -57,7 +57,8 @@ export const whatsappOutbound: ChannelOutboundAdapter = {
|
||||
};
|
||||
},
|
||||
sendText: async ({ to, text, accountId, deps, gifPlayback }) => {
|
||||
const send = deps?.sendWhatsApp ?? sendMessageWhatsApp;
|
||||
const send =
|
||||
deps?.sendWhatsApp ?? (await import("../../../web/outbound.js")).sendMessageWhatsApp;
|
||||
const result = await send(to, text, {
|
||||
verbose: false,
|
||||
accountId: accountId ?? undefined,
|
||||
@@ -66,7 +67,8 @@ export const whatsappOutbound: ChannelOutboundAdapter = {
|
||||
return { channel: "whatsapp", ...result };
|
||||
},
|
||||
sendMedia: async ({ to, text, mediaUrl, accountId, deps, gifPlayback }) => {
|
||||
const send = deps?.sendWhatsApp ?? sendMessageWhatsApp;
|
||||
const send =
|
||||
deps?.sendWhatsApp ?? (await import("../../../web/outbound.js")).sendMessageWhatsApp;
|
||||
const result = await send(to, text, {
|
||||
verbose: false,
|
||||
mediaUrl,
|
||||
|
||||
Reference in New Issue
Block a user