mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-12-24 14:17:47 -06:00
feat: Now you can register several typebots with triggers
This commit is contained in:
@@ -502,7 +502,6 @@ export class BaileysStartupService extends ChannelStartupService {
|
||||
this.loadWebsocket();
|
||||
this.loadRabbitmq();
|
||||
this.loadSqs();
|
||||
this.loadTypebot();
|
||||
this.loadProxy();
|
||||
|
||||
this.instance.authState = await this.defineAuthState();
|
||||
@@ -1182,19 +1181,13 @@ export class BaileysStartupService extends ChannelStartupService {
|
||||
}
|
||||
|
||||
if (this.configService.get<Typebot>('TYPEBOT').ENABLED) {
|
||||
const typebotSessionRemoteJid = this.localTypebot.sessions?.find(
|
||||
(session) => session.remoteJid === received.key.remoteJid,
|
||||
);
|
||||
|
||||
if ((this.localTypebot.enabled && type === 'notify') || typebotSessionRemoteJid) {
|
||||
if (!(this.localTypebot.listeningFromMe === false && messageRaw.key.fromMe === true)) {
|
||||
if (messageRaw.messageType !== 'reactionMessage')
|
||||
await this.typebotService.sendTypebot(
|
||||
{ instanceName: this.instance.name, instanceId: this.instanceId },
|
||||
messageRaw.key.remoteJid,
|
||||
messageRaw,
|
||||
);
|
||||
}
|
||||
if (type === 'notify') {
|
||||
if (messageRaw.messageType !== 'reactionMessage')
|
||||
await this.typebotService.sendTypebot(
|
||||
{ instanceName: this.instance.name, instanceId: this.instanceId },
|
||||
messageRaw.key.remoteJid,
|
||||
messageRaw,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -133,7 +133,6 @@ export class BusinessStartupService extends ChannelStartupService {
|
||||
this.loadWebsocket();
|
||||
this.loadRabbitmq();
|
||||
this.loadSqs();
|
||||
this.loadTypebot();
|
||||
|
||||
this.eventHandler(content);
|
||||
|
||||
@@ -399,20 +398,12 @@ export class BusinessStartupService extends ChannelStartupService {
|
||||
}
|
||||
|
||||
if (this.configService.get<Typebot>('TYPEBOT').ENABLED) {
|
||||
const typebotSessionRemoteJid = this.localTypebot.sessions?.find(
|
||||
(session) => session.remoteJid === key.remoteJid,
|
||||
);
|
||||
|
||||
if (this.localTypebot.enabled || typebotSessionRemoteJid) {
|
||||
if (!(this.localTypebot.listeningFromMe === false && key.fromMe === true)) {
|
||||
if (messageRaw.messageType !== 'reactionMessage')
|
||||
await this.typebotService.sendTypebot(
|
||||
{ instanceName: this.instance.name },
|
||||
messageRaw.key.remoteJid,
|
||||
messageRaw,
|
||||
);
|
||||
}
|
||||
}
|
||||
if (messageRaw.messageType !== 'reactionMessage')
|
||||
await this.typebotService.sendTypebot(
|
||||
{ instanceName: this.instance.name },
|
||||
messageRaw.key.remoteJid,
|
||||
messageRaw,
|
||||
);
|
||||
}
|
||||
|
||||
await this.prismaRepository.message.create({
|
||||
|
||||
Reference in New Issue
Block a user