natureco-cli 1.0.43 → 1.0.44

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "natureco-cli",
3
- "version": "1.0.43",
3
+ "version": "1.0.44",
4
4
  "description": "NatureCo AI Bot Terminal Interface",
5
5
  "main": "bin/natureco.js",
6
6
  "bin": {
@@ -237,14 +237,32 @@ async function startWhatsAppProvider(sessionDir, config) {
237
237
  // Log raw message info
238
238
  log('whatsapp', `Raw message - fromMe: ${msg.key.fromMe}, remoteJid: ${msg.key.remoteJid}`, 'gray');
239
239
 
240
- const sender = msg.key.remoteJid?.split('@')[0].split(':')[0];
240
+ const remoteJid = msg.key.remoteJid || '';
241
+ const isLID = remoteJid.includes('@lid');
242
+
243
+ // Handle LID format (new WhatsApp format)
244
+ if (isLID) {
245
+ if (msg.key.fromMe) {
246
+ log('whatsapp', 'LID format detected, fromMe=true, accepting message', 'cyan');
247
+ } else {
248
+ log('whatsapp', 'LID format detected, fromMe=false, blocked', 'yellow');
249
+ continue;
250
+ }
251
+ }
252
+
253
+ // If fromMe and LID, accept without further checks (own conversation)
254
+ if (msg.key.fromMe && isLID) {
255
+ log('whatsapp', 'Own conversation (fromMe + LID), processing...', 'cyan');
256
+ }
257
+
258
+ const sender = remoteJid.split('@')[0].split(':')[0];
241
259
  const allowedNumbers = config.whatsappAllowedNumbers || [];
242
260
 
243
261
  // Log incoming number before access control
244
262
  log('whatsapp', `Incoming from: +${sender}, allowed: ${JSON.stringify(allowedNumbers)}`, 'gray');
245
263
 
246
- // Access control - compare last 10 digits
247
- if (allowedNumbers.length > 0 && !allowedNumbers.some(n => numberMatches(n, sender))) {
264
+ // Access control - compare last 10 digits (skip if fromMe + LID)
265
+ if (!(msg.key.fromMe && isLID) && allowedNumbers.length > 0 && !allowedNumbers.some(n => numberMatches(n, sender))) {
248
266
  log('whatsapp', `blocked message from +${sender} (not in allowed list)`, 'yellow');
249
267
  continue;
250
268
  }