From b76302cc0eb39840b09816fe705d36936eaf6e0a Mon Sep 17 00:00:00 2001 From: Claudemir Todo Bom Date: Sun, 15 Sep 2024 10:11:16 -0300 Subject: [PATCH] fix quoted messages not showing on devices - fix #146 --- backend/src/services/WbotServices/SendWhatsAppMessage.ts | 4 +--- backend/src/services/WbotServices/wbotMessageListener.ts | 7 ++++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/backend/src/services/WbotServices/SendWhatsAppMessage.ts b/backend/src/services/WbotServices/SendWhatsAppMessage.ts index 473e0ec4..1f164953 100644 --- a/backend/src/services/WbotServices/SendWhatsAppMessage.ts +++ b/backend/src/services/WbotServices/SendWhatsAppMessage.ts @@ -42,9 +42,7 @@ const SendWhatsAppMessage = async ({ options = { quoted: { key: msgFound?.key || chatMessage.id, - message: { - extendedTextMessage: msgFound?.message.extendedTextMessage - } + message: msgFound?.message } }; } diff --git a/backend/src/services/WbotServices/wbotMessageListener.ts b/backend/src/services/WbotServices/wbotMessageListener.ts index 2ab1ba9d..d917f55b 100644 --- a/backend/src/services/WbotServices/wbotMessageListener.ts +++ b/backend/src/services/WbotServices/wbotMessageListener.ts @@ -398,12 +398,13 @@ const downloadMedia = async (msg: proto.IWebMessageInfo, wbot: Session, ticket: while (contDownload < 10 && !stream) { try { - if (message?.directPath) { - message.url = ""; + const tmpMessage = { ...message }; + if (tmpMessage?.directPath) { + tmpMessage.url = ""; } // eslint-disable-next-line no-await-in-loop - stream = await downloadContentFromMessage(message, messageType); + stream = await downloadContentFromMessage(tmpMessage, messageType); } catch (error) { contDownload += 1; // eslint-disable-next-line no-await-in-loop, no-loop-func