whatsapp-store-db 1.3.49 → 1.3.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/handlers/contact.js
CHANGED
|
@@ -8,7 +8,8 @@ function contactHandler(sessionId, event, getJid = undefined) {
|
|
|
8
8
|
const logger = (0, shared_1.useLogger)();
|
|
9
9
|
let listening = false;
|
|
10
10
|
/**
|
|
11
|
-
* Validates that both sessionId and contact id are non-empty
|
|
11
|
+
* Validates that both sessionId and contact id are non-empty and properly formatted.
|
|
12
|
+
* Rejects @lid IDs that couldn't be resolved - these will be created by message handler later.
|
|
12
13
|
*/
|
|
13
14
|
const isValidContact = (id) => {
|
|
14
15
|
if (!sessionId || sessionId.trim() === '') {
|
|
@@ -17,6 +18,11 @@ function contactHandler(sessionId, event, getJid = undefined) {
|
|
|
17
18
|
if (!id || id.trim() === '') {
|
|
18
19
|
return false;
|
|
19
20
|
}
|
|
21
|
+
// Reject @lid IDs - if we couldn't resolve them, skip storing
|
|
22
|
+
// The message handler will create the contact with correct phone number when message arrives
|
|
23
|
+
if (id.endsWith('@lid')) {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
20
26
|
return true;
|
|
21
27
|
};
|
|
22
28
|
/**
|
package/dist/handlers/message.js
CHANGED
|
@@ -11,8 +11,11 @@ function messageHandler(sessionId, event, getJid = undefined) {
|
|
|
11
11
|
/**
|
|
12
12
|
* Upserts a Contact record from message data.
|
|
13
13
|
* This ensures contacts are created with the correct phone number at message time.
|
|
14
|
+
* Only uses contact info from incoming messages (fromMe = false) since pushName
|
|
15
|
+
* is the sender's name, not the recipient's.
|
|
14
16
|
*/
|
|
15
17
|
const upsertContactFromMessage = async (jid, message) => {
|
|
18
|
+
var _a;
|
|
16
19
|
// Skip if sessionId or jid is empty
|
|
17
20
|
if (!sessionId || sessionId.trim() === '' || !jid || jid.trim() === '') {
|
|
18
21
|
return;
|
|
@@ -21,6 +24,11 @@ function messageHandler(sessionId, event, getJid = undefined) {
|
|
|
21
24
|
if (jid.includes('@g.us') || jid.includes('@broadcast') || jid === 'status@broadcast') {
|
|
22
25
|
return;
|
|
23
26
|
}
|
|
27
|
+
// Only use contact info from incoming messages (fromMe = false)
|
|
28
|
+
// pushName is the SENDER's name, so for outgoing messages it's OUR name, not the contact's
|
|
29
|
+
if ((_a = message.key) === null || _a === void 0 ? void 0 : _a.fromMe) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
24
32
|
// Extract contact info from message
|
|
25
33
|
const pushName = message.pushName;
|
|
26
34
|
const verifiedBizName = message.verifiedBizName;
|