mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 04:07:39 +00:00
fix(whatsapp): allow per-message link preview override\n\nWhatsApp messages default to enabling link previews for URLs. This adds\nsupport for overriding this behavior per-message via the \nparameter (e.g. from tool options), consistent with Telegram.\n\nFix: Updated internal WhatsApp Web API layers to pass option\ndown to Baileys .
This commit is contained in:
@@ -21,6 +21,7 @@ export async function sendMessageWhatsApp(
|
||||
mediaLocalRoots?: readonly string[];
|
||||
gifPlayback?: boolean;
|
||||
accountId?: string;
|
||||
linkPreview?: boolean;
|
||||
},
|
||||
): Promise<{ messageId: string; toJid: string }> {
|
||||
let text = body;
|
||||
@@ -75,10 +76,16 @@ export async function sendMessageWhatsApp(
|
||||
const hasExplicitAccountId = Boolean(options.accountId?.trim());
|
||||
const accountId = hasExplicitAccountId ? resolvedAccountId : undefined;
|
||||
const sendOptions: ActiveWebSendOptions | undefined =
|
||||
options.gifPlayback || accountId || documentFileName
|
||||
options.gifPlayback ||
|
||||
options.accountId ||
|
||||
options.linkPreview !== undefined ||
|
||||
documentFileName
|
||||
? {
|
||||
...(options.gifPlayback ? { gifPlayback: true } : {}),
|
||||
...(documentFileName ? { fileName: documentFileName } : {}),
|
||||
...(options.linkPreview !== undefined
|
||||
? { linkPreview: options.linkPreview }
|
||||
: {}),
|
||||
accountId,
|
||||
}
|
||||
: undefined;
|
||||
|
||||
Reference in New Issue
Block a user