From dfd89ec5e7ab45a60ff1c35b89b6ef96e3dbf260 Mon Sep 17 00:00:00 2001 From: rodrigorodriguez Date: Sun, 9 Oct 2022 17:53:21 -0300 Subject: [PATCH] new(all): Custom Domain support per bot. --- .../services/WhatsappDirectLine.ts | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/packages/whatsapp.gblib/services/WhatsappDirectLine.ts b/packages/whatsapp.gblib/services/WhatsappDirectLine.ts index 92d0744c..36bf3427 100644 --- a/packages/whatsapp.gblib/services/WhatsappDirectLine.ts +++ b/packages/whatsapp.gblib/services/WhatsappDirectLine.ts @@ -202,6 +202,17 @@ export class WhatsappDirectLine extends GBService { client.on('authenticated', async () => { this.browserWSEndpoint = client.pupBrowser.wsEndpoint(); + GBLog.info(`GBWhatsApp: QR Code authenticated for ${this.botId}.`); + }); + + client.on('ready', async () => { + + client.pupBrowser.on('disconnected', (async () => { + GBLog.info(`Browser terminated. Restarting ${this.min.botId} WhatsApp native provider.`); + await (createClient.bind(this))(null); + }).bind(this)); + + GBLog.info(`GBWhatsApp: Empty chat list for ${this.botId}GBWhatsApp:...`); // Keeps the chat list cleaned. @@ -219,12 +230,7 @@ export class WhatsappDirectLine extends GBService { }); - GBLog.info(`WhatsApp QR Code authenticated for ${this.botId}.`); }); - client.pupBrowser.on('disconnected', (async () => { - GBLog.info(`Browser terminated. Restarting ${this.min.botId} WhatsApp native provider.`); - await (createClient.bind(this))(null); - }).bind(this)); client.initialize(); };