Skip to content

Commit 4b80239

Browse files
committed
fix: Ajustando whatsapp.bailey.service.ts para mostrar corretamente o QR Code que não estava aparecendo
1 parent cd800f2 commit 4b80239

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,15 @@ export class BaileysStartupService extends ChannelStartupService {
427427
const statusCode = (lastDisconnect?.error as Boom)?.output?.statusCode;
428428
const codesToNotReconnect = [DisconnectReason.loggedOut, DisconnectReason.forbidden, 402, 406];
429429
const shouldReconnect = !codesToNotReconnect.includes(statusCode);
430+
431+
// Check if this is the initial connection before QR code generation
432+
const isInitialConnection = !this.instance.wuid && this.instance.qrcode.count === 0;
433+
434+
if (isInitialConnection) {
435+
this.logger.info('Initial connection closed, waiting for QR code generation...');
436+
return; // Prevents infinite reconnection loop
437+
}
438+
430439
if (shouldReconnect) {
431440
await this.connectToWhatsapp(this.phoneNumber);
432441
} else {

0 commit comments

Comments
 (0)