From d261ea371b468ae9c600dc73dcf488f90f68b4d9 Mon Sep 17 00:00:00 2001 From: Rodrigo Rodriguez Date: Sat, 9 Sep 2023 13:59:14 -0300 Subject: [PATCH] fix(all): Fix user switching on a single chip. --- packages/whatsapp.gblib/services/WhatsappDirectLine.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/whatsapp.gblib/services/WhatsappDirectLine.ts b/packages/whatsapp.gblib/services/WhatsappDirectLine.ts index 4266df06..cefad9b4 100644 --- a/packages/whatsapp.gblib/services/WhatsappDirectLine.ts +++ b/packages/whatsapp.gblib/services/WhatsappDirectLine.ts @@ -313,10 +313,17 @@ export class WhatsappDirectLine extends GBService { message = req; to = message.to.endsWith('@g.us') ? message.to.split('@')[0] : message.to.split('@')[0]; const newThis = WhatsappDirectLine.botsByNumber[to]; + + // Every number must be mapped to a bot, even if shared by boot bot. + if (newThis === undefined) { throw GBError.create(`Bot Number ${to} not setup for any loaded bot.`); } else { - if (newThis.min.botId !== this.min.botId) { + + // Reroute to custom bot only if it is not boot bot. + + if (newThis.min.botId !== this.min.botId && + GBServer.globals.minBoot.botId !== this.min.botId) { await newThis.received(req, res); return;