From b0909c03ebffeb64f5a924f7523e8374c7ea649c Mon Sep 17 00:00:00 2001 From: Adhiraj Singh Date: Fri, 20 Aug 2021 17:05:58 +0530 Subject: [PATCH] contact upsert fix --- src/Connection/chats.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Connection/chats.ts b/src/Connection/chats.ts index 3cf8c34..8d7d2b0 100644 --- a/src/Connection/chats.ts +++ b/src/Connection/chats.ts @@ -229,10 +229,9 @@ const makeChatsSocket = (config: SocketConfig) => { } }) - socketEvents.on ('CB:action,,user', json => { - const node = json[2][0] - if (node) { - const user = node[1] as Contact + socketEvents.on('CB:action,,user', (json: BinaryNode) => { + if(Array.isArray(json.data)) { + const user = json.data[0].attributes as any as Contact user.jid = whatsappID(user.jid) ev.emit('contacts.upsert', [user])