kage-baileys 25.3.23 → 25.3.25

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/WAProto/index.js CHANGED
@@ -1,31 +1,11 @@
1
1
  'use strict';
2
- /**
3
- * Fixed WAProto entrypoint for kage-baileys.
4
- * Missing generated index.js + shape differences between the old monolithic
5
- * WAProto and the new split protos under extras/WAProto.
6
- *
7
- * Also applies permanent Audio Sticker support (field 134 audioStickerMessage
8
- * on Message + field 26 audioMessage on StickerMessage) so plugins such as
9
- * stickeraudio / audiosticker / Tensura-style audioSticker can encode the
10
- * combined message without conflicting runtime hacks.
11
- *
12
- * Compatible with:
13
- * - kage native audio-sticker util (field 134)
14
- * - Tensura / Mahiru audioSticker.js patches (field 1074 wire tag = field 134)
15
- * Sets both __audioStickerKagePatchedV3 and __mahiruAudioStickerPatched so
16
- * external patches skip and do not double-encode.
17
- */
18
2
  const raw = require('../extras/WAProto');
19
3
  let proto = raw.proto || raw;
20
4
 
21
- // ---------- Normalize namespaces so legacy Baileys code keeps working ----------
22
-
23
- // 1. Message lives under E2E in the new protos
24
5
  if (proto.E2E && proto.E2E.Message && !proto.Message) {
25
6
  proto.Message = proto.E2E.Message;
26
7
  }
27
8
 
28
- // 2. HistorySyncType location differs
29
9
  const histType =
30
10
  (proto.HistorySync && proto.HistorySync.HistorySync && proto.HistorySync.HistorySync.HistorySyncType) ||
31
11
  (proto.HistorySync && proto.HistorySync.HistorySyncType) ||
@@ -41,43 +21,27 @@ if (histType) {
41
21
  }
42
22
  }
43
23
 
44
- // 3. Common other aliases that appear in Baileys code
45
24
  if (proto.E2E) {
46
25
  if (proto.E2E.WebMessageInfo && !proto.WebMessageInfo) {
47
26
  proto.WebMessageInfo = proto.E2E.WebMessageInfo;
48
27
  }
49
28
  }
50
29
 
51
- // Apply original field-name compatibility patches
52
30
  try {
53
31
  require('./compat.cjs')(proto);
54
32
  } catch (_) {}
55
33
 
