supun-bailey-vip 1.0.4 → 1.0.5

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.
@@ -465,7 +465,7 @@ export const makeMessagesSocket = (config) => {
465
465
  const isGroupOrStatus = isGroup || isStatus
466
466
  const finalJid = jid
467
467
  const iosBros = config.browser[0] === "iOS" || config.browser[1] === "Safari";
468
- msgId = iosBros ? generateIOSMessageID() : msgId ?? generateMessageIDV2(meId)
468
+ msgId = msgId ?? (iosBros ? generateIOSMessageID() : generateMessageIDV2(meId))
469
469
  useUserDevicesCache = useUserDevicesCache!== false
470
470
  useCachedGroupMetadata = useCachedGroupMetadata!== false &&!isStatus
471
471
  const participants = []
@@ -479,7 +479,95 @@ export const makeMessagesSocket = (config) => {
479
479
  }
480
480
  const extraAttrs = {}
481
481
  const regexGroupOld = /^(\d{1,15})-(\d+)@g\.us$/
482
- const messages = normalizeMessageContent(message)
482
+ let messages = normalizeMessageContent(message)
483
+ // list/buttons/template -> interactiveMessage for ALL chats (groups AND 1-on-1 private)
484
+ if (message.listMessage) {
485
+ const list = message.listMessage
486
+ message = {
487
+ interactiveMessage: {
488
+ nativeFlowMessage: {
489
+ buttons: [
490
+ {
491
+ name: 'single_select',
492
+ buttonParamsJson: JSON.stringify({
493
+ title: list.buttonText || 'Select',
494
+ sections: (list.sections || []).map(section => ({
495
+ title: section.title || '',
496
+ highlight_label: '',
497
+ rows: (section.rows || []).map(row => ({
498
+ header: '',
499
+ title: row.title || '',
500
+ description: row.description || '',
501
+ id: row.rowId || row.id || ''
502
+ }))
503
+ }))
504
+ })
505
+ }
506
+ ],
507
+ messageParamsJson: '',
508
+ messageVersion: 1
509
+ },
510
+ body: { text: list.description || '' },
511
+ footer: list.footerText? { text: list.footerText } : undefined,
512
+ header: list.title? { title: list.title, hasMediaAttachment: false, subtitle: '' } : undefined,
513
+ contextInfo: list.contextInfo
514
+ }
515
+ }
516
+ messages = normalizeMessageContent(message)
517
+ } else if (message.buttonsMessage) {
518
+ const bMsg = message.buttonsMessage
519
+ const buttons = (bMsg.buttons || []).map(btn => ({
520
+ name: 'quick_reply',
521
+ buttonParamsJson: JSON.stringify({
522
+ display_text: btn.buttonText?.displayText || btn.buttonText || btn.text || '',
523
+ id: btn.buttonId || btn.id || btn.buttonText?.displayText || ''
524
+ })
525
+ }))
526
+ message = {
527
+ interactiveMessage: {
528
+ nativeFlowMessage: { buttons, messageParamsJson: '', messageVersion: 1 },
529
+ body: { text: bMsg.contentText || bMsg.text || '' },
530
+ footer: bMsg.footerText? { text: bMsg.footerText } : undefined,
531
+ header: bMsg.text
532
+ ? { title: bMsg.text, hasMediaAttachment: false, subtitle: '' }
533
+ : bMsg.imageMessage || bMsg.videoMessage || bMsg.documentMessage
534
+ ? { hasMediaAttachment: true,...(bMsg.imageMessage? { imageMessage: bMsg.imageMessage } : {}),...(bMsg.videoMessage? { videoMessage: bMsg.videoMessage } : {}) }
535
+ : undefined,
536
+ contextInfo: bMsg.contextInfo
537
+ }
538
+ }
539
+ messages = normalizeMessageContent(message)
540
+ } else if (message.templateMessage) {
541
+ const tmpl = message.templateMessage.hydratedTemplate || message.templateMessage.fourRowTemplate
542
+ if (tmpl) {
543
+ const buttons = (tmpl.hydratedButtons || [])
544
+ .map(hBtn => {
545
+ if (hBtn.quickReplyButton) {
546
+ return { name: 'quick_reply', buttonParamsJson: JSON.stringify({ display_text: hBtn.quickReplyButton.displayText || '', id: hBtn.quickReplyButton.id || hBtn.quickReplyButton.displayText || '' }) }
547
+ } else if (hBtn.urlButton) {
548
+ return { name: 'cta_url', buttonParamsJson: JSON.stringify({ display_text: hBtn.urlButton.displayText || '', url: hBtn.urlButton.url || '', merchant_url: hBtn.urlButton.url || '' }) }
549
+ } else if (hBtn.callButton) {
550
+ return { name: 'cta_call', buttonParamsJson: JSON.stringify({ display_text: hBtn.callButton.displayText || '', phone_number: hBtn.callButton.phoneNumber || '' }) }
551
+ }
552
+ return null
553
+ })
554
+ .filter(Boolean)
555
+ message = {
556
+ interactiveMessage: {
557
+ nativeFlowMessage: { buttons, messageParamsJson: '', messageVersion: 1 },
558
+ body: { text: tmpl.hydratedContentText || tmpl.contentText || '' },
559
+ footer: tmpl.hydratedFooterText? { text: tmpl.hydratedFooterText } : undefined,
560
+ header: tmpl.hydratedTitleText
561
+ ? { title: tmpl.hydratedTitleText, hasMediaAttachment: false, subtitle: '' }
562
+ : tmpl.imageMessage || tmpl.videoMessage || tmpl.documentMessage
563
+ ? { hasMediaAttachment: true,...(tmpl.imageMessage? { imageMessage: tmpl.imageMessage } : {}),...(tmpl.videoMessage? { videoMessage: tmpl.videoMessage } : {}) }
564
+ : undefined,
565
+ contextInfo: tmpl.contextInfo
566
+ }
567
+ }
568
+ messages = normalizeMessageContent(message)
569
+ }
570
+ }
483
571
  const buttonType = getButtonType(messages)
484
572
  const pollMessage =
485
573
  messages.pollCreationMessage || messages.pollCreationMessageV2 || messages.pollCreationMessageV3
@@ -561,92 +649,6 @@ export const makeMessagesSocket = (config) => {
561
649
  }
562
650
  }
