chore: better explicit message on whatsapp

This commit is contained in:
Vincent Koc
2026-05-04 11:00:22 -07:00
parent fc7e2a10c8
commit 841eb81baf
3 changed files with 5 additions and 3 deletions

View File

@@ -142,7 +142,9 @@ describe("loginWeb coverage", () => {
restartOpts?.onQr?.("restart-qr");
await flushTasks();
expect(runtime.log).toHaveBeenCalledWith("Scan this QR in WhatsApp (Linked Devices):");
expect(runtime.log).toHaveBeenCalledWith(
"Open the WhatsApp app, go to Linked Devices, then scan this QR:",
);
expect(runtime.log).toHaveBeenCalledWith("terminal:initial-qr");
expect(runtime.log).toHaveBeenCalledWith("terminal:restart-qr");
expect(renderQrTerminalMock).toHaveBeenCalledWith("initial-qr", { small: true });

View File

@@ -21,7 +21,7 @@ export async function loginWeb(
const socketTiming = resolveWhatsAppSocketTiming(cfg);
const restoredFromBackup = await restoreCredsFromBackupIfNeeded(account.authDir);
const onQr = (qr: string) => {
runtime.log("Scan this QR in WhatsApp (Linked Devices):");
runtime.log("Open the WhatsApp app, go to Linked Devices, then scan this QR:");
void renderQrTerminal(qr, { small: true })
.then((output) => {
runtime.log(output.endsWith("\n") ? output.slice(0, -1) : output);

View File

@@ -192,7 +192,7 @@ export async function createWaSocket(
if (qr) {
opts.onQr?.(qr);
if (printQr) {
console.log("Scan this QR in WhatsApp (Linked Devices):");
console.log("Open the WhatsApp app, go to Linked Devices, then scan this QR:");
void printTerminalQr(qr).catch((err) => {
sessionLogger.warn({ error: String(err) }, "failed rendering WhatsApp QR");
});