From c7a4da748520b0a63460883f2ef7e53544bb83e3 Mon Sep 17 00:00:00 2001 From: Lei OT Date: Tue, 5 Nov 2024 11:26:08 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20WABA=20=E6=B6=88=E6=81=AF=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E7=BC=BA=E5=B0=91=E5=86=85=E5=AE=B9=E5=AF=B9=E8=B1=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/channel/bubbleMsgUtils.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/channel/bubbleMsgUtils.js b/src/channel/bubbleMsgUtils.js index 8d52b9e..71422e8 100644 --- a/src/channel/bubbleMsgUtils.js +++ b/src/channel/bubbleMsgUtils.js @@ -377,7 +377,7 @@ export const whatsappMsgTypeMapped = { }, system: { type: 'system', - data: (msg) => ({ id: msg.wamid, text: msg.system.body }), + data: (msg) => ({ id: msg.wamid, text: msg.system?.body }), }, text: { type: 'text', @@ -515,14 +515,14 @@ export const whatsappMsgTypeMapped = { data: (msg) => ({ id: msg.wamid, meetingID: msg.wamid, - title: msg.contacts.length === 1 ? `联系人` : `${msg.contacts.length} 位联系人`, - text: msg.contacts.map((ele) => `${(ele?.org?.company || '') +' '+ele.name.formatted_name}: ${ele.phones[0].wa_id || ele.phones[0].phone}`).join('\n'), - data: msg.contacts.map((ele) => ({ id: ele.phones[0]?.wa_id || ele.phones[0].phone, wa_id: ele.phones[0]?.wa_id || '', phone: ele.phones[0].phone, name: (ele?.org?.company || '') +' '+ele.name.formatted_name })), - waBtn: msg.contacts.some(ele => ele.phones.some(p => p.wa_id)), + title: (msg.contacts || []).length === 1 ? `联系人` : `${(msg.contacts || []).length} 位联系人`, + text: (msg.contacts || []).map((ele) => `${(ele?.org?.company || '') +' '+ele.name.formatted_name}: ${ele.phones[0].wa_id || ele.phones[0].phone}`).join('\n'), + data: (msg.contacts || []).map((ele) => ({ id: ele.phones[0]?.wa_id || ele.phones[0].phone, wa_id: ele.phones[0]?.wa_id || '', phone: ele.phones[0].phone, name: (ele?.org?.company || '') +' '+ele.name.formatted_name })), + waBtn: (msg.contacts || []).some(ele => ele.phones.some(p => p.wa_id)), }), renderForReply: (msg) => ({ id: msg.wamid, - message: '[联系人] ' + msg.contacts[0].name.formatted_name + '...', + message: '[联系人] ' + msg.contacts?.[0].name.formatted_name + '...', }), }, location: {