fix: reply message

This commit is contained in:
Davidson Gomes 2024-06-11 11:07:49 -03:00
parent 31258a9b85
commit f551242e86
2 changed files with 5 additions and 12 deletions

View File

@ -725,8 +725,6 @@ export class ChatwootService {
const sourceReplyId = quotedMsg?.chatwootMessageId || null;
console.log('sourceReplyId', sourceReplyId);
const message = await client.messages.create({
accountId: this.provider.accountId,
conversationId: conversationId,
@ -1440,7 +1438,7 @@ export class ChatwootService {
},
});
const key = message.key as {
const key = message?.key as {
id: string;
fromMe: boolean;
remoteJid: string;
@ -1747,8 +1745,6 @@ export class ChatwootService {
const quotedId = body.contextInfo?.stanzaId || body.message?.contextInfo?.stanzaId;
console.log('quotedId', quotedId);
let quotedMsg = null;
if (quotedId)
@ -1761,8 +1757,6 @@ export class ChatwootService {
},
});
console.log('quotedMsg', quotedMsg);
const isMedia = this.isMediaMessage(body.message);
const adsMessage = this.getAdsMessage(body.message);

View File

@ -1124,7 +1124,6 @@ export class BaileysStartupService extends ChannelStartupService {
this.localWebhook.webhookBase64 === true ||
(this.configService.get<Typebot>('TYPEBOT').SEND_MEDIA_BASE64 && isMedia)
) {
console.log('Download media');
const buffer = await downloadMediaMessage(
{ key: received.key, message: received?.message },
'buffer',
@ -1173,10 +1172,6 @@ export class BaileysStartupService extends ChannelStartupService {
this.sendDataWebhook(Events.MESSAGES_UPSERT, messageRaw);
await this.prismaRepository.message.create({
data: messageRaw,
});
if (
this.configService.get<Chatwoot>('CHATWOOT').ENABLED &&
this.localChatwoot.enabled &&
@ -1195,6 +1190,10 @@ export class BaileysStartupService extends ChannelStartupService {
}
}
await this.prismaRepository.message.create({
data: messageRaw,
});
if (this.configService.get<Typebot>('TYPEBOT').ENABLED) {
if (type === 'notify') {
if (messageRaw.messageType !== 'reactionMessage')