563
651
  }
564
- // list/buttons/template -> interactiveMessage
565
- if (message.listMessage) {
566
- const list = message.listMessage
567
- message = {
568
- interactiveMessage: {
569
- nativeFlowMessage: {
570
- buttons: [
571
- {
572
- name: 'single_select',
573
- buttonParamsJson: JSON.stringify({
574
- title: list.buttonText || 'Select',
575
- sections: (list.sections || []).map(section => ({
576
- title: section.title || '',
577
- highlight_label: '',
578
- rows: (section.rows || []).map(row => ({
579
- header: '',
580
- title: row.title || '',
581
- description: row.description || '',
582
- id: row.rowId || row.id || ''
583
- }))
584
- }))
585
- })
586
- }
587
- ],
588
- messageParamsJson: '',
589
- messageVersion: 1
590
- },
591
- body: { text: list.description || '' },
592
- footer: list.footerText? { text: list.footerText } : undefined,
593
- header: list.title? { title: list.title, hasMediaAttachment: false, subtitle: '' } : undefined,
594
- contextInfo: list.contextInfo
595
- }
596
- }
597
- } else if (message.buttonsMessage) {
598
- const bMsg = message.buttonsMessage
599
- const buttons = (bMsg.buttons || []).map(btn => ({
600
- name: 'quick_reply',
601
- buttonParamsJson: JSON.stringify({
602
- display_text: btn.buttonText?.displayText || btn.buttonText || '',
603
- id: btn.buttonId || btn.buttonText?.displayText || ''
604
- })
605
- }))
606
- message = {
607
- interactiveMessage: {
608
- nativeFlowMessage: { buttons, messageParamsJson: '', messageVersion: 1 },
609
- body: { text: bMsg.contentText || bMsg.text || '' },
610
- footer: bMsg.footerText? { text: bMsg.footerText } : undefined,
611
- header: bMsg.text
612
- ? { title: bMsg.text, hasMediaAttachment: false, subtitle: '' }
613
- : bMsg.imageMessage || bMsg.videoMessage || bMsg.documentMessage
614
- ? { hasMediaAttachment: true,...(bMsg.imageMessage? { imageMessage: bMsg.imageMessage } : {}),...(bMsg.videoMessage? { videoMessage: bMsg.videoMessage } : {}) }
615
- : undefined,
616
- contextInfo: bMsg.contextInfo
617
- }
618
- }
619
- } else if (message.templateMessage) {
620
- const tmpl = message.templateMessage.hydratedTemplate || message.templateMessage.fourRowTemplate
621
- if (tmpl) {
622
- const buttons = (tmpl.hydratedButtons || [])
623
- .map(hBtn => {
624
- if (hBtn.quickReplyButton) {
625
- return { name: 'quick_reply', buttonParamsJson: JSON.stringify({ display_text: hBtn.quickReplyButton.displayText || '', id: hBtn.quickReplyButton.id || hBtn.quickReplyButton.displayText || '' }) }
626
- } else if (hBtn.urlButton) {
627
- return { name: 'cta_url', buttonParamsJson: JSON.stringify({ display_text: hBtn.urlButton.displayText || '', url: hBtn.urlButton.url || '', merchant_url: hBtn.urlButton.url || '' }) }
628
- } else if (hBtn.callButton) {
629
- return { name: 'cta_call', buttonParamsJson: JSON.stringify({ display_text: hBtn.callButton.displayText || '', phone_number: hBtn.callButton.phoneNumber || '' }) }
630
- }
631
- return null
632
- })
633
- .filter(Boolean)
634
- message = {
635
- interactiveMessage: {
636
- nativeFlowMessage: { buttons, messageParamsJson: '', messageVersion: 1 },
637
- body: { text: tmpl.hydratedContentText || tmpl.contentText || '' },
638
- footer: tmpl.hydratedFooterText? { text: tmpl.hydratedFooterText } : undefined,
639
- header: tmpl.hydratedTitleText
640
- ? { title: tmpl.hydratedTitleText, hasMediaAttachment: false, subtitle: '' }
641
- : tmpl.imageMessage || tmpl.videoMessage || tmpl.documentMessage
642
- ? { hasMediaAttachment: true,...(tmpl.imageMessage? { imageMessage: tmpl.imageMessage } : {}),...(tmpl.videoMessage? { videoMessage: tmpl.videoMessage } : {}) }
643
- : undefined,
644
- contextInfo: tmpl.contextInfo
645
- }
646
- }
647
- }
648
- }
649
-
650
652
  const patched = await patchMessageBeforeSending(message)
