cuki-bailx 1.2.6 → 2.0.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.
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getChatId = exports.shouldIncrementChatUnread = exports.isRealMessage = exports.cleanMessage = void 0;
4
- exports.decryptPollVote = decryptPollVote;
3
+ exports.decryptPollVote = exports.getChatId = exports.shouldIncrementChatUnread = exports.isRealMessage = exports.cleanMessage = void 0;
5
4
  const WAProto_1 = require("../../WAProto");
6
5
  const Types_1 = require("../Types");
7
6
  const messages_1 = require("../Utils/messages");
@@ -21,21 +20,8 @@ const REAL_MSG_REQ_ME_STUB_TYPES = new Set([
21
20
  /** Cleans a received message to further processing */
22
21
  const cleanMessage = (message, meId) => {
23
22
  // ensure remoteJid and participant doesn't have device or agent in it
24
- // normalize JIDs but catch errors to avoid throwing on invalid LIDs/JIDs
25
- try {
26
- message.key.remoteJid = (0, WABinary_1.jidNormalizedUser)(message.key.remoteJid);
27
- }
28
- catch (_e) {
29
- // if normalization fails, retain original remoteJid
30
- }
31
- if (message.key.participant) {
32
- try {
33
- message.key.participant = (0, WABinary_1.jidNormalizedUser)(message.key.participant);
34
- }
35
- catch (_e) {
36
- // ignore if can't normalize participant
37
- }
38
- }
23
+ message.key.remoteJid = (0, WABinary_1.jidNormalizedUser)(message.key.remoteJid);
24
+ message.key.participant = message.key.participant ? (0, WABinary_1.jidNormalizedUser)(message.key.participant) : undefined;
39
25
  const content = (0, messages_1.normalizeMessageContent)(message.message);
40
26
  // if the message has a reaction, ensure fromMe & remoteJid are from our perspective
41
27
  if (content === null || content === void 0 ? void 0 : content.reactionMessage) {
@@ -115,14 +101,14 @@ function decryptPollVote({ encPayload, encIv }, { pollCreatorJid, pollMsgId, pol
115
101
  return Buffer.from(txt);
116
102
  }
117
103
  }
118
- const processMessage = async (message, { shouldProcessHistoryMsg, placeholderResendCache, ev, creds, keyStore, logger, options, getMessage }) => {
119
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
104
+ exports.decryptPollVote = decryptPollVote;
105
+ const processMessage = async (message, { shouldProcessHistoryMsg, ev, creds, keyStore, logger, options, getMessage }) => {
106
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
120
107
  const meId = creds.me.id;
121
108
  const { accountSettings } = creds;
122
109
  const chat = { id: (0, WABinary_1.jidNormalizedUser)((0, exports.getChatId)(message.key)) };
123
110
  const isRealMsg = (0, exports.isRealMessage)(message, meId);
124
111
  if (isRealMsg) {
125
- chat.messages = [{ message }];
126
112
  chat.conversationTimestamp = (0, generics_1.toNumber)(message.messageTimestamp);
127
113
  // only increment unread count if not CIPHERTEXT and from another person
128
114
  if ((0, exports.shouldIncrementChatUnread)(message)) {
@@ -130,25 +116,6 @@ const processMessage = async (message, { shouldProcessHistoryMsg, placeholderRes
130
116
  }
131
117
  }
132
118
  const content = (0, messages_1.normalizeMessageContent)(message.message);
133
- const senderId = message.key.participant || message.key.remoteJid;
134
- if ((0, WABinary_1.isLidUser)(senderId)) {
135
- const jid = (0, WABinary_1.lidToJid)(senderId);
136
- if (message.key.participant) {
137
- message.key.participant = jid;
138
- }
139
- else {
140
- message.key.remoteJid = jid;
141
- }
142
- }
143
- const mJids = content && content.contextInfo && content.contextInfo.mentionedJid ? content.contextInfo.mentionedJid : [];
144
- for (let i = 0; i < mJids.length; i++) {
145
- if ((0, WABinary_1.isLidUser)(mJids[i])) {
146
- mJids[i] = (0, WABinary_1.lidToJid)(mJids[i]);
147
- }
148
- }
149
- if (content && content.contextInfo && content.contextInfo.participant && (0, WABinary_1.isLidUser)(content.contextInfo.participant)) {
150
- content.contextInfo.participant = (0, WABinary_1.lidToJid)(content.contextInfo.participant);
151
- }
152
119
  // unarchive chat if it's a real message, or someone reacted to our message
153
120
  // and we've the unarchive chats setting on
154
121
  if ((isRealMsg || ((_b = (_a = content === null || content === void 0 ? void 0 : content.reactionMessage) === null || _a === void 0 ? void 0 : _a.key) === null || _b === void 0 ? void 0 : _b.fromMe))
@@ -170,22 +137,14 @@ const processMessage = async (message, { shouldProcessHistoryMsg, placeholderRes
170
137
  isLatest,
171
138
  }, 'got history notification');
172
139
  if (process) {
173
- if (histNotification.syncType !== WAProto_1.proto.HistorySync.HistorySyncType.ON_DEMAND) {
174
- ev.emit('creds.update', {
175
- processedHistoryMessages: [
176
- ...(creds.processedHistoryMessages || []),
177
- { key: message.key, messageTimestamp: message.messageTimestamp }
178
- ]
179
- });
180
- }
181
- const data = await (0, history_1.downloadAndProcessHistorySyncNotification)(histNotification, options);
182
- ev.emit('messaging-history.set', {
183
- ...data,
184
- isLatest: histNotification.syncType !== WAProto_1.proto.HistorySync.HistorySyncType.ON_DEMAND
185
- ? isLatest
186
- : undefined,
187
- peerDataRequestSessionId: histNotification.peerDataRequestSessionId
140
+ ev.emit('creds.update', {
141
+ processedHistoryMessages: [
142
+ ...(creds.processedHistoryMessages || []),
143
+ { key: message.key, messageTimestamp: message.messageTimestamp }
144
+ ]
188
145
  });
146
+ const data = await (0, history_1.downloadAndProcessHistorySyncNotification)(histNotification, options);
147
+ ev.emit('messaging-history.set', { ...data, isLatest });
189
148
  }
190
149
  break;
191
150
  case WAProto_1.proto.Message.ProtocolMessage.Type.APP_STATE_SYNC_KEY_SHARE:
@@ -228,41 +187,17 @@ const processMessage = async (message, { shouldProcessHistoryMsg, placeholderRes
228
187
  case WAProto_1.proto.Message.ProtocolMessage.Type.PEER_DATA_OPERATION_REQUEST_RESPONSE_MESSAGE:
229
188
  const response = protocolMsg.peerDataOperationRequestResponseMessage;
230
189
  if (response) {
231
- placeholderResendCache === null || placeholderResendCache === void 0 ? void 0 : placeholderResendCache.del(response.stanzaId);
232
- // TODO: IMPLEMENT HISTORY SYNC ETC (sticker uploads etc.).
233
190
  const { peerDataOperationResult } = response;
234
191
  for (const result of peerDataOperationResult) {
235
192
  const { placeholderMessageResendResponse: retryResponse } = result;
236
193
  if (retryResponse) {
237
194
  const webMessageInfo = WAProto_1.proto.WebMessageInfo.decode(retryResponse.webMessageInfoBytes);
238
- // wait till another upsert event is available, don't want it to be part of the PDO response message
239
- setTimeout(() => {
240
- ev.emit('messages.upsert', {
241
- messages: [webMessageInfo],
242
- type: 'notify',
243
- requestId: response.stanzaId
244
- });
245
- }, 500);
195
+ ev.emit('messages.update', [
196
+ { key: webMessageInfo.key, update: { message: webMessageInfo.message } }
197
+ ]);
246
198
  }
247
199
  }
248
200
  }
249
- case WAProto_1.proto.Message.ProtocolMessage.Type.MESSAGE_EDIT:
250
- ev.emit('messages.update', [
251
- {
252
- // flip the sender / fromMe properties because they're in the perspective of the sender
253
- key: { ...message.key, id: (_d = protocolMsg.key) === null || _d === void 0 ? void 0 : _d.id },
254
- update: {
255
- message: {
256
- editedMessage: {
257
- message: protocolMsg.editedMessage
258
- }
259
- },
260
- messageTimestamp: protocolMsg.timestampMs
261
- ? Math.floor((0, generics_1.toNumber)(protocolMsg.timestampMs) / 1000)
262
- : message.messageTimestamp
263
- }
264
- }
265
- ]);
266
201
  break;
267
202
  }
268
203
  }
@@ -273,11 +208,11 @@ const processMessage = async (message, { shouldProcessHistoryMsg, placeholderRes
273
208
  };
274
209
  ev.emit('messages.reaction', [{
275
210
  reaction,
276
- key: (_e = content.reactionMessage) === null || _e === void 0 ? void 0 : _e.key,
211
+ key: content.reactionMessage.key,
277
212
  }]);
278
213
  }
279
214
  else if (message.messageStubType) {
280
- const jid = (_f = message.key) === null || _f === void 0 ? void 0 : _f.remoteJid;
215
+ const jid = message.key.remoteJid;
281
216
  //let actor = whatsappID (message.participant)
282
217
  let participants;
283
218
  const emitParticipantsUpdate = (action) => (ev.emit('group-participants.update', { id: jid, author: message.participant, participants, action }));
@@ -285,15 +220,8 @@ const processMessage = async (message, { shouldProcessHistoryMsg, placeholderRes
285
220
  var _a;
286
221
  ev.emit('groups.update', [{ id: jid, ...update, author: (_a = message.participant) !== null && _a !== void 0 ? _a : undefined }]);
287
222
  };
288
- const emitGroupRequestJoin = (participant, action, method) => {
289
- ev.emit('group.join-request', { id: jid, author: message.participant, participant, action, method: method });
290
- };
291
223
  const participantsIncludesMe = () => participants.find(jid => (0, WABinary_1.areJidsSameUser)(meId, jid));
292
224
  switch (message.messageStubType) {
293
- case Types_1.WAMessageStubType.GROUP_PARTICIPANT_CHANGE_NUMBER:
294
- participants = message.messageStubParameters || [];
295
- emitParticipantsUpdate('modify');
296
- break;
297
225
  case Types_1.WAMessageStubType.GROUP_PARTICIPANT_LEAVE:
298
226
  case Types_1.WAMessageStubType.GROUP_PARTICIPANT_REMOVE:
299
227
  participants = message.messageStubParameters || [];
@@ -321,41 +249,30 @@ const processMessage = async (message, { shouldProcessHistoryMsg, placeholderRes
321
249
  emitParticipantsUpdate('promote');
322
250
  break;
323
251
  case Types_1.WAMessageStubType.GROUP_CHANGE_ANNOUNCE:
324
- const announceValue = (_g = message.messageStubParameters) === null || _g === void 0 ? void 0 : _g[0];
252
+ const announceValue = (_d = message.messageStubParameters) === null || _d === void 0 ? void 0 : _d[0];
325
253
  emitGroupUpdate({ announce: announceValue === 'true' || announceValue === 'on' });
326
254
  break;
327
255
  case Types_1.WAMessageStubType.GROUP_CHANGE_RESTRICT:
328
- const restrictValue = (_h = message.messageStubParameters) === null || _h === void 0 ? void 0 : _h[0];
256
+ const restrictValue = (_e = message.messageStubParameters) === null || _e === void 0 ? void 0 : _e[0];
329
257
  emitGroupUpdate({ restrict: restrictValue === 'true' || restrictValue === 'on' });
330
258
  break;
331
259
  case Types_1.WAMessageStubType.GROUP_CHANGE_SUBJECT:
332
- const name = (_j = message.messageStubParameters) === null || _j === void 0 ? void 0 : _j[0];
260
+ const name = (_f = message.messageStubParameters) === null || _f === void 0 ? void 0 : _f[0];
333
261
  chat.name = name;
334
262
  emitGroupUpdate({ subject: name });
335
263
  break;
336
- case Types_1.WAMessageStubType.GROUP_CHANGE_DESCRIPTION:
337
- const description = (_k = message.messageStubParameters) === null || _k === void 0 ? void 0 : _k[0];
338
- chat.description = description;
339
- emitGroupUpdate({ desc: description });
340
- break;
341
264
  case Types_1.WAMessageStubType.GROUP_CHANGE_INVITE_LINK:
342
- const code = (_l = message.messageStubParameters) === null || _l === void 0 ? void 0 : _l[0];
265
+ const code = (_g = message.messageStubParameters) === null || _g === void 0 ? void 0 : _g[0];
343
266
  emitGroupUpdate({ inviteCode: code });
344
267
  break;
345
268
  case Types_1.WAMessageStubType.GROUP_MEMBER_ADD_MODE:
346
- const memberAddValue = (_m = message.messageStubParameters) === null || _m === void 0 ? void 0 : _m[0];
269
+ const memberAddValue = (_h = message.messageStubParameters) === null || _h === void 0 ? void 0 : _h[0];
347
270
  emitGroupUpdate({ memberAddMode: memberAddValue === 'all_member_add' });
348
271
  break;
349
272
  case Types_1.WAMessageStubType.GROUP_MEMBERSHIP_JOIN_APPROVAL_MODE:
350
- const approvalMode = (_o = message.messageStubParameters) === null || _o === void 0 ? void 0 : _o[0];
273
+ const approvalMode = (_j = message.messageStubParameters) === null || _j === void 0 ? void 0 : _j[0];
351
274
  emitGroupUpdate({ joinApprovalMode: approvalMode === 'on' });
352
275
  break;
353
- case Types_1.WAMessageStubType.GROUP_MEMBERSHIP_JOIN_APPROVAL_REQUEST_NON_ADMIN_ADD:
354
- const participant = (_p = message.messageStubParameters) === null || _p === void 0 ? void 0 : _p[0];
355
- const action = (_q = message.messageStubParameters) === null || _q === void 0 ? void 0 : _q[1];
356
- const method = (_r = message.messageStubParameters) === null || _r === void 0 ? void 0 : _r[2];
357
- emitGroupRequestJoin(participant, action, method);
358
- break;
359
276
  }
360
277
  }
361
278
  else if (content === null || content === void 0 ? void 0 : content.pollUpdateMessage) {
@@ -366,7 +283,7 @@ const processMessage = async (message, { shouldProcessHistoryMsg, placeholderRes
366
283
  const meIdNormalised = (0, WABinary_1.jidNormalizedUser)(meId);
367
284
  const pollCreatorJid = (0, generics_1.getKeyAuthor)(creationMsgKey, meIdNormalised);
368
285
  const voterJid = (0, generics_1.getKeyAuthor)(message.key, meIdNormalised);
369
- const pollEncKey = (_s = pollMsg.messageContextInfo) === null || _s === void 0 ? void 0 : _s.messageSecret;
286
+ const pollEncKey = (_k = pollMsg.messageContextInfo) === null || _k === void 0 ? void 0 : _k.messageSecret;
370
287
  try {
371
288
  const voteMsg = decryptPollVote(content.pollUpdateMessage.vote, {
372
289
  pollEncKey,
@@ -1,6 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getNextPreKeysNode = exports.getNextPreKeys = exports.extractDeviceJids = exports.parseAndInjectE2ESessions = exports.xmppPreKey = exports.xmppSignedPreKey = exports.generateOrGetPreKeys = exports.getPreKeys = exports.createSignalIdentity = void 0;
3
+ exports.getNextPreKeysNode =
4
+ exports.getNextPreKeys =
5
+ exports.extractDeviceJids =
6
+ exports.parseAndInjectE2ESessions =
7
+ exports.xmppPreKey =
8
+ exports.xmppSignedPreKey =
9
+ exports.generateOrGetPreKeys =
10
+ exports.getPreKeys =
11
+ exports.createSignalIdentity = void 0;
12
+
4
13
  const lodash_1 = require("lodash");
5
14
  const Defaults_1 = require("../Defaults");
6
15
  const WABinary_1 = require("../WABinary");
@@ -8,7 +8,7 @@ const WAProto_1 = require("../../WAProto");
8
8
  const auth_utils_1 = require("./auth-utils");
9
9
  const generics_1 = require("./generics");
10
10
  // We need to lock files due to the fact that we are using async functions to read and write files
11
- // https://github.com/WhiskeySockets/VyzenBail/issues/794
11
+ // https://github.com/WhiskeySockets/Baileys/issues/794
12
12
  // https://github.com/nodejs/node/issues/26338
13
13
  // Use a Map to store mutexes for each file path
14
14
  const fileLocks = new Map();
@@ -1,6 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.encodeSignedDeviceIdentity = exports.configureSuccessfulPairing = exports.generateRegistrationNode = exports.generateLoginNode = void 0;
3
+ exports.encodeSignedDeviceIdentity =
4
+ exports.configureSuccessfulPairing =
5
+ exports.generateRegistrationNode =
6
+ exports.generateLoginNode = void 0;
7
+ // Kazumarii Baileys
4
8
  const boom_1 = require("@hapi/boom");
5
9
  const crypto_1 = require("crypto");
6
10
  const WAProto_1 = require("../../WAProto");
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.lidToJid = exports.getBotJid = exports.jidNormalizedUser = exports.isJidBot = exports.isJidStatusBroadcast = exports.isJidGroup = exports.isJidNewsletter = exports.isJidBroadcast = exports.isLidUser = exports.isJidUser = exports.isJidMetaAi = exports.areJidsSameUser = exports.jidDecode = exports.jidEncode = exports.META_AI_JID = exports.STORIES_JID = exports.PSA_WID = exports.SERVER_JID = exports.OFFICIAL_BIZ_JID = exports.S_WHATSAPP_NET = void 0;
3
+ exports.getBotJid = exports.jidNormalizedUser = exports.isJidBot = exports.isJidStatusBroadcast = exports.isJidGroup = exports.isJidNewsletter = exports.isJidBroadcast = exports.isLidUser = exports.isJidUser = exports.isJidMetaAi = exports.areJidsSameUser = exports.jidDecode = exports.jidEncode = exports.META_AI_JID = exports.STORIES_JID = exports.PSA_WID = exports.SERVER_JID = exports.OFFICIAL_BIZ_JID = exports.S_WHATSAPP_NET = void 0;
4
4
  exports.S_WHATSAPP_NET = '@s.whatsapp.net';
5
5
  exports.OFFICIAL_BIZ_JID = '16505361212@c.us';
6
6
  exports.SERVER_JID = 'server@c.us';
@@ -67,19 +67,3 @@ const jidNormalizedUser = (jid) => {
67
67
  return (0, exports.jidEncode)(user, server === 'c.us' ? 's.whatsapp.net' : server);
68
68
  };
69
69
  exports.jidNormalizedUser = jidNormalizedUser;
70
- const lidToJid = jid => jid && jid.endsWith('@lid') ? jid.replace('@lid','@s.whatsapp.net') : jid;
71
- exports.lidToJid = lidToJid;
72
- const getBotJid = (jid) => {
73
- const BOT_MAP = new Map([["867051314767696", "13135550002"], ["1061492271844689", "13135550005"], ["245886058483988", "13135550009"], ["3509905702656130", "13135550012"], ["1059680132034576", "13135550013"], ["715681030623646", "13135550014"], ["1644971366323052", "13135550015"], ["582497970646566", "13135550019"], ["645459357769306", "13135550022"], ["294997126699143", "13135550023"], ["1522631578502677", "13135550027"], ["719421926276396", "13135550030"], ["1788488635002167", "13135550031"], ["24232338603080193", "13135550033"], ["689289903143209", "13135550035"], ["871626054177096", "13135550039"], ["362351902849370", "13135550042"], ["1744617646041527", "13135550043"], ["893887762270570", "13135550046"], ["1155032702135830", "13135550047"], ["333931965993883", "13135550048"], ["853748013058752", "13135550049"], ["1559068611564819", "13135550053"], ["890487432705716", "13135550054"], ["240254602395494", "13135550055"], ["1578420349663261", "13135550062"], ["322908887140421", "13135550065"], ["3713961535514771", "13135550067"], ["997884654811738", "13135550070"], ["403157239387035", "13135550081"], ["535242369074963", "13135550082"], ["946293427247659", "13135550083"], ["3664707673802291", "13135550084"], ["1821827464894892", "13135550085"], ["1760312477828757", "13135550086"], ["439480398712216", "13135550087"], ["1876735582800984", "13135550088"], ["984025089825661", "13135550089"], ["1001336351558186", "13135550090"], ["3739346336347061", "13135550091"], ["3632749426974980", "13135550092"], ["427864203481615", "13135550093"], ["1434734570493055", "13135550094"], ["992873449225921", "13135550095"], ["813087747426445", "13135550096"], ["806369104931434", "13135550098"], ["1220982902403148", "13135550099"], ["1365893374104393", "13135550100"], ["686482033622048", "13135550200"], ["1454999838411253", "13135550201"], ["718584497008509", "13135550202"], ["743520384213443", "13135550301"], ["1147715789823789", "13135550302"], ["1173034540372201", "13135550303"], ["974785541030953", "13135550304"], ["1122200255531507", "13135550305"], ["899669714813162", "13135550306"], ["631880108970650", "13135550307"], ["435816149330026", "13135550308"], ["1368717161184556", "13135550309"], ["7849963461784891", "13135550310"], ["3609617065968984", "13135550312"], ["356273980574602", "13135550313"], ["1043447920539760", "13135550314"], ["1052764336525346", "13135550315"], ["2631118843732685", "13135550316"], ["510505411332176", "13135550317"], ["1945664239227513", "13135550318"], ["1518594378764656", "13135550319"], ["1378821579456138", "13135550320"], ["490214716896013", "13135550321"], ["1028577858870699", "13135550322"], ["308915665545959", "13135550323"], ["845884253678900", "13135550324"], ["995031308616442", "13135550325"], ["2787365464763437", "13135550326"], ["1532790990671645", "13135550327"], ["302617036180485", "13135550328"], ["723376723197227", "13135550329"], ["8393570407377966", "13135550330"], ["1931159970680725", "13135550331"], ["401073885688605", "13135550332"], ["2234478453565422", "13135550334"], ["814748673882312", "13135550335"], ["26133635056281592", "13135550336"], ["1439804456676119", "13135550337"], ["889851503172161", "13135550338"], ["1018283232836879", "13135550339"], ["1012781386779537", "13135559000"], ["823280953239532", "13135559001"], ["1597090934573334", "13135559002"], ["485965054020343", "13135559003"], ["1033381648363446", "13135559004"], ["491802010206446", "13135559005"], ["1017139033184870", "13135559006"], ["499638325922174", "13135559008"], ["468946335863664", "13135559009"], ["1570389776875816", "13135559010"], ["1004342694328995", "13135559011"], ["1012240323971229", "13135559012"], ["392171787222419", "13135559013"], ["952081212945019", "13135559016"], ["444507875070178", "13135559017"], ["1274819440594668", "13135559018"], ["1397041101147050", "13135559019"], ["425657699872640", "13135559020"], ["532292852562549", "13135559021"], ["705863241720292", "13135559022"], ["476449815183959", "13135559023"], ["488071553854222", "13135559024"], ["468693832665397", "13135559025"], ["517422564037340", "13135559026"], ["819805466613825", "13135559027"], ["1847708235641382", "13135559028"], ["716282970644228", "13135559029"], ["521655380527741", "13135559030"], ["476193631941905", "13135559031"], ["485600497445562", "13135559032"], ["440217235683910", "13135559033"], ["523342446758478", "13135559034"], ["514784864360240", "13135559035"], ["505790121814530", "13135559036"], ["420008964419580", "13135559037"], ["492141680204555", "13135559038"], ["388462787271952", "13135559039"], ["423473920752072", "13135559040"], ["489574180468229", "13135559041"], ["432360635854105", "13135559042"], ["477878201669248", "13135559043"], ["351656951234045", "13135559044"], ["430178036732582", "13135559045"], ["434537312944552", "13135559046"], ["1240614300631808", "13135559047"], ["473135945605128", "13135559048"], ["423669800729310", "13135559049"], ["3685666705015792", "13135559050"], ["504196509016638", "13135559051"], ["346844785189449", "13135559052"], ["504823088911074", "13135559053"], ["402669415797083", "13135559054"], ["490939640234431", "13135559055"], ["875124128063715", "13135559056"], ["468788962654605", "13135559057"], ["562386196354570", "13135559058"], ["372159285928791", "13135559059"], ["531017479591050", "13135559060"], ["1328873881401826", "13135559061"], ["1608363646390484", "13135559062"], ["1229628561554232", "13135559063"], ["348802211530364", "13135559064"], ["3708535859420184", "13135559065"], ["415517767742187", "13135559066"], ["479330341612638", "13135559067"], ["480785414723083", "13135559068"], ["387299107507991", "13135559069"], ["333389813188944", "13135559070"], ["391794130316996", "13135559071"], ["457893470576314", "13135559072"], ["435550496166469", "13135559073"], ["1620162702100689", "13135559074"], ["867491058616043", "13135559075"], ["816224117357759", "13135559076"], ["334065176362830", "13135559077"], ["489973170554709", "13135559078"], ["473060669049665", "13135559079"], ["1221505815643060", "13135559080"], ["889000703096359", "13135559081"], ["475235961979883", "13135559082"], ["3434445653519934", "13135559084"], ["524503026827421", "13135559085"], ["1179639046403856", "13135559086"], ["471563305859144", "13135559087"], ["533896609192881", "13135559088"], ["365443583168041", "13135559089"], ["836082305329393", "13135559090"], ["1056787705969916", "13135559091"], ["503312598958357", "13135559092"], ["3718606738453460", "13135559093"], ["826066052850902", "13135559094"], ["1033611345091888", "13135559095"], ["3868390816783240", "13135559096"], ["7462677740498860", "13135559097"], ["436288576108573", "13135559098"], ["1047559746718900", "13135559099"], ["1099299455255491", "13135559100"], ["1202037301040633", "13135559101"], ["1720619402074074", "13135559102"], ["1030422235101467", "13135559103"], ["827238979523502", "13135559104"], ["1516443722284921", "13135559105"], ["1174442747196709", "13135559106"], ["1653165225503842", "13135559107"], ["1037648777635013", "13135559108"], ["551617757299900", "13135559109"], ["1158813558718726", "13135559110"], ["2463236450542262", "13135559111"], ["1550393252501466", "13135559112"], ["2057065188042796", "13135559113"], ["506163028760735", "13135559114"], ["2065249100538481", "13135559115"], ["1041382867195858", "13135559116"], ["886500209499603", "13135559117"], ["1491615624892655", "13135559118"], ["486563697299617", "13135559119"], ["1175736513679463", "13135559120"], ["491811473512352", "13165550064"]]);
74
- const sepIdx = typeof jid === 'string' ? jid.indexOf('@') : -1;
75
- if (sepIdx < 0) {
76
- return jid;
77
- }
78
- const server = jid.slice(sepIdx + 1);
79
- if (server !== 'bot')
80
- return jid;
81
- const user = jid.slice(0, sepIdx);
82
- const mappedNumber = BOT_MAP.get(user);
83
- return mappedNumber ? `${mappedNumber}@s.whatsapp.net` : jid;
84
- };
85
- exports.getBotJid = getBotJid;
package/lib/index.js CHANGED
@@ -14,7 +14,7 @@ console.log(`
14
14
  ║╚╗║╚╝║║╚╗╔║║╗
15
15
  ╚═╝╚══╝╚╩╝╚══╝
16
16
  `);
17
-
17
+ console.log(gradient(['blue', 'cyan'])('Telegram : t.me/cukiii_55'));
18
18
 
19
19
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
20
20
  if (k2 === undefined) k2 = k;
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "cuki-bailx",
3
- "version": "1.2.6",
4
- "description": "Whatsapp baileys by cuki",
3
+ "version": "2.0.8",
4
+ "description": "whatsapp baileys mod by cuki",
5
5
  "keywords": [
6
6
  "baileys",
7
7
  "baileys-mod",
8
- "CukiDigital",
8
+ "cuki-bailx",
9
+ "cuki digital",
9
10
  "whatsapp",
10
11
  "whatsapp-api",
11
12
  "whatsapp-web",
@@ -14,30 +15,22 @@
14
15
  "multi-device",
15
16
  "Hutao-Md"
16
17
  ],
17
- "homepage": "https://whatsapp.com/channel/0029Vb6CHAjK5cDJGJssog3J",
18
+ "homepage": "https://whatsapp.com/channel/0029Vb6VdC18Pgs9uRZAra3b",
18
19
  "license": "MIT",
19
- "author": "Cuki Digital",
20
- "main": "lib/index.js",
21
- "types": "lib/index.d.ts",
20
+ "author": "CukiDigital",
21
+ "main": "./lib/index.js",
22
22
  "files": [
23
23
  "lib/*",
24
- "WAProto/*",
25
- "engine-requirements.js"
24
+ "WAProto/*"
26
25
  ],
27
26
  "scripts": {
28
- "build:all": "tsc && typedoc",
29
- "build:docs": "typedoc",
30
- "build:tsc": "tsc",
31
- "changelog:last": "conventional-changelog -p angular -r 2",
32
- "changelog:preview": "conventional-changelog -p angular -u",
33
27
  "changelog:update": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0",
34
- "example": "node --inspect -r ts-node/register Example/example.ts",
28
+ "changelog:preview": "conventional-changelog -p angular -u",
29
+ "changelog:last": "conventional-changelog -p angular -r 2",
35
30
  "gen:protobuf": "sh WAProto/GenerateStatics.sh",
36
- "lint": "eslint src --ext .js,.ts,.jsx,.tsx",
37
- "lint:fix": "eslint src --fix --ext .js,.ts,.jsx,.tsx",
38
- "prepack": "echo 'Cuki-bailx WhatsApp Library'",
39
- "prepare": "echo 'Cuki-Bailx WhatsApp Library'",
40
- "preinstall": "node ./engine-requirements.js",
31
+ "example": "node --inspect Example/example.js",
32
+ "lint": "eslint src --ext .js",
33
+ "lint:fix": "yarn lint --fix",
41
34
  "release": "release-it",
42
35
  "test": "jest"
43
36
  },
@@ -45,16 +38,17 @@
45
38
  "@adiwajshing/keyed-db": "^0.2.4",
46
39
  "@cacheable/node-cache": "^1.4.0",
47
40
  "@hapi/boom": "^9.1.3",
41
+ "acorn": "^8.15.0",
42
+ "acorn-walk": "^8.3.4",
48
43
  "async-mutex": "^0.5.0",
44
+ "audio-decode": "^2.1.3",
49
45
  "axios": "^1.6.0",
50
- "chalk": "^4.1.2",
51
- "gradient-string": "^2.0.2",
52
46
  "cache-manager": "^5.7.6",
47
+ "chalk": "^4.1.2",
53
48
  "cheerio": "^1.0.0-rc.10",
54
- "acorn": "^8.15.0",
55
- "acorn-walk": "^8.3.4",
49
+ "gradient-string": "^2.0.2",
56
50
  "libphonenumber-js": "^1.10.20",
57
- "libsignal": "npm:@shennmine/libsignal-node",
51
+ "libsignal": "npm:@10.vyzensja/lib-signal",
58
52
  "lodash": "^4.17.21",
59
53
  "music-metadata": "^7.12.3",
60
54
  "pino": "^9.6",
@@ -85,16 +79,12 @@
85
79
  "typescript": "^5.8.2"
86
80
  },
87
81
  "peerDependencies": {
88
- "audio-decode": "^2.1.3",
89
82
  "jimp": "^0.16.1",
90
83
  "link-preview-js": "^3.0.0",
91
84
  "qrcode-terminal": "^0.12.0",
92
85
  "sharp": "^0.34.1"
93
86
  },
94
87
  "peerDependenciesMeta": {
95
- "audio-decode": {
96
- "optional": true
97
- },
98
88
  "jimp": {
99
89
  "optional": true
100
90
  },
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 vyzen-baileysx
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
@@ -1,10 +0,0 @@
1
- const major = parseInt(process.versions.node.split('.')[0], 10);
2
-
3
- if (major < 20) {
4
- console.error(
5
- `\n❌ This package requires Node.js 20+ to run reliably.\n` +
6
- ` You are using Node.js ${process.versions.node}.\n` +
7
- ` Please upgrade to Node.js 20+ to proceed.\n`
8
- );
9
- process.exit(1);
10
- }
@@ -1,3 +0,0 @@
1
- {
2
- "version": [2, 3000, 1027934701]
3
- }
@@ -1,35 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getPlatformId = exports.Browsers = void 0;
4
-
5
- const os = require("os");
6
- const { proto } = require("../../WAProto/index.js");
7
-
8
- const PLATFORM_MAP = {
9
- 'aix': 'AIX',
10
- 'darwin': 'Mac OS',
11
- 'win32': 'Windows',
12
- 'android': 'Android',
13
- 'freebsd': 'FreeBSD',
14
- 'openbsd': 'OpenBSD',
15
- 'sunos': 'Solaris',
16
- 'linux': undefined, // Default ke Ubuntu untuk Linux
17
- 'haiku': undefined,
18
- 'cygwin': undefined,
19
- 'netbsd': undefined
20
- };
21
-
22
- // Fixed: Browsers sekarang fungsi yang return array [platform, browser, version]
23
- // Ini kompatibel dengan pemanggilan Browsers('Chrome') di Defaults/index.js
24
- exports.Browsers = (browser) => {
25
- const osName = PLATFORM_MAP[os.platform()] || 'Ubuntu'; // Default Ubuntu kalau undefined
26
- const osRelease = os.release(); // Ambil versi OS real-time
27
- return [osName, browser, osRelease];
28
- };
29
-
30
- const getPlatformId = (browser) => {
31
- const platformType = proto.DeviceProps.PlatformType[browser.toUpperCase()];
32
- return platformType ? platformType.toString() : '1'; // Default Chrome
33
- };
34
-
35
- exports.getPlatformId = getPlatformId;
@@ -1,128 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MessageRetryManager = void 0;
4
-
5
- const lru_cache_1 = require("lru-cache");
6
-
7
- const RECENT_MESSAGES_SIZE = 512;
8
-
9
- const RECREATE_SESSION_TIMEOUT = 60 * 60 * 1000;
10
-
11
- const PHONE_REQUEST_DELAY = 3000;
12
-
13
- class MessageRetryManager {
14
- constructor(logger, maxMsgRetryCount) {
15
- this.logger = logger;
16
- this.maxMsgRetryCount = maxMsgRetryCount;
17
- this._recentMessagesMap = new lru_cache_1.LRUCache({
18
- max: RECENT_MESSAGES_SIZE
19
- });
20
- this._sessionRecreateHistory = new lru_cache_1.LRUCache({
21
- ttl: RECREATE_SESSION_TIMEOUT * 2,
22
- ttlAutopurge: true
23
- });
24
- this._retryCounters = new lru_cache_1.LRUCache({
25
- ttl: 15 * 60 * 1000,
26
- ttlAutopurge: true,
27
- updateAgeOnGet: true
28
- });
29
- this._pendingPhoneRequests = {};
30
- this.statistics = {
31
- totalRetries: 0,
32
- successfulRetries: 0,
33
- failedRetries: 0,
34
- mediaRetries: 0,
35
- sessionRecreations: 0,
36
- phoneRequests: 0
37
- };
38
- this.maxMsgRetryCount = maxMsgRetryCount;
39
- }
40
- addRecentMessage(to, id, message) {
41
- const key = { to, id };
42
- const keyStr = this._keyToString(key);
43
- this._recentMessagesMap.set(keyStr, {
44
- message,
45
- timestamp: Date.now()
46
- });
47
- this.logger.debug(`Added message to retry cache: ${to}/${id}`);
48
- }
49
- getRecentMessage(to, id) {
50
- const key = { to, id };
51
- const keyStr = this._keyToString(key);
52
- return this._recentMessagesMap.get(keyStr);
53
- }
54
- shouldRecreateSession(jid, retryCount, hasSession) {
55
- if (!hasSession) {
56
- this._sessionRecreateHistory.set(jid, Date.now());
57
- this.statistics.sessionRecreations++;
58
- return {
59
- reason: "we don't have a Signal session with them",
60
- recreate: true
61
- };
62
- }
63
- if (retryCount < 2) {
64
- return { reason: '', recreate: false };
65
- }
66
- const now = Date.now();
67
- const prevTime = this._sessionRecreateHistory.get(jid);
68
- if (!prevTime || now - prevTime > RECREATE_SESSION_TIMEOUT) {
69
- this._sessionRecreateHistory.set(jid, now);
70
- this.statistics.sessionRecreations++;
71
- return {
72
- reason: 'retry count > 1 and over an hour since last recreation',
73
- recreate: true
74
- };
75
- }
76
- return { reason: '', recreate: false };
77
- }
78
- incrementRetryCount(messageId) {
79
- this._retryCounters.set(messageId, (this._retryCounters.get(messageId) || 0) + 1);
80
- this.statistics.totalRetries++;
81
- return this._retryCounters.get(messageId);
82
- }
83
- getRetryCount(messageId) {
84
- return this._retryCounters.get(messageId) || 0;
85
- }
86
- hasExceededMaxRetries(messageId) {
87
- return this.getRetryCount(messageId) >= this.maxMsgRetryCount;
88
- }
89
- markRetrySuccess(messageId) {
90
- this.statistics.successfulRetries++;
91
- this._retryCounters.delete(messageId);
92
- this._cancelPendingPhoneRequest(messageId);
93
- }
94
- markRetryFailed(messageId) {
95
- this.statistics.failedRetries++;
96
- this._retryCounters.delete(messageId);
97
- }
98
- schedulePhoneRequest(messageId, callback, delay = PHONE_REQUEST_DELAY) {
99
- this._cancelPendingPhoneRequest(messageId);
100
- this._pendingPhoneRequests[messageId] = setTimeout(() => {
101
- delete this._pendingPhoneRequests[messageId];
102
- this.statistics.phoneRequests++;
103
- callback();
104
- }, delay);
105
- this.logger.debug(`Scheduled phone request for message ${messageId} with ${delay}ms delay`);
106
- }
107
- cancelPendingPhoneRequest(messageId) {
108
- const timeout = this._pendingPhoneRequests[messageId];
109
- if (timeout) {
110
- clearTimeout(timeout);
111
- delete this._pendingPhoneRequests[messageId];
112
- this.logger.debug(`Cancelled pending phone request for message ${messageId}`);
113
- }
114
- }
115
- _keyToString(key) {
116
- return `${key.to}:${key.id}`;
117
- }
118
- _cancelPendingPhoneRequest(messageId) {
119
- const timeout = this._pendingPhoneRequests[messageId];
120
- if (timeout) {
121
- clearTimeout(timeout);
122
- delete this._pendingPhoneRequests[messageId];
123
- this.logger.debug(`Cancelled pending phone request for message ${messageId}`);
124
- }
125
- }
126
- }
127
-
128
- exports.MessageRetryManager = MessageRetryManager;