WhiskeySockets / Baileys

Lightweight full-featured typescript/javascript WhatsApp Web API
https://baileys.whiskeysockets.io/
MIT License
3.6k stars 1.21k forks source link

node?.attrs?.jid ??? but not found jid #931

Closed jianhuihi closed 2 weeks ago

jianhuihi commented 1 month ago

https://github.com/WhiskeySockets/Baileys/blob/5bdfc631058fdb0f7a83b6865339b134a3f62453/src/Socket/messages-recv.ts#L397C1-L398C1

Baileys/src/Socket/messages-recv.ts

node value { tag: 'notification', attrs: { from: 'xxxx@s.whatsapp.net', type: 'picture', id: 'xxx', notify: 'xxx', t: '1721294595' }, content: [ { tag: 'set', attrs: [Object], content: undefined } ] }

            const setPicture = getBinaryNodeChild(node, 'set')
            const delPicture = getBinaryNodeChild(node, 'delete')
            ev.emit('contacts.update', [{
                id: jidNormalizedUser(node?.attrs?.jid) || ((setPicture || delPicture)?.attrs?.hash) || '',
                imgUrl: setPicture ? 'changed' : 'removed'
            }])

id: jidNormalizedUser(node?.attrs?.jid) || ((setPicture || delPicture)?.attrs?.hash) || '',

result is ''

jianhuihi commented 1 month ago

id: jidNormalizedUser(node?.attrs?.jid) >>

id: jidNormalizedUser(node?.attrs?.jid) || from || ((setPicture || delPicture)?.attrs?.hash) || '',

bobslavtriev commented 1 month ago

https://github.com/WhiskeySockets/Baileys/pull/906