@zetagoaurum-socket/wasocket 2.1.6 → 2.1.8

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.
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.makeMessagesSocket = void 0;
7
7
  const boom_1 = require("@hapi/boom");
8
+ const crypto = require("crypto"); // Added for supportPayload messageSecret
8
9
  const node_cache_1 = __importDefault(require("node-cache"));
9
10
  const WAProto_1 = require("../../WAProto");
10
11
  const Defaults_1 = require("../Defaults");
@@ -319,6 +320,25 @@ const makeMessagesSocket = (config) => {
319
320
  };
320
321
  const extraAttrs = {}
321
322
  const messages = Utils_1.normalizeMessageContent(message)
323
+
324
+ // [AI BADGE FIX v2.1.8] Inject supportPayload into content instead of using risky transport node
325
+ if (AI) {
326
+ const msgType = Object.keys(messages)[0];
327
+ if (msgType) {
328
+ // Ensure contextInfo exists
329
+ messages[msgType].contextInfo = messages[msgType].contextInfo || {};
330
+
331
+ // Inject AI metadata
332
+ messages[msgType].contextInfo.messageSecret = messages[msgType].contextInfo.messageSecret || crypto.randomBytes(32);
333
+ messages[msgType].contextInfo.supportPayload = JSON.stringify({
334
+ version: 1,
335
+ is_ai_message: true,
336
+ should_show_system_message: true,
337
+ ticket_id: crypto.randomBytes(16).toString('hex')
338
+ });
339
+ }
340
+ }
341
+
322
342
  const buttonType = getButtonType(messages);
323
343
  if (participant) {
324
344
  // when the retry request is not for a group
@@ -546,7 +566,8 @@ const makeMessagesSocket = (config) => {
546
566
  logger.debug({ jid }, 'adding device identity');
547
567
  }
548
568
 
549
- if (AI && isPrivate) {
569
+ /* [REMOVED IN v2.1.8] Risky transport node causes message drops
570
+ if (AI) {
550
571
  const botNode = {
551
572
  tag: 'bot',
552
573
  attrs: {
@@ -565,6 +586,7 @@ const makeMessagesSocket = (config) => {
565
586
  stanza.content.push(botNode)
566
587
  }
567
588
  }
589
+ */
568
590
 
569
591
  if(!isNewsletter && buttonType && !isStatus) {
570
592
  const content = WABinary_1.getAdditionalNode(buttonType)
@@ -821,7 +843,8 @@ const makeMessagesSocket = (config) => {
821
843
  const paymentContent = await rahmi.handlePayment(content, quoted);
822
844
  return await relayMessage(jid, paymentContent, {
823
845
  messageId: Utils_1.generateMessageID(),
824
- ...getParticipantAttr()
846
+ ...getParticipantAttr(),
847
+ AI: true
825
848
  });
826
849
 
827
850
  case 'PRODUCT':
@@ -829,7 +852,8 @@ const makeMessagesSocket = (config) => {
829
852
  const productMsg = await Utils_1.generateWAMessageFromContent(jid, productContent, { quoted });
830
853
  return await relayMessage(jid, productMsg.message, {
831
854
  messageId: productMsg.key.id,
832
- ...getParticipantAttr()
855
+ ...getParticipantAttr(),
856
+ AI: true
833
857
  });
834
858
 
835
859
  case 'INTERACTIVE':
@@ -837,7 +861,8 @@ const makeMessagesSocket = (config) => {
837
861
  const interactiveMsg = await Utils_1.generateWAMessageFromContent(jid, interactiveContent, { quoted });
838
862
  return await relayMessage(jid, interactiveMsg.message, {
839
863
  messageId: interactiveMsg.key.id,
840
- ...getParticipantAttr()
864
+ ...getParticipantAttr(),
865
+ AI: true
841
866
  });
842
867
  case 'ALBUM':
843
868
  return await rahmi.handleAlbum(content, jid, quoted)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zetagoaurum-socket/wasocket",
3
- "version": "2.1.6",
3
+ "version": "2.1.8",
4
4
  "description": "WhatsApp API Modification ZetaGo",
5
5
  "keywords": [
6
6
  "whatsapp",