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,18 +315,13 @@ export class WhatsappDirectLine extends GBService {
to = message.to.endsWith('@g.us') ? message.to.split('@')[0] : message.to.split('@')[0]; to = message.to.endsWith('@g.us') ? message.to.split('@')[0] : message.to.split('@')[0];
const newThis = WhatsappDirectLine.botsByNumber[to]; 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 && newThis.min.botId !== this.min.botId) {
await newThis.received(req, res);
if (newThis.min.botId !== this.min.botId && return;
GBServer.globals.minBoot.botId !== this.min.botId) {
await newThis.received(req, res);
return;
}
} }
text = message.body; text = message.body;
@ -1169,7 +1164,7 @@ export class WhatsappDirectLine extends GBService {
const startDialog = activeMin.core.getParam(activeMin.instance, 'Start Dialog', null); const startDialog = activeMin.core.getParam(activeMin.instance, 'Start Dialog', null);
if (startDialog) { if (startDialog) {
GBLog.info(`Calling /start for Auto start : ${startDialog} for ${activeMin.instance.botId}...`); GBLog.info(`Calling /start for Auto start : ${startDialog} for ${activeMin.instance.botId}...`);
if (provider === 'chatapi') { if (provider === 'chatapi') {
req.body.messages[0].body = `/start`; req.body.messages[0].body = `/start`;