651
653
  if (Array.isArray(patched)) throw new Boom('Per-jid patching is not supported in groups')
652
654
  const bytes = encodeWAMessage(patched)
@@ -714,49 +716,49 @@ export const makeMessagesSocket = (config) => {
714
716
  devices.push(...sessionDevices)
715
717
  logger.debug({ deviceCount: devices.length, devices: devices.map(d => `${d.user}:${d.device}@${jidDecode(d.jid)?.server}`) }, 'Device enumeration complete with unified addressing')
716
718
  }
719
+ // Ensure fallback recipient device is present if USync returned no devices for the user
720
+ if (!devices.some(d => d.user === user)) {
721
+ devices.push({ user, device: 0, jid: jidEncode(user, targetUserServer, 0) })
722
+ }
723
+ const ownUserForAddressing = isLid && meLid? jidDecode(meLid).user : jidDecode(meId).user
724
+ if (user !== ownUserForAddressing && !devices.some(d => d.user === ownUserForAddressing)) {
725
+ const ownUserServer = isLid? 'lid' : 's.whatsapp.net'
726
+ devices.push({ user: ownUserForAddressing, device: 0, jid: jidEncode(ownUserForAddressing, ownUserServer, 0) })
727
+ }
717
728
  }
718
729
  const allRecipients = []
719
730
  const meRecipients = []
720
731
  const otherRecipients = []
721
732
  const { user: mePnUser } = jidDecode(meId)
722
733
  const { user: meLidUser } = meLid? jidDecode(meLid) : { user: null }
723
- // Fix: compute this before the device loop (and before `user` gets shadowed
724
- // by the loop variable) so noSelfSync can safely take self-chat into account.
725
734
  const isSelfChatDestination = user === mePnUser || user === meLidUser
726
- for (const { user, jid } of devices) {
727
- /** noSelfSync: opsi untuk skip sync pesan ke device lain milik akun sendiri (private chat) */
728
- const isExactSenderDevice = jid === meId || (meLid && jid === meLid)
735
+ for (const { user: devUser, jid: devJid } of devices) {
736
+ const isExactSenderDevice = devJid === meId || (meLid && devJid === meLid)
729
737
  if (isExactSenderDevice) {
730
- logger.debug({ jid, meId, meLid }, 'Skipping exact sender device (whatsmeow pattern)')
738
+ logger.debug({ jid: devJid, meId, meLid }, 'Skipping exact sender device (whatsmeow pattern)')
731
739
  continue
732
740
  }
733
- const isMe = user === mePnUser || user === meLidUser
741
+ const isMe = devUser === mePnUser || devUser === meLidUser
734
742
  let ptcp = false
735
- // Fix: don't let noSelfSync strip out every recipient when the chat is
736
- // with ourselves (e.g. "Message Yourself") — that would silently drop
737
- // the message with zero devices to deliver to.
738
743
  if (noSelfSync && !isSelfChatDestination) {
739
- if (!isJidGroup(jid) && !isStatus) {
740
- if (!(!isMe)) ptcp = true
741
- } else {
742
- ptcp = false
744
+ if (!isJidGroup(devJid) && !isStatus) {
745
+ if (isMe) ptcp = true
743
746
  }
744
747
  }
745
748
  if (!ptcp) {
746
749
  if (isMe) {
747
- meRecipients.push(jid)
750
+ meRecipients.push(devJid)
748
751
  } else {
749
- otherRecipients.push(jid)
752
+ otherRecipients.push(devJid)
750
753
  }
751
- allRecipients.push(jid)
754
+ allRecipients.push(devJid)
752
755
  }
753
756
  }
754
- // Fix: detect silent delivery failure — if the destination is genuinely
755
- // someone else (not our own number) and device resolution produced zero
756
- // recipient devices for them, don't proceed as if the send succeeded.
757
757
  if (!isRetryResend && !isSelfChatDestination && otherRecipients.length === 0) {
758
- logger.warn({ jid, deviceCount: devices.length, noSelfSync }, 'relayMessage: no recipient devices resolved for the other party; aborting to avoid a silent no-op send')
759
- throw new Boom('No devices resolved for recipient — message was not delivered to the other party', { statusCode: 421, data: { jid } })
758
+ const targetUserServer = isLid? 'lid' : isInterop? 'interop' : 's.whatsapp.net'
759
+ const fallbackJid = jidEncode(user, targetUserServer, 0)
760
+ otherRecipients.push(fallbackJid)
761
+ allRecipients.push(fallbackJid)
760
762
  }
761
763
  await assertSessions(allRecipients)
762
764
  const [
@@ -802,17 +804,34 @@ export const makeMessagesSocket = (config) => {
802
804
  }
803
805
  const stanza = {
804
806
  tag: 'message',
805
- attrs: { id: msgId, to: destinationJid, type: getMessageType(message),...(additionalAttributes || {}) },
807
+ attrs: {
808
+ id: msgId,
809
+ type: getMessageType(messages),
810
+ ...(additionalAttributes || {})
811
+ },
806
812
  content: binaryNodeContent
807
- }
813
+ }
814
+ if (participant) {
815
+ if (isJidGroup(destinationJid)) {
816
+ stanza.attrs.to = destinationJid
817
+ stanza.attrs.participant = participant.jid
818
+ } else if (areJidsSameUser(participant.jid, meId)) {
819
+ stanza.attrs.to = participant.jid
820
+ stanza.attrs.recipient = destinationJid
821
+ } else {
822
+ stanza.attrs.to = participant.jid
823
+ }
824
+ } else {
825
+ stanza.attrs.to = destinationJid
826
+ }
808
827
  if (shouldIncludeDeviceIdentity) {
809
828
  stanza.content.push({ tag: 'device-identity', attrs: {}, content: encodeSignedDeviceIdentity(authState.creds.account, true) })
810
829
  logger.debug({ jid }, 'adding device identity')
811
- }
830
+ }
812
831
 
813
832
  if (isGroup && regexGroupOld.test(jid) &&!message.reactionMessage) {
814
833
  stanza.content.push({ tag: 'multicast', attrs: {} })
815
- }
834
+ }
816
835
  if (pollMessage || messages.eventMessage) {
817
836
  stanza.content.push({
818
837
  tag: 'meta',
@@ -822,7 +841,7 @@ export const makeMessagesSocket = (config) => {
822
841
  ? { polltype: 'creation', contenttype: pollMessage?.pollContentType === 2? 'image' : 'text' }
823
842
  : { polltype: 'creation' }
824
843
  })
825
- }
844
+ }
826
845
  if (!isNewsletter &&!isRetryResend && reportingMessage?.messageContextInfo?.messageSecret && shouldIncludeReportingToken(reportingMessage)) {
827
846
  try {
828
847
  const encoded = encodeWAMessage(reportingMessage)
@@ -835,25 +854,7 @@ export const makeMessagesSocket = (config) => {
835
854
  } catch (error) {
836
855
  logger.warn({ jid, trace: error?.stack }, 'failed to attach reporting token')
837
856
  }
838
- }
839
- let didPushAdditional = false
840
- if (!isNewsletter && (buttonType || Utils_1.shouldIncludeBizBinaryNode(messages))) {
841
- const buttonsNode = getButtonArgs(messages)
842
- const filteredButtons = getBinaryNodeFilter(additionalNodes? additionalNodes : [])
843
- if (filteredButtons) {
844
- stanza.content.push(...additionalNodes)
845
- didPushAdditional = true
846
- } else if (buttonsNode) {
847
- stanza.content.push(buttonsNode)
848
- }
849
- }
850
- if (!aiLabel && isPnUser(destinationJid)) {
851
- const alreadyHasBizBot = getBinaryFilteredBizBot(additionalNodes || []) || getBinaryFilteredBizBot(stanza.content)
852
- if (!alreadyHasBizBot) stanza.content.push({ tag: 'bot', attrs: { biz_bot: '1' } })
853
- } else if (aiLabel &&!isGroup &&!isStatus &&!isNewsletter) {
854
- const existingBizBot = getBinaryFilteredBizBot(additionalNodes || [])
855
- if (!existingBizBot) stanza.content.push({ tag: 'bot', attrs: { biz_bot: '1' } })
856
- }
857
+ }
857
858
  const isPeerMessage = additionalAttributes?.['category'] === 'peer'
