treating errors gracefully

This commit is contained in:
pedro-php 2025-03-28 10:56:19 -03:00
parent f695e8bdc9
commit 17bd108251
2 changed files with 54 additions and 46 deletions

View File

@ -1,7 +1,7 @@
services:
api:
container_name: evolution_api
image: evoapicloud/evolution-api:latest
build: .
restart: always
depends_on:
- redis

View File

@ -3980,6 +3980,17 @@ export class BaileysStartupService extends ChannelStartupService {
edit: data.key,
});
if (messageSent) {
const editedMessage = messageSent?.message?.protocolMessage || messageSent?.message?.editedMessage?.message?.protocolMessage;
if (editedMessage) {
this.sendDataWebhook(Events.SEND_MESSAGE_UPDATE, editedMessage);
if (this.configService.get<Chatwoot>('CHATWOOT').ENABLED && this.localChatwoot?.enabled)
this.chatwootService.eventWhatsapp(
'send.message.update',
{ instanceName: this.instance.name, instanceId: this.instance.id },
editedMessage,
);
const messageId = messageSent.message?.protocolMessage?.key?.id;
if (messageId) {
let message = await this.prismaRepository.message.findFirst({
@ -4023,10 +4034,7 @@ export class BaileysStartupService extends ChannelStartupService {
await this.prismaRepository.messageUpdate.create({
data: messageUpdate,
});
const editedMessage = messageSent?.message?.protocolMessage || messageSent?.message?.editedMessage?.message?.protocolMessage;
this.sendDataWebhook(Events.SEND_MESSAGE_UPDATE, editedMessage);
}
}
}