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

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

View file

@ -313,10 +313,17 @@ export class WhatsappDirectLine extends GBService {
message = req; message = req;
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 (newThis === undefined) { if (newThis === undefined) {
throw GBError.create(`Bot Number ${to} not setup for any loaded bot.`); throw GBError.create(`Bot Number ${to} not setup for any loaded bot.`);
} else { } 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); await newThis.received(req, res);
return; return;