Skip to content

Commit

Permalink
fix: reply message
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidsonGomes committed Jun 11, 2024
1 parent 31258a9 commit f551242
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
8 changes: 1 addition & 7 deletions src/api/integrations/chatwoot/services/chatwoot.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -1440,7 +1438,7 @@ export class ChatwootService {
},
});

const key = message.key as {
const key = message?.key as {
id: string;
fromMe: boolean;
remoteJid: string;
Expand Down Expand Up @@ -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)
Expand All @@ -1761,8 +1757,6 @@ export class ChatwootService {
},
});

console.log('quotedMsg', quotedMsg);

const isMedia = this.isMediaMessage(body.message);

const adsMessage = this.getAdsMessage(body.message);
Expand Down
9 changes: 4 additions & 5 deletions src/api/services/channels/whatsapp.baileys.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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 &&
Expand All @@ -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')
Expand Down

0 comments on commit f551242

Please sign in to comment.