fix(basic.gblib): update ChatServices.ts #420

Closed
eltociear wants to merge 2540 commits from patch-1 into main
Showing only changes of commit 134cf31695 - Show all commits

View file

@ -137,9 +137,11 @@ export class GBMinService {
res.end(); res.end();
return; // Exit here. return; // Exit here.
} }
let activeMin;
if (process.env.WHATSAPP_WELCOME_DISABLED !== "true") {
const toSwitchMin = GBServer.globals.minInstances.filter(p => p.botId === text)[0]; const toSwitchMin = GBServer.globals.minInstances.filter(p => p.botId === text)[0];
let activeMin = toSwitchMin ? toSwitchMin : GBServer.globals.minBoot; activeMin = toSwitchMin ? toSwitchMin : GBServer.globals.minBoot;
let sec = new SecService(); let sec = new SecService();
let user = await sec.getUserFromPhone(id); let user = await sec.getUserFromPhone(id);
@ -161,9 +163,14 @@ export class GBMinService {
(activeMin as any).whatsAppDirectLine.received(req, res); (activeMin as any).whatsAppDirectLine.received(req, res);
} }
} }
}
else {
(GBServer.globals.minBoot as any).whatsAppDirectLine.received(req, res);
}
} catch (error) { } catch (error) {
GBLog.error(`Error on Whatsapp callback: ${error.message}`); GBLog.error(`Error on Whatsapp callback: ${error.message}`);
} }
}); });
await Promise.all( await Promise.all(