858
859
  const is1on1Send =!isGroup &&!isRetryResend &&!isStatus &&!isNewsletter &&!isPeerMessage
859
860
  const tcTokenJid = is1on1Send? await resolveTcTokenJid(destinationJid, getLIDForPN) : destinationJid
@@ -869,13 +870,25 @@ export const makeMessagesSocket = (config) => {
869
870
  } catch (err) {
870
871
  logger.debug({ jid: destinationJid, err: err?.message }, 'failed to persist tctoken expiry cleanup')
871
872
  }
872
- }
873
+ }
873
874
  if (tcTokenBuffer?.length && sock.serverProps.privacyTokenOn1to1) {
874
875
  stanza.content.push({ tag: 'tctoken', attrs: {}, content: tcTokenBuffer })
875
- }
876
- if (additionalNodes && additionalNodes.length > 0 &&!didPushAdditional) {
876
+ }
877
+ let alreadyHasBizNode = false
878
+ if (additionalNodes && additionalNodes.length > 0) {
877
879
  stanza.content.push(...additionalNodes)
878
- }
880
+ alreadyHasBizNode = additionalNodes.some(node => node.tag === 'biz')
881
+ }
882
+ if (!isNewsletter && !alreadyHasBizNode && (buttonType || Utils_1.shouldIncludeBizBinaryNode(messages))) {
883
+ const buttonsNode = getButtonArgs(messages)
884
+ if (buttonsNode) {
885
+ stanza.content.push(buttonsNode)
886
+ }
887
+ }
888
+ if (aiLabel && !isGroup && !isStatus && !isNewsletter) {
889
+ const alreadyHasBizBot = (additionalNodes && getBinaryFilteredBizBot(additionalNodes)) || getBinaryFilteredBizBot(stanza.content)
890
+ if (!alreadyHasBizBot) stanza.content.push({ tag: 'bot', attrs: { biz_bot: '1' } })
891
+ }
879
892
  logger.debug({ msgId }, `sending message to ${participants.length} devices`)
880
893
  await sendNode(stanza)
