From 62bbd00cfa98c5d7c93402712f02fa9dd743ac29 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 15 Oct 2025 04:59:49 +0000 Subject: [PATCH 1/4] Initial plan From dc23095a5ce79a9a03cc88ea981909d7e545a6de Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 15 Oct 2025 05:04:22 +0000 Subject: [PATCH 2/4] Enable QR code display in terminal for pnpm dev Co-authored-by: Polabiel <40695127+Polabiel@users.noreply.github.com> --- src/connection.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/connection.ts b/src/connection.ts index 524ba46..fa0f309 100644 --- a/src/connection.ts +++ b/src/connection.ts @@ -26,7 +26,7 @@ export const connect: () => Promise = async () => { const bot = makeWASocket({ browser: Browsers.appropriate('Desktop'), logger: logger, - printQRInTerminal: false, + printQRInTerminal: true, defaultQueryTimeoutMs: 30 * 1000, auth: state, shouldIgnoreJid: (jid) => { @@ -181,8 +181,9 @@ export const connect: () => Promise = async () => { } if (qr !== undefined) { - logger.debug('🔑 QR Code gerado'); + console.log('\n🔑 QR Code gerado! Escaneie o código abaixo:\n'); qrcode.generate(qr, { small: true }); + logger.info('🔑 QR Code exibido no terminal'); } }); From 43d0fdcd5f2dee44cfa29b41757fca1021ce004d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 23 Oct 2025 12:42:59 +0000 Subject: [PATCH 3/4] Fix: Remove deprecated printQRInTerminal option to eliminate warning Co-authored-by: Polabiel <40695127+Polabiel@users.noreply.github.com> --- src/connection.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/connection.ts b/src/connection.ts index fa0f309..69c7180 100644 --- a/src/connection.ts +++ b/src/connection.ts @@ -26,7 +26,7 @@ export const connect: () => Promise = async () => { const bot = makeWASocket({ browser: Browsers.appropriate('Desktop'), logger: logger, - printQRInTerminal: true, + printQRInTerminal: false, defaultQueryTimeoutMs: 30 * 1000, auth: state, shouldIgnoreJid: (jid) => { From 3062727e22810a799dbb7482dc406ffd47716451 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 23 Oct 2025 12:54:47 +0000 Subject: [PATCH 4/4] Fix: Move QR code handling before connection state processing Co-authored-by: Polabiel <40695127+Polabiel@users.noreply.github.com> --- src/connection.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/connection.ts b/src/connection.ts index 69c7180..d2a8bad 100644 --- a/src/connection.ts +++ b/src/connection.ts @@ -98,6 +98,14 @@ export const connect: () => Promise = async () => { bot.ev.on('connection.update', async (update) => { const { connection, lastDisconnect, qr } = update; + + // Handle QR code first, before processing connection state + if (qr !== undefined) { + console.log('\n🔑 QR Code gerado! Escaneie o código abaixo:\n'); + qrcode.generate(qr, { small: true }); + logger.info('🔑 QR Code exibido no terminal'); + } + switch (connection) { case 'close': { const statusCode = @@ -179,12 +187,6 @@ export const connect: () => Promise = async () => { logger.debug('🔄 Conectando...'); break; } - - if (qr !== undefined) { - console.log('\n🔑 QR Code gerado! Escaneie o código abaixo:\n'); - qrcode.generate(qr, { small: true }); - logger.info('🔑 QR Code exibido no terminal'); - } }); bot.ev.on('creds.update', saveCreds);