From a7887f0b1ce07d951f7ba33cab859b8d1d0a9b45 Mon Sep 17 00:00:00 2001 From: Davidson Gomes Date: Wed, 12 Jun 2024 09:55:40 -0300 Subject: [PATCH] fix: messageId baileys --- src/api/routes/chat.router.ts | 1 - src/api/services/channel.service.ts | 1 + src/api/services/channels/whatsapp.baileys.service.ts | 2 ++ src/validate/validate.schema.ts | 3 --- 4 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/api/routes/chat.router.ts b/src/api/routes/chat.router.ts index 76b7af72b..f5d49af64 100644 --- a/src/api/routes/chat.router.ts +++ b/src/api/routes/chat.router.ts @@ -156,7 +156,6 @@ export class ChatRouter extends RouterBroker { return res.status(HttpStatus.OK).json(response); }) - // TODO: realizar filtro pelo postgres corretamente .post(this.routerPath('findMessages'), ...guards, async (req, res) => { const response = await this.dataValidate>({ request: req, diff --git a/src/api/services/channel.service.ts b/src/api/services/channel.service.ts index 7e4d8264d..52eb3297d 100644 --- a/src/api/services/channel.service.ts +++ b/src/api/services/channel.service.ts @@ -70,6 +70,7 @@ export class ChannelStartupService { public setInstance(instance: InstanceDto) { this.instance.name = instance.instanceName; + this.logger.setInstance(instance.instanceName); this.instance.id = instance.instanceId; this.instance.integration = instance.integration; this.instance.number = instance.number; diff --git a/src/api/services/channels/whatsapp.baileys.service.ts b/src/api/services/channels/whatsapp.baileys.service.ts index 7ef544351..2711ebe9e 100644 --- a/src/api/services/channels/whatsapp.baileys.service.ts +++ b/src/api/services/channels/whatsapp.baileys.service.ts @@ -39,6 +39,7 @@ import { Label } from '@whiskeysockets/baileys/lib/Types/Label'; import { LabelAssociation } from '@whiskeysockets/baileys/lib/Types/LabelAssociation'; import axios from 'axios'; import { isBase64, isURL } from 'class-validator'; +import { randomBytes } from 'crypto'; import EventEmitter2 from 'eventemitter2'; // import { exec } from 'child_process'; import ffmpeg from 'fluent-ffmpeg'; @@ -1792,6 +1793,7 @@ export class BaileysStartupService extends ChannelStartupService { const messageSent = await (async () => { const option = { quoted, + messageId: '3EB0' + randomBytes(6).toString('hex').toUpperCase(), }; if ( diff --git a/src/validate/validate.schema.ts b/src/validate/validate.schema.ts index e6ea15778..52f46ef7a 100644 --- a/src/validate/validate.schema.ts +++ b/src/validate/validate.schema.ts @@ -1,11 +1,8 @@ // Integrations Schema -// TODO: rever todas as integrações e garantir o funcionamento perfeito export * from '../api/integrations/chatwoot/validate/chatwoot.schema'; export * from '../api/integrations/rabbitmq/validate/rabbitmq.schema'; export * from '../api/integrations/sqs/validate/sqs.schema'; export * from '../api/integrations/typebot/validate/typebot.schema'; - -// Instance Schema export * from './chat.schema'; export * from './group.schema'; export * from './instance.schema';