fix(all): Fix user switching on a single chip.

This commit is contained in:
Rodrigo Rodriguez 2023-09-09 16:38:47 -03:00
parent 9ab41597af
commit 934bafb71e

View file

@ -315,19 +315,14 @@ export class WhatsappDirectLine extends GBService {
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 there is a number specified, checks if it
// is related to a custom bot and reroutes immediately.
if (newThis) {
// 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) {
if (newThis && newThis.min.botId !== this.min.botId) {
await newThis.received(req, res);
return;
}
}
text = message.body;
from = message.from.endsWith('@g.us') ? message.author.split('@')[0] : message.from.split('@')[0];