mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-07-15 11:42:53 -06:00
fix: StopBotFromMe working with chatwoot
This commit is contained in:
parent
0dfbed4eb9
commit
e7ff09752e
@ -12,6 +12,7 @@
|
|||||||
* Fixed loading of selects in the manager
|
* Fixed loading of selects in the manager
|
||||||
* Add restart button to sessions screen
|
* Add restart button to sessions screen
|
||||||
* Adjustments to docker files
|
* Adjustments to docker files
|
||||||
|
* StopBotFromMe working with chatwoot
|
||||||
|
|
||||||
# 2.0.8-rc (2024-08-08 20:23)
|
# 2.0.8-rc (2024-08-08 20:23)
|
||||||
|
|
||||||
|
@ -977,23 +977,14 @@ export class DifyService {
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (stopBotFromMe && key.fromMe && session) {
|
if (stopBotFromMe && key.fromMe && session) {
|
||||||
if (keepOpen) {
|
|
||||||
await this.prismaRepository.difySession.update({
|
await this.prismaRepository.difySession.update({
|
||||||
where: {
|
where: {
|
||||||
id: session.id,
|
id: session.id,
|
||||||
},
|
},
|
||||||
data: {
|
data: {
|
||||||
status: 'closed',
|
status: 'paused',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
} else {
|
|
||||||
await this.prismaRepository.difySession.deleteMany({
|
|
||||||
where: {
|
|
||||||
difyId: findDify.id,
|
|
||||||
remoteJid: remoteJid,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1180,23 +1180,14 @@ export class OpenaiService {
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (stopBotFromMe && key.fromMe && session) {
|
if (stopBotFromMe && key.fromMe && session) {
|
||||||
if (keepOpen) {
|
|
||||||
await this.prismaRepository.openaiSession.update({
|
await this.prismaRepository.openaiSession.update({
|
||||||
where: {
|
where: {
|
||||||
id: session.id,
|
id: session.id,
|
||||||
},
|
},
|
||||||
data: {
|
data: {
|
||||||
status: 'closed',
|
status: 'paused',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
} else {
|
|
||||||
await this.prismaRepository.openaiSession.deleteMany({
|
|
||||||
where: {
|
|
||||||
openaiBotId: findOpenai.id,
|
|
||||||
remoteJid: remoteJid,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1559,23 +1559,14 @@ export class TypebotService {
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (stopBotFromMe && key.fromMe && session) {
|
if (stopBotFromMe && key.fromMe && session) {
|
||||||
if (keepOpen) {
|
|
||||||
await this.prismaRepository.typebotSession.update({
|
await this.prismaRepository.typebotSession.update({
|
||||||
where: {
|
where: {
|
||||||
id: session.id,
|
id: session.id,
|
||||||
},
|
},
|
||||||
data: {
|
data: {
|
||||||
status: 'closed',
|
status: 'paused',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
} else {
|
|
||||||
await this.prismaRepository.typebotSession.deleteMany({
|
|
||||||
where: {
|
|
||||||
typebotId: findTypebot.id,
|
|
||||||
remoteJid: remoteJid,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2014,6 +2014,36 @@ export class BaileysStartupService extends ChannelStartupService {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.configService.get<Chatwoot>('CHATWOOT').ENABLED && this.localChatwoot.enabled && isIntegration) {
|
||||||
|
if (this.configService.get<Typebot>('TYPEBOT').ENABLED) {
|
||||||
|
if (messageRaw.messageType !== 'reactionMessage')
|
||||||
|
await this.typebotService.sendTypebot(
|
||||||
|
{ instanceName: this.instance.name, instanceId: this.instanceId },
|
||||||
|
messageRaw.key.remoteJid,
|
||||||
|
messageRaw,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.configService.get<Openai>('OPENAI').ENABLED) {
|
||||||
|
if (messageRaw.messageType !== 'reactionMessage')
|
||||||
|
await this.openaiService.sendOpenai(
|
||||||
|
{ instanceName: this.instance.name, instanceId: this.instanceId },
|
||||||
|
messageRaw.key.remoteJid,
|
||||||
|
messageRaw,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.configService.get<Dify>('DIFY').ENABLED) {
|
||||||
|
console.log('DIFY messageRaw', messageRaw);
|
||||||
|
if (messageRaw.messageType !== 'reactionMessage')
|
||||||
|
await this.difyService.sendDify(
|
||||||
|
{ instanceName: this.instance.name, instanceId: this.instanceId },
|
||||||
|
messageRaw.key.remoteJid,
|
||||||
|
messageRaw,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (this.configService.get<Database>('DATABASE').SAVE_DATA.NEW_MESSAGE)
|
if (this.configService.get<Database>('DATABASE').SAVE_DATA.NEW_MESSAGE)
|
||||||
await this.prismaRepository.message.create({
|
await this.prismaRepository.message.create({
|
||||||
data: messageRaw,
|
data: messageRaw,
|
||||||
|
@ -948,6 +948,35 @@ export class BusinessStartupService extends ChannelStartupService {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.configService.get<Chatwoot>('CHATWOOT').ENABLED && this.localChatwoot.enabled && isIntegration) {
|
||||||
|
if (this.configService.get<Typebot>('TYPEBOT').ENABLED) {
|
||||||
|
if (messageRaw.messageType !== 'reactionMessage')
|
||||||
|
await this.typebotService.sendTypebot(
|
||||||
|
{ instanceName: this.instance.name, instanceId: this.instanceId },
|
||||||
|
messageRaw.key.remoteJid,
|
||||||
|
messageRaw,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.configService.get<Openai>('OPENAI').ENABLED) {
|
||||||
|
if (messageRaw.messageType !== 'reactionMessage')
|
||||||
|
await this.openaiService.sendOpenai(
|
||||||
|
{ instanceName: this.instance.name, instanceId: this.instanceId },
|
||||||
|
messageRaw.key.remoteJid,
|
||||||
|
messageRaw,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.configService.get<Dify>('DIFY').ENABLED) {
|
||||||
|
if (messageRaw.messageType !== 'reactionMessage')
|
||||||
|
await this.difyService.sendDify(
|
||||||
|
{ instanceName: this.instance.name, instanceId: this.instanceId },
|
||||||
|
messageRaw.key.remoteJid,
|
||||||
|
messageRaw,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
await this.prismaRepository.message.create({
|
await this.prismaRepository.message.create({
|
||||||
data: messageRaw,
|
data: messageRaw,
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user