@crysnovax/baileys 2.6.5 → 2.6.6

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.
@@ -1400,7 +1400,7 @@ export const makeMessagesSocket = (config) => {
1400
1400
  }
1401
1401
  return fullMsg;
1402
1402
  }
1403
- // crysnovax@LikeThis --- likeThis:true relays the message object exactly as-is,
1403
+ // crysnovax@LikeThis --- likeThis:true relays the message object exactly as-is,
1404
1404
  // bypassing generateWAMessage/generateWAMessageContent entirely.
1405
1405
  // No re-encoding, no normalization, no transformation — what you pass is what WA gets.
1406
1406
  //
@@ -1448,20 +1448,18 @@ export const makeMessagesSocket = (config) => {
1448
1448
  }
1449
1449
  return fullMsg;
1450
1450
  }
1451
- ...(httpRequestOptions || {})
1452
- },
1453
- logger,
1454
- uploadImage: generateHighQualityLinkPreview ? waUploadToServer : undefined
1455
- }),
1456
- //TODO: CACHE
1457
- getProfilePicUrl: sock.profilePictureUrl,
1458
- getCallLink: sock.createCallLink,
1451
+ // ── NORMAL MESSAGE HANDLING ──
1452
+ else {
1453
+ const fullMsg = await generateWAMessage(jid, content, {
1454
+ logger,
1455
+ userJid,
1459
1456
  upload: waUploadToServer,
1460
1457
  mediaCache: config.mediaCache,
1461
1458
  options: config.options,
1462
1459
  ...options,
1463
1460
  messageId: generateMessageIDV2(userJid)
1464
1461
  });
1462
+
1465
1463
  const isNewsletter = isJidNewsletter(jid);
1466
1464
  const isEventMsg = 'event' in content && !!content.event;
1467
1465
  const isDeleteMsg = 'delete' in content && !!content.delete;
@@ -1474,9 +1472,8 @@ export const makeMessagesSocket = (config) => {
1474
1472
  const isNeedBizAttrs = 'secureMetaServiceLabel' in content && !!content.secureMetaServiceLabel;
1475
1473
  const additionalAttributes = options.additionalAttributes || {};
1476
1474
  const additionalNodes = options.additionalNodes || [];
1477
- // required for delete
1475
+
1478
1476
  if (isDeleteMsg || isKeepMsg) {
1479
- // if the chat is a group, and I am not the author, then delete the message as an admin
1480
1477
  if (isJidGroup(content.delete?.remoteJid) && !content.delete?.fromMe) {
1481
1478
  additionalAttributes.edit = '8';
1482
1479
  }
@@ -1497,7 +1494,6 @@ export const makeMessagesSocket = (config) => {
1497
1494
  additionalNodes.push({
1498
1495
  tag: 'meta',
1499
1496
  attrs: {
1500
- // Lia@Note 08-02-26 --- Still a hypothesis regarding PollResult ༎ຶ⁠‿⁠༎ຶ
1501
1497
  polltype: isQuizMsg ? 'quiz_creation' : 'creation',
1502
1498
  contenttype: isPollMsg && isNewsletter ? 'text' : undefined
1503
1499
  },
@@ -1513,7 +1509,6 @@ export const makeMessagesSocket = (config) => {
1513
1509
  content: undefined
1514
1510
  });
1515
1511
  }
1516
- // Lia@Changes 30-01-26 --- Add support for AI label in message when "ai" is true, but works only in private chat
1517
1512
  else if (isAiMsg) {
1518
1513
  if (!(isPnUser(jid) || isLidUser(jid))) {
1519
1514
  throw new Boom('AI icon on message are only allowed in private chat', { statusCode: 400 });
@@ -1521,7 +1516,6 @@ export const makeMessagesSocket = (config) => {
1521
1516
  if ('messageContextInfo' in fullMsg.message && !!fullMsg.message.messageContextInfo) {
1522
1517
  fullMsg.message.messageContextInfo.supportPayload = BIZ_BOT_SUPPORT_PAYLOAD;
1523
1518
  }
1524
- ;
1525
1519
  additionalNodes.push({
1526
1520
  tag: 'bot',
1527
1521
  attrs: {
@@ -1531,6 +1525,7 @@ export const makeMessagesSocket = (config) => {
1531
1525
  });
1532
1526
  delete content.ai;
1533
1527
  }
1528
+
1534
1529
  await relayMessage(jid, fullMsg.message, {
1535
1530
  messageId: fullMsg.key.id,
1536
1531
  useCachedGroupMetadata: options.useCachedGroupMetadata,
@@ -1539,13 +1534,14 @@ export const makeMessagesSocket = (config) => {
1539
1534
  additionalAttributes,
1540
1535
  additionalNodes
1541
1536
  });
1537
+
1542
1538
  if (config.emitOwnEvents) {
1543
1539
  process.nextTick(async () => {
1544
1540
  await messageMutex.mutex(() => upsertMessage(fullMsg, 'append'));
1545
1541
  });
1546
1542
  }
1547
- // Lia@Changes 31-01-26 --- Add support for album messages
1548
- // Lia@Note 06-02-26 --- Refactored to reduce high RSS usage (⁠╥⁠﹏⁠╥⁠)
1543
+
1544
+ // ── ALBUM MESSAGES ──
1549
1545
  if ('album' in content) {
1550
1546
  const { delayMs = 1500 } = options;
1551
1547
  for (const albumMedia of content.album) {
@@ -1582,8 +1578,9 @@ export const makeMessagesSocket = (config) => {
1582
1578
  await delay(delayMs);
1583
1579
  }
1584
1580
  }
1581
+
1585
1582
  return fullMsg;
1586
1583
  }
1587
1584
  }
1588
- };
1589
- };
1585
+ }
1586
+ };