56
- // ---------------------------------------------------------------------------
57
- // Audio Sticker support (permanent, idempotent, dual-flag for Tensura/Mahiru)
58
- // Protobuf tags:
59
- // Message.audioStickerMessage = 134 → tag 1074 (length-delimited)
60
- // StickerMessage.audioMessage = 26 → tag 210 (length-delimited)
61
- // The generated E2E.js lags behind WAProto.proto; this ensures encode /
62
- // fromObject always handle the fields used by audio-sticker plugins.
63
- // ---------------------------------------------------------------------------
64
34
  function applyAudioStickerSupport(p) {
65
35
  const M = p && p.Message;
66
36
  if (!M) return;
67
-
68
- // Already applied completely by this module
69
37
  if (M.__kageAudioStickerEncodeComplete) {
70
38
  M.__audioStickerKagePatchedV3 = true;
71
39
  M.__mahiruAudioStickerPatched = true;
40
+ M.__audioStickerPatched = true;
72
41
  return;
73
42
  }
43
+ if (!M.StickerMessage || !M.AudioMessage || !M.FutureProofMessage) return;
74
44
 
75
- if (!M.StickerMessage || !M.AudioMessage || !M.FutureProofMessage) {
76
- // Classes missing → leave untouched so normal stickers still work
77
- return;
78
- }
79
-
80
- // --- StickerMessage.encode: append audioMessage (field 26 / tag 210) ---
81
45
  const previousStickerEncode = M.StickerMessage.encode;
82
46
  M.StickerMessage.encode = function (message, writer) {
83
47
  const hasAudio = message && Object.prototype.hasOwnProperty.call(message, 'audioMessage');
@@ -86,7 +50,6 @@ function applyAudioStickerSupport(p) {
86
50
  try {
87
51
  const result = previousStickerEncode.call(this, message, writer);
88
52
  if (audio) {
89
- // field 26, wire type 2 → tag 210
90
53
  M.AudioMessage.encode(audio, result.uint32(210).fork()).ldelim();
91
54
  }
92
55
  return result;
@@ -95,7 +58,6 @@ function applyAudioStickerSupport(p) {
95
58
  }
96
59
  };
97
60
 
98
- // --- StickerMessage.fromObject: accept audioMessage ---
99
61
  if (typeof M.StickerMessage.fromObject === 'function') {
100
62
  const previousStickerFromObject = M.StickerMessage.fromObject;
101
63
  M.StickerMessage.fromObject = function (object) {
@@ -109,34 +71,24 @@ function applyAudioStickerSupport(p) {
109
71
  };
110
72
  }
111
73
 
112
- // Ensure prototype property exists (for hasOwnProperty / toObject paths)
113
74
  if (!Object.prototype.hasOwnProperty.call(M.StickerMessage.prototype, 'audioMessage')) {
114
75
  M.StickerMessage.prototype.audioMessage = null;
115
76
  }
116
77
 
117
- // --- Message.encode: emit audioStickerMessage (field 134 / tag 1074) ---
118
78
  const previousMessageEncode = M.encode;
119
79
  M.encode = function (message, writer) {
120
80
  const hasAudioSticker = message && Object.prototype.hasOwnProperty.call(message, 'audioStickerMessage');
121
81
  const hasSticker = message && Object.prototype.hasOwnProperty.call(message, 'stickerMessage');
122
82
  const audioSticker = hasAudioSticker ? message.audioStickerMessage : null;
123
83
  const stickerMessage = hasSticker ? message.stickerMessage : null;
124
-
125
84
  if (hasAudioSticker) {
126
85
  delete message.audioStickerMessage;
127
- // Prefer the nested sticker inside audioStickerMessage when present
128
- // (Tensura/Mahiru payload puts sticker under audioStickerMessage.message)
129
86
  if (hasSticker) delete message.stickerMessage;
130
87
  }
131
-
132
88
  try {
133
89
  const result = previousMessageEncode.call(this, message, writer);
134
90
  if (audioSticker) {
135
- // field 134, wire type 2 → tag 1074
136
- M.FutureProofMessage.encode(
137
- audioSticker,
138
- result.uint32(1074).fork()
139
- ).ldelim();
91
+ M.FutureProofMessage.encode(audioSticker, result.uint32(1074).fork()).ldelim();
140
92
  }
141
93
  return result;
142
94
  } finally {
@@ -145,14 +97,12 @@ function applyAudioStickerSupport(p) {
145
97
  }
146
98
  };
147
99
 
148
- // --- Message.fromObject: accept audioStickerMessage ---
149
100
  if (typeof M.fromObject === 'function') {
150
101
  const previousMessageFromObject = M.fromObject;
151
102
  M.fromObject = function (object) {
152
103
  const message = previousMessageFromObject.call(this, object);
153
104
  if (object && object.audioStickerMessage) {
154
105
  const inner = object.audioStickerMessage.message || object.audioStickerMessage;
155
- // Preserve nested stickerMessage.audioMessage if present (Tensura path)
156
106
  if (
157
107
  inner &&
158
108
  inner.stickerMessage &&
@@ -166,7 +116,6 @@ function applyAudioStickerSupport(p) {
166
116
  message.audioStickerMessage = M.FutureProofMessage.fromObject
167
117
  ? M.FutureProofMessage.fromObject({ message: inner })
168
118
  : { message: inner };
169
- // Match Tensura behavior: drop top-level sticker when audio sticker is set
170
119
  if (message.stickerMessage && inner && inner.stickerMessage) {
171
120
  delete message.stickerMessage;
172
121
  }
@@ -179,17 +128,16 @@ function applyAudioStickerSupport(p) {
179
128
  M.prototype.audioStickerMessage = null;
180
129
  }
181
130
 
182
- // Dual flags: kage native + Tensura/Mahiru style so external patches skip
183
131
  M.__audioStickerKagePatchedV3 = true;
184
132
  M.__mahiruAudioStickerPatched = true;
185
133
  M.__tensuraAudioStickerPatched = true;
134
+ M.__audioStickerPatched = true;
186
135
  M.__kageAudioStickerEncodeComplete = true;
187
136
  }
188
137
 
189
138
  try {
190
139
  applyAudioStickerSupport(proto);
191
140
  } catch (err) {
192
- // Never break loading of WAProto because of the optional audio-sticker patch
193
141
  if (typeof console !== 'undefined' && console.warn) {
194
142
  console.warn('[kage-baileys/WAProto] Audio Sticker patch skipped:', err && err.message);
195
143
  }
@@ -729,6 +729,7 @@ message Message {
729
729
  optional StatusQuestionAnswerMessage statusQuestionAnswerMessage = 105;
730
730
  optional FutureProofMessage questionReplyMessage = 106;
731
731
  optional QuestionResponseMessage questionResponseMessage = 107;
732
+ optional FutureProofMessage audioStickerMessage = 134;
732
733
  message AlbumMessage {
733
734
  optional uint32 expectedImageCount = 2;
734
735
  optional uint32 expectedVideoCount = 3;
@@ -1908,6 +1909,9 @@ message Message {
1908
1909
  optional bool isLottie = 21;
1909
1910
  optional string accessibilityLabel = 22;
1910
1911
  optional Message.MediaKeyDomain mediaKeyDomain = 23;
1912
+ optional int32 premium = 24;
1913
+ optional string emojis = 25;
1914
+ optional AudioMessage audioMessage = 26;
1911
1915
  }
1912
1916
  message StickerPackMessage {
1913
1917
  optional string stickerPackId = 1;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "kage-baileys",
3
- "version": "25.3.23",
4
- "description": "Kage Baileys full merge — Builders + mbuilder + Framework + advanced sticker packs + KAGE pairing + extended WAProto. Multi-device ready. FIXED: all core modules deduplicated, removed third-party libsignal-node fork. [audio-sticker patch for Mahiru/Tensura compatibility] [audio-sticker patch for Mahiru/Tensura compatibility]",
3
+ "version": "25.3.25",
4
+ "description": "Kage Baileys, la mejor Baileys de 2026.]",
5
5
  "keywords": [
6
6
  "kage-baileys",
7
7
  "baileys",