From 39a881e61eb41aff78ed6cdd0299189fcf8e5e51 Mon Sep 17 00:00:00 2001 From: rodrigorodriguez Date: Thu, 13 Oct 2022 11:47:04 -0300 Subject: [PATCH] new(whatsapp.gblib): Native provider works in groups now. --- .../services/WhatsappDirectLine.ts | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/packages/whatsapp.gblib/services/WhatsappDirectLine.ts b/packages/whatsapp.gblib/services/WhatsappDirectLine.ts index ef0268b1..80d37cbc 100644 --- a/packages/whatsapp.gblib/services/WhatsappDirectLine.ts +++ b/packages/whatsapp.gblib/services/WhatsappDirectLine.ts @@ -179,25 +179,25 @@ export class WhatsappDirectLine extends GBService { qrcode.generate(qr, { small: true, scale: 0.5 }); // While handling other bots uses boot instance of this class to send QR Codes. - + const s = new DialogKeywords(this.min, null, null, null); + const qrBuf = await s.getQRCode(qr); + const gbaiName = `${this.min.botId}.gbai`; + const localName = Path.join('work', gbaiName, 'cache', `qr${GBAdminService.getRndReadableIdentifier()}.png`); + fs.writeFileSync(localName, qrBuf); + const url = urlJoin( + GBServer.globals.publicAddress, + this.min.botId, + 'cache', + Path.basename(localName) + ); if (minBoot.botId !== this.botId) { - const qrBuf = await s.getQRCode(qr); - const gbaiName = `${this.min.botId}.gbai`; - const localName = Path.join('work', gbaiName, 'cache', `qr${GBAdminService.getRndReadableIdentifier()}.png`); - fs.writeFileSync(localName, qrBuf); - const url = urlJoin( - GBServer.globals.publicAddress, - this.min.botId, - 'cache', - Path.basename(localName) - ); GBServer.globals.minBoot.whatsAppDirectLine.sendFileToDevice(adminNumber, url, Path.basename(localName), msg); } // The e-mail is sent to all bots. - const html = `

${url}

` + const html = `

${msg}

` await s.sendEmail(adminEmail, `Check your WhatsApp for bot ${this.botId}`, html); }).bind(this));