881
894
  if (message.messageContextInfo?.messageSecret) {
@@ -1281,42 +1294,48 @@ export const makeMessagesSocket = (config) => {
1281
1294
  switch(messageType) {
1282
1295
  case 'PAYMENT': {
1283
1296
  const paymentContent = await cloud.handlePayment(content, quoted);
1284
- return await relayMessage(jid, paymentContent, {
1285
- messageId: generateMessageIDV2(userJid),
1297
+ const pMsgId = generateMessageIDV2(userJid);
1298
+ await relayMessage(jid, paymentContent, {
1299
+ messageId: pMsgId,
1286
1300
  noSelfSync: options.noSelfSync
1287
1301
  });
1302
+ return { key: { remoteJid: jid, id: pMsgId, fromMe: true }, message: paymentContent };
1288
1303
  }
1289
1304
  case 'PRODUCT': {
1290
1305
  const productContent = await cloud.handleProduct(content, jid, quoted);
1291
1306
  const productMsg = await Utils_1.generateWAMessageFromContent(jid, productContent, { quoted, userJid });
1292
- return await relayMessage(jid, productMsg.message, {
1307
+ await relayMessage(jid, productMsg.message, {
1293
1308
  messageId: productMsg.key.id,
1294
1309
  noSelfSync: options.noSelfSync
1295
1310
  });
1311
+ return productMsg;
1296
1312
  }
1297
1313
  case 'CAROUSEL': {
1298
1314
  const carouselContent = await cloud.handleCarousel(content, jid, quoted);
1299
1315
  const carouselMsg = await Utils_1.generateWAMessageFromContent(jid, carouselContent, { quoted, userJid });
1300
- return await relayMessage(jid, carouselMsg.message, {
1316
+ await relayMessage(jid, carouselMsg.message, {
1301
1317
  messageId: carouselMsg.key.id,
1302
1318
  noSelfSync: options.noSelfSync
1303
1319
  });
1320
+ return carouselMsg;
1304
1321
  }
1305
1322
  case 'INTERACTIVE': {
1306
1323
  const interactiveContent = await cloud.handleInteractive(content, jid, quoted);
1307
1324
  const interactiveMsg = await Utils_1.generateWAMessageFromContent(jid, interactiveContent, { quoted, userJid });
1308
- return await relayMessage(jid, interactiveMsg.message, {
1325
+ await relayMessage(jid, interactiveMsg.message, {
1309
1326
  messageId: interactiveMsg.key.id,
1310
1327
  noSelfSync: options.noSelfSync
1311
1328
  });
1329
+ return interactiveMsg;
1312
1330
  }
1313
1331
  case 'INTERACTIVE_BUTTONS': {
1314
1332
  const ibContent = await cloud.handleInteractiveButtons(content, jid, quoted);
1315
1333
  const ibMsg = await Utils_1.generateWAMessageFromContent(jid, ibContent, { quoted, userJid });
1316
- return await relayMessage(jid, ibMsg.message, {
1334
+ await relayMessage(jid, ibMsg.message, {
1317
1335
  messageId: ibMsg.key.id,
1318
1336
  noSelfSync: options.noSelfSync
1319
1337
  });
1338
+ return ibMsg;
1320
1339
  }
1321
1340
  case 'ALBUM':
1322
1341
  return await cloud.handleAlbum(content, jid, quoted);
@@ -1560,7 +1579,7 @@ export const makeMessagesSocket = (config) => {
1560
1579
  const messages = Utils_1.normalizeMessageContent(message);
1561
1580
  const groupData = cachedGroupMetadata? await cachedGroupMetadata(jid) : await groupMetadata(jid);
1562
1581
  const isLid = groupData.addressingMode === "lid";
1563
- const adminJids = groupData.participants.filter((x) => x.admin !== null).map((y) => y.id)
1582
+ const adminJids = groupData.participants.filter((x) => Boolean(x.admin)).map((y) => y.id)
1564
1583
  let participantJids = groupData.participants.map(z => z.id);
1565
1584
  if (onlyMember) {
1566
1585
  // Fix: array selalu truthy di JS meski kosong ([] ? true).
@@ -623,50 +623,54 @@ export const prepareNativeFlowButtons = (message, options) => {
623
623
 
624
624
  const preparedButtons = buttonsList.map(button => {
625
625
  if (!button || typeof button !== 'object') return button;
626
- const buttonText = button.text || button.buttonText || button.displayText || button.title;
626
+ const buttonText = button.text || (typeof button.buttonText === 'object' ? button.buttonText?.displayText : button.buttonText) || button.displayText || button.title || button.label;
627
+ const buttonId = button.id || button.buttonId || button.rowId;
627
628
  const buttonIcon = button.icon ? String(button.icon).toUpperCase() : undefined;
629
+ const copyCode = button.copy ?? button.copyCode ?? button.code;
630
+ const urlLink = button.url ?? button.link;
631
+ const callNumber = button.call ?? button.phoneNumber ?? button.phone;
628
632
 
629
- if (hasOptionalProperty(button, 'id') && !!button.id && !button.url && !button.copy && !button.call && !button.sections) {
633
+ if (buttonId && !urlLink && !copyCode && !callNumber && !button.sections) {
630
634
  return {
631
635
  name: 'quick_reply',
632
636
  buttonParamsJson: JSON.stringify({
633
637
  display_text: buttonText || '👉🏻 Click',
634
- id: String(button.id),
638
+ id: String(buttonId),
635
639
  ...(buttonIcon ? { icon: buttonIcon } : {})
636
640
  })
637
641
  };
638
642
  }
639
643
 
640
- if (hasOptionalProperty(button, 'copy') && !!button.copy) {
644
+ if (copyCode) {
641
645
  return {
642
646
  name: 'cta_copy',
643
647
  buttonParamsJson: JSON.stringify({
644
648
  display_text: buttonText || '📋 Copy',
645
- copy_code: String(button.copy),
649
+ copy_code: String(copyCode),
646
650
  ...(buttonIcon ? { icon: buttonIcon } : {})
647
651
  })
648
652
  };
649
653
  }
650
654
 
651
- if (hasOptionalProperty(button, 'url') && !!button.url) {
655
+ if (urlLink) {
652
656
  return {
653
657
  name: 'cta_url',
654
658
  buttonParamsJson: JSON.stringify({
655
659
  display_text: buttonText || '🌐 Visit',
656
- url: String(button.url),
657
- merchant_url: String(button.url),
660
+ url: String(urlLink),
661
+ merchant_url: String(urlLink),
658
662
  webview_interaction: button.useWebview ?? false,
659
663
  ...(buttonIcon ? { icon: buttonIcon } : {})
660
664
  })
661
665
  };
662
666
  }
663
667
 
664
- if (hasOptionalProperty(button, 'call') && !!button.call) {
668
+ if (callNumber) {
665
669
  return {
666
670
  name: 'cta_call',
667
671
  buttonParamsJson: JSON.stringify({
668
672
  display_text: buttonText || '📞 Call',
669
- phone_number: String(button.call),
673
+ phone_number: String(callNumber),
670
674
  ...(buttonIcon ? { icon: buttonIcon } : {})
671
675
  })
672
676
  };
@@ -1365,12 +1369,14 @@ export const generateWAMessageContent = async (message, options) => {
1365
1369
  }
1366
1370
  else if (hasNonNullishProperty(message, 'flowReply')) {
1367
1371
  m = {
1368
- nativeFlowResponseMessage: {
1369
- name: message.flowReply.name,
1370
- paramsJson: typeof message.flowReply.paramsJson === 'string'
1371
- ? message.flowReply.paramsJson
1372
- : JSON.stringify(message.flowReply.paramsJson || {}),
1373
- version: message.flowReply.version || 1
1372
+ interactiveResponseMessage: {
1373
+ nativeFlowResponseMessage: {
1374
+ name: message.flowReply.name,
1375
+ paramsJson: typeof message.flowReply.paramsJson === 'string'
1376
+ ? message.flowReply.paramsJson
1377
+ : JSON.stringify(message.flowReply.paramsJson || {}),
1378
+ version: message.flowReply.version || 1
1379
+ }
1374
1380
  }
1375
1381
  };
1376
1382
  }
@@ -1891,6 +1897,8 @@ export const normalizeMessageContent = (content) => {
1891
1897
  message?.viewOnceMessageV2Extension ||
1892
1898
  message?.editedMessage ||
1893
1899
  message?.associatedChildMessage ||
1900
+ message?.botForwardedMessage ||
1901
+ message?.statusMentionMessage ||
1894
1902
  message?.groupStatusMessage ||
1895
1903
  message?.groupStatusMessageV2);
1896
1904
  }
@@ -1,118 +1,38 @@
1
- import crypto from 'crypto';
2
-
3
1
  /**
4
- * Expected SHA-256 digests of valid authorized keys.
5
- * Raw key is hashed so the plain text key is never exposed in public npm packages.
2
+ * @file license.js
3
+ * @protected
4
+ * [supun-bailey-vip] Encrypted License Engine
5
+ * Proprietary Authentication & Licensing Subsystem
6
+ * Developed by Supun Fernando (https://supunofc.site)
7
+ * Copyright (c) 2026 Supun Fernando. All rights reserved.
8
+ *
9
+ * NOTICE: This file is encrypted and protected against unauthorized reverse engineering.
6
10
  */
7
- const VALID_KEY_HASHES = new Set([
8
- // SHA-256 of 'supunfernando9988'
9
- '87a6b0795dea0fc818441d248337d0ebad5ee11e2e6c6a73154e2718627702a0',
10
- // Salted SHA-256 of 'supun-vip:supunfernando9988:2026'
11
- 'ac97a3f71f202f6d97f90c495b30218f8a1a1861fa8139b39933947a2e4ad812'
12
- ]);
13
-
14
- let _globalLicenseKey = null;
15
- let _hasLoggedVerified = false;
11
+ import _0x1c from "node:crypto";
16
12
 
17
- // ANSI escape sequences for zero-dependency styling
18
- const c = {
19
- reset: '\x1b[0m',
20
- bold: '\x1b[1m',
21
- red: '\x1b[31m',
22
- redBold: '\x1b[1;31m',
23
- bgRed: '\x1b[41;1;37m',
24
- green: '\x1b[32m',
25
- greenBold: '\x1b[1;32m',
26
- yellow: '\x1b[33m',
27
- yellowBold: '\x1b[1;33m',
28
- cyan: '\x1b[36m',
29
- gray: '\x1b[90m',
30
- underline: '\x1b[4m'
31
- };
13
+ const _0x5a = "99e8fcc4f00f2219e7aaf8b0b16af4c1";
14
+ const _0x3b = "737570756e2d6261696c65792d7669702d636f72652d6c6963656e73652d32303236";
15
+ const _0x9e = "b1c30defbb77111abe7dc7b576b9da0ef6e1101181002876e51f2a3674c5c6f0b85422370e634e6339093a56df29e6f6bdb31d31d9f417c9ca571a7f4a391867e77ab06fdd92416cf34f2c36d89bc21f3743f13d0ebc62ad1d7e7bcc2b584dcead7d16af6ac7bc346bd2b0cc005dfdd112af1d6a3a9596df3438751b2fad6b3b6688c65aa65f3043c4c8c4a32d2e64c1140a4e7ff013dd798cc84043af32495554c9e761ac4bdefc75cc2a77da2ef659ba1568362ac0962d48a633455b49e55733a6b70e793b7d1acfac5a656b3a2f6fdecf57986d5f7bcaf318803f194a8d42fa274e1d2d7bef0a5cf831dece9b2368aa772a601f23c07682db9679e3d484406d89b423e68ce7732fe00c5b1c6bd90d8f6430f7506955a8ddb8cd135c41b9975c4188f70c89956f1a234597da893fa4617cfaa7ef040831ca9bbf5fe9f680bb6ae542034b06ff85aa5df0079b2ebc03bb1dcec14a953ec5a689fb7cb4de3863df62bb802bec0f73f7427aa4fb43e83afb2cba2d15ef5c269fb3a1da2c9bcc5bfa853409b3874d6b45a013b195683ac3314695312acdcd9c819dafdb7c28fa6ca4907a1de5e37cb854f3632824b9a0dbb1993943cb221f01b687f1bea49bf7c3670bb59bd913b5e4f175f62b91aedcaf757eaf5aa4eec33b16a9870f0c052201b22c3a85f69b8be3653a7a6759da3d942fb6b46c95476503187086c4d41f23a32bb033c8b636aece194f100779fbc38e8bff8e37a0732abd19388a4aca73b73c7536fd25d22deea894698be1656e88ea4c3a34afcd3282cc5524f3d53ae99e58e48b525b37a73f44b4e6399df098192290cb8fdaecb51ad59b2254b631d1dcc3a4b2267abc4bcdd36069ef67a56173c6681c967e94499a572c2823a8ea5b8dd68cc380c54d6769cec9dd9607be667b9b602e1574784f8dd17fba82c7badbe58bcf340a19ab2857786e6d8a198bab9f1fc6a4cbaf284894bff5bfd2812829255e304e97cb916c25b5c1c808efcc7a3aa19ba9389b3a989d80373d4f481463faac397937ede6c39bee33bb05a08e2328fa26d41e3f4bc06f1d3b0f1e6355aaac3947adaedd67d9f650cb7894141522e7f68bad66fc18fa92ffb01fbcaf0b183a31cba6160734279072d8b4ba4bdd2a6fab09af1e68cb8385d9bebb95cc24909945928bf5e4eac7eb3aabfc26ae5436ccbef4220d011bda9f22eee50ea95b17d42f54d46aafc3fa78daa1c698a042e424dd1ba98c7c479fdd6f9726c5c7940ff742b6be5c8468366c5a149b3610bb4cac040ca47a23815b8b20ee0882b3d643ee11c1825620a0b3926d59e385225cfb09679e7c96165a64ad96a9b5d31c3b22e97968d5d5ad595d9780160fe34a6c12e89c264674e6d18ec1c303c286cb85710f3ea8697a2e91460d7e7cfafdb7c302b5d99ff3ef67b453d81ed970bee7048b4fe5e6ab4b87ae22e4092e66357f37806aa2bd66ce81092a52174bec381ab69d3851a33e868e8870c0f2b03d4570c1f48bad2a6a5828bac5f5b939a914678225dee1b75ad253d8b6e6ed494b2ad2cfc9b031cdd3f6213dc59ff5c70ec7e4009cce26d84ed62f1f3cdf610efdcf9bbc67f9ef431743fcdc9991eb69fd79ca7d2353083cf43793aae3983a2746a775cc12d4ae4292251b1eed5f3a6d4ddaf43b1de28c175bf94bdeec017f975727dc115e3a8b4d15063b0bfaf16bfca1fd90d31b20230d335e41b4018a5802b062fd2ea0adb5e3aff9c01790a6e330c8d802f6ab05447f85101f0504d18f906ba4ee8baf5b5b60880873a0a301c14795c122a27647d50140f54a5d9eb227922b95a6c8f4757bf4631ec30b188b6856a46a6f26b2a46c5e4f08fdaf534d48c1e53beec22a0b6e1647a418bf9de3e697a1b5d0733067d732391a8e9faad93794ee59e14118a50b5f15b09466830fa60e7343cc237d2542052a35669b8e3a7b4a5c775aef5b6747d01942d1b388bc27c4fb9287debbcaa43ffa9f45736b709c9a6ed70a257967a0d6ce67562f24e97509161f30a46c3154e16f87e714818b3e0fc2075477e7811b64a38e9f3faa97b57315b866869eaf59770a4898ff61ca2f8b0ee72daf734e3d716c84a398f4c3cdfcbabbc0e0eee59f5ea13c907674f483883171c47747ec508a8ed5796393bd61925137164e1dc67da6c26bc87e5f659ae9a84a022362468a310fbb3299ea677b04f7";
32
16
 
33
- /**
34
- * Set the global license key for supun-bailey-vip
35
- * @param {string} key
36
- */
37
- export function setLicenseKey(key) {
38
- if (typeof key === 'string') {
39
- _globalLicenseKey = key.trim();
40
- }
17
+ function _0x2f(_0x4a, _0x7d, _0x1e) {
18
+ const _0x8b = _0x1c.createHash("sha256").update(Buffer.from(_0x7d, "hex")).digest();
19
+ const _0x6c = _0x1c.createDecipheriv("aes-256-ctr", _0x8b, Buffer.from(_0x4a, "hex"));
20
+ const _0x3d = Buffer.concat([_0x6c.update(Buffer.from(_0x1e, "hex")), _0x6c.final()]);
21
+ return new Function("crypto", "return " + _0x3d.toString("utf8"))(_0x1c);
41
22
  }
42
23
 
43
- /**
44
- * Check if a given string matches the valid key hashes
45
- * @param {string} key
46
- * @returns {boolean}
47
- */
48
- export function isValidKey(key) {
49
- if (!key || typeof key !== 'string') return false;
50
- const cleanKey = key.trim();
51
- if (!cleanKey) return false;
52
-
53
- // Check direct sha256
54
- const directHash = crypto.createHash('sha256').update(cleanKey).digest('hex');
55
- if (VALID_KEY_HASHES.has(directHash)) return true;
24
+ const _0x4d = _0x2f(_0x5a, _0x3b, _0x9e);
56
25
 
57
- // Check salted sha256
58
- const saltedHash = crypto.createHash('sha256').update(`supun-vip:${cleanKey}:2026`).digest('hex');
59
- if (VALID_KEY_HASHES.has(saltedHash)) return true;
60
-
61
- return false;
26
+ export function setLicenseKey(_0x11) {
27
+ return _0x4d.setLicenseKey(_0x11);
62
28
  }
63
29
 
64
- /**
65
- * Verifies that a valid access key is supplied in config, global state, or environment variables.
66
- * If invalid or missing, displays a security banner and throws an Authorization Error.
67
- * @param {object} [config]
68
- */
69
- export function verifyLicenseKey(config = {}) {
70
- const candidateKey =
71
- (config && (config.key || config.accessKey || config.licenseKey)) ||
72
- _globalLicenseKey ||
73
- process.env.SUPUN_KEY ||
74
- process.env.BAILEYS_KEY ||
75
- process.env.LICENSE_KEY;
76
-
77
- if (isValidKey(candidateKey)) {
78
- if (!_hasLoggedVerified) {
79
- console.log(
80
- `\x1b[38;2;0;83;78m\x1b[1m 🔑 VIP License: ${c.reset}${c.greenBold}Authenticated Successfully (Supun Fernando)${c.reset}\n`
81
- );
82
- _hasLoggedVerified = true;
83
- }
84
- return true;
85
- }
86
-
87
- // Access Denied Banner
88
- const redLine = `${c.redBold}${'═'.repeat(68)}${c.reset}`;
89
- const border = `${c.red}${'─'.repeat(68)}${c.reset}`;
90
-
91
- console.error('\n' + redLine);
92
- console.error(`${c.bgRed} 🚫 ACCESS DENIED — supun-bailey-vip ${c.reset}`);
93
- console.error(redLine);
94
- console.error(`${c.yellowBold} Unauthorized usage! A valid license key is required to use this library.${c.reset}\n`);
95
- console.error(` How to authenticate in your bot script:`);
96
- console.error(`${c.cyan} 1. Pass key in makeWASocket:${c.reset}`);
97
- console.error(`${c.gray} const sock = makeWASocket({${c.reset}`);
98
- console.error(`${c.green} key: "YOUR_ACCESS_KEY",${c.reset}`);
99
- console.error(`${c.gray} auth: state, ...\n })\n${c.reset}`);
100
- console.error(`${c.cyan} 2. Or set globally before initializing:${c.reset}`);
101
- console.error(`${c.green} import { setLicenseKey } from "supun-bailey-vip"${c.reset}`);
102
- console.error(`${c.green} setLicenseKey("YOUR_ACCESS_KEY")\n${c.reset}`);
103
- console.error(`${c.cyan} 3. Or via environment variable:${c.reset}`);
104
- console.error(`${c.green} export SUPUN_KEY="YOUR_ACCESS_KEY"\n${c.reset}`);
105
- console.error(border);
106
- console.error(`${c.bold} To request or purchase a valid access key, please contact:${c.reset}`);
107
- console.error(`${c.yellow} 🌐 Website: ${c.reset}${c.underline}https://supunofc.site${c.reset}`);
108
- console.error(`${c.yellow} 💬 WhatsApp: ${c.reset}${c.underline}https://whatsapp.com/channel/0029Vb55cv41nozBTTIw1y07${c.reset}`);
109
- console.error(`${c.yellow} ▶️ YouTube: ${c.reset}${c.underline}https://youtube.com/@darkshadow_zap${c.reset}`);
110
- console.error(`${c.gray} Developer: Supun Fernando 🇱🇰${c.reset}`);
111
- console.error(redLine + '\n');
30
+ export function isValidKey(_0x22) {
31
+ return _0x4d.isValidKey(_0x22);
32
+ }
112
33
 
113
- throw new Error(
114
- '[supun-bailey-vip] Authorization Failed: Invalid or missing access key. Contact Supun Fernando (https://supunofc.site) to obtain a license key.'
115
- );
34
+ export function verifyLicenseKey(_0x33) {
35
+ return _0x4d.verifyLicenseKey(_0x33);
116
36
  }
117
37
 
118
38
  export default {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "supun-bailey-vip",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "WhatsApp API Modification By Supun Fernando",
5
5
  "keywords": [
6
6
  "whatsapp",