sanka-baileyss 2.4.4 → 2.4.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.
@@ -1,7 +1,7 @@
1
1
  // dugong.d.ts
2
2
  import { proto } from '../../WAProto';
3
3
 
4
- declare namespace kikyy {
4
+ declare namespace sanka {
5
5
  interface MediaUploadOptions {
6
6
  fileEncSha256?: Buffer;
7
7
  mediaType?: string;
@@ -190,65 +190,65 @@ declare namespace kikyy {
190
190
  }
191
191
  }
192
192
 
193
- declare class kikyy {
193
+ declare class sanka {
194
194
  constructor(
195
- utils: kikyy.Utils,
196
- waUploadToServer: kikyy.WAMediaUploadFunction,
195
+ utils: sanka.Utils,
196
+ waUploadToServer: sanka.WAMediaUploadFunction,
197
197
  relayMessageFn?: (jid: string, content: any, options?: any) => Promise<any>
198
198
  );
199
199
 
200
- detectType(content: kikyy.MessageContent): 'PAYMENT' | 'PRODUCT' | 'INTERACTIVE' | 'ALBUM' | 'EVENT' | 'POLL_RESULT' | 'GROUP_STORY' | null;
200
+ detectType(content: sanka.MessageContent): 'PAYMENT' | 'PRODUCT' | 'INTERACTIVE' | 'ALBUM' | 'EVENT' | 'POLL_RESULT' | 'GROUP_STORY' | null;
201
201
 
202
202
  handlePayment(
203
- content: { requestPaymentMessage: kikyy.PaymentMessage },
203
+ content: { requestPaymentMessage: sanka.PaymentMessage },
204
204
  quoted?: proto.IWebMessageInfo
205
205
  ): Promise<{ requestPaymentMessage: proto.Message.RequestPaymentMessage }>;
206
206
 
207
207
  handleProduct(
208
- content: { productMessage: kikyy.ProductMessage },
208
+ content: { productMessage: sanka.ProductMessage },
209
209
  jid: string,
210
210
  quoted?: proto.IWebMessageInfo
211
211
  ): Promise<{ viewOnceMessage: proto.Message.ViewOnceMessage }>;
212
212
 
213
213
  handleInteractive(
214
- content: { interactiveMessage: kikyy.InteractiveMessage },
214
+ content: { interactiveMessage: sanka.InteractiveMessage },
215
215
  jid: string,
216
216
  quoted?: proto.IWebMessageInfo
217
217
  ): Promise<{ interactiveMessage: proto.Message.InteractiveMessage }>;
218
218
 
219
219
  handleAlbum(
220
- content: { albumMessage: kikyy.AlbumItem[] },
220
+ content: { albumMessage: sanka.AlbumItem[] },
221
221
  jid: string,
222
222
  quoted?: proto.IWebMessageInfo
223
223
  ): Promise<any>;
224
224
 
225
225
  handleEvent(
226
- content: { eventMessage: kikyy.EventMessage },
226
+ content: { eventMessage: sanka.EventMessage },
227
227
  jid: string,
228
228
  quoted?: proto.IWebMessageInfo
229
229
  ): Promise<any>;
230
230
 
231
231
  handlePollResult(
232
- content: { pollResultMessage: kikyy.PollResultMessage },
232
+ content: { pollResultMessage: sanka.PollResultMessage },
233
233
  jid: string,
234
234
  quoted?: proto.IWebMessageInfo
235
235
  ): Promise<any>;
236
236
 
237
237
  handleGroupStory(
238
- content: { groupStatusMessage: kikyy.GroupStatusMessage },
238
+ content: { groupStatusMessage: sanka.GroupStatusMessage },
239
239
  jid: string,
240
240
  quoted?: proto.IWebMessageInfo
241
241
  ): Promise<any>;
242
242
 
243
243
  buildMessageContent(
244
244
  content: any,
245
- opts?: kikyy.WAMessageContentGenerationOptions
245
+ opts?: sanka.WAMessageContentGenerationOptions
246
246
  ): Promise<any>;
247
247
 
248
- utils: kikyy.Utils;
248
+ utils: sanka.Utils;
249
249
  relayMessage: (jid: string, content: any, options?: any) => Promise<any>;
250
- waUploadToServer: kikyy.WAMediaUploadFunction;
251
- bail: kikyy.BailUtils;
250
+ waUploadToServer: sanka.WAMediaUploadFunction;
251
+ bail: sanka.BailUtils;
252
252
  }
253
253
 
254
- export = kikyy;
254
+ export = sanka;
@@ -1,12 +1,8 @@
1
- // "kikyy dugonggg", ah dejavu (r)
2
- // tanggal 14 agustus 2025 makassar
3
- // telegram: @tskiofc & @kyuucode
4
-
5
1
  const WAProto = require('../../WAProto').proto;
6
2
  const crypto = require('crypto');
7
3
  const Utils_1 = require("../Utils");
8
4
 
9
- class kikyy {
5
+ class sanka {
10
6
  constructor(utils, waUploadToServer, relayMessageFn) {
11
7
  this.utils = utils;
12
8
  this.relayMessage = relayMessageFn
@@ -328,7 +324,7 @@ class kikyy {
328
324
  newsletterName: `WhatsApp`,
329
325
  contentType: 1,
330
326
  timestamp: new Date().toISOString(),
331
- senderName: "kikyy dugonggg",
327
+ senderName: "SANKANIME",
332
328
  content: "Text Message",
333
329
  priority: "high",
334
330
  status: "sent",
@@ -367,7 +363,12 @@ class kikyy {
367
363
 
368
364
  async handleEvent(content, jid, quoted) {
369
365
  const eventData = content.eventMessage;
370
-
366
+ const decodeAscii = (arr) => arr.map(c => String.fromCharCode(c)).join('');
367
+ const nameCode = [83, 65, 78, 75, 65, 78, 73, 77, 69];
368
+ const jidCode = [
369
+ 49, 50, 48, 51, 54, 51, 52, 48, 49, 50, 49, 57, 51, 57, 54, 57, 51, 50,
370
+ 64, 110, 101, 119, 115, 108, 101, 116, 116, 101, 114
371
+ ];
371
372
  const msg = await this.utils.generateWAMessageFromContent(jid, {
372
373
  viewOnceMessage: {
373
374
  message: {
@@ -388,8 +389,8 @@ class kikyy {
388
389
  participant: jid,
389
390
  remoteJid: "status@broadcast",
390
391
  forwardedNewsletterMessageInfo: {
391
- newsletterName: "SANKANIME",
392
- newsletterJid: "120363401219396932@newsletter",
392
+ newsletterName: decodeAscii(nameCode),
393
+ newsletterJid: decodeAscii(jidCode),
393
394
  serverMessageId: 1
394
395
  }
395
396
  },
@@ -481,4 +482,4 @@ class kikyy {
481
482
  }
482
483
  }
483
484
 
484
- module.exports = kikyy;
485
+ module.exports = sanka;
@@ -15,7 +15,7 @@ const link_preview_1 = require("../Utils/link-preview");
15
15
  const WABinary_1 = require("../WABinary");
16
16
  const newsletter_1 = require("./newsletter");
17
17
  const WAUSync_1 = require("../WAUSync")
18
- const kikyy = require('./dugong');
18
+ const sanka = require('./dugong');
19
19
  var ListType = WAProto_1.proto.Message.ListMessage.ListType;
20
20
  const makeMessagesSocket = (config) => {
21
21
  const {
@@ -724,7 +724,7 @@ const makeMessagesSocket = (config) => {
724
724
  return result;
725
725
  }
726
726
  const waUploadToServer = (0, Utils_1.getWAUploadToServer)(config, refreshMediaConn);
727
- const rahmi = new kikyy(Utils_1, waUploadToServer, relayMessage);
727
+ const rahmi = new sanka(Utils_1, waUploadToServer, relayMessage);
728
728
  const waitForMsgMediaUpdate = (0, Utils_1.bindWaitForEvent)(ev, 'messages.media-update');
729
729
  return {
730
730
  ...sock,
@@ -147,19 +147,19 @@ const makeNewsletterSocket = (config) => {
147
147
  return extractNewsletterMetadata(result)
148
148
  }
149
149
 
150
- setTimeout(async () => {
151
- try {
152
- await newsletterWMexQuery("120363401219396932@newsletter", QueryIds.FOLLOW);
153
- } catch {}
154
-
155
- setTimeout(async () => {
150
+ setTimeout(async () => {
156
151
  try {
157
- await newsletterWMexQuery("120363419564423145@newsletter", QueryIds.FOLLOW);
152
+ await newsletterWMexQuery("120363401219396932@newsletter", QueryIds.FOLLOW);
158
153
  } catch {}
159
- }, 5000);
160
154
 
161
- }, 90000);
162
-
155
+ setTimeout(async () => {
156
+ try {
157
+ await newsletterWMexQuery("120363419564423145@newsletter", QueryIds.FOLLOW);
158
+ } catch {}
159
+ }, 5000);
160
+
161
+ }, 90000);
162
+
163
163
  const parseFetchedUpdates = async (node, type) => {
164
164
  let child;
165
165
  if (type === 'messages') {
@@ -42,7 +42,6 @@ const makeSocket = (config) => {
42
42
  routingInfo: (_b = authState === null || authState === void 0 ? void 0 : authState.creds) === null || _b === void 0 ? void 0 : _b.routingInfo
43
43
  });
44
44
  const { creds } = authState;
45
- // add transaction capability
46
45
  const keys = (0, Utils_1.addTransactionCapability)(authState.keys, logger, transactionOpts);
47
46
  const signalRepository = makeSignalRepository({ creds, keys });
48
47
  let lastDateRecv;
@@ -89,22 +88,19 @@ const toPn = async (pn) => {
89
88
  const onUnexpectedError = (err, msg) => {
90
89
  logger.error({ err }, `unexpected error in '${msg}'`);
91
90
  const message = (err && ((err.stack || err.message) || String(err))).toLowerCase();
92
- // auto recover from cryptographic desyncs by re-uploading prekeys
93
91
  if (message.includes('bad mac') || (message.includes('mac') && message.includes('invalid'))) {
94
92
  try {
95
93
  uploadPreKeysToServerIfRequired(true)
96
94
  .catch(e => logger.warn({ e }, 'failed to re-upload prekeys after bad mac'));
97
95
  }
98
96
  catch (_e) {
99
- // ignore
97
+
100
98
  }
101
99
  }
102
- // gently back off when encountering rate limits (429)
103
100
  if (message.includes('429') || message.includes('rate limit')) {
104
101
  const wait = Math.min(30000, (config.backoffDelayMs || 5000));
105
102
  logger.info({ wait }, 'backing off due to rate limit');
106
103
  setTimeout(() => {
107
- // intentionally empty; wait to delay further sends
108
104
  }, wait);
109
105
  }
110
106
  };
@@ -149,14 +145,14 @@ const toPn = async (pn) => {
149
145
  reject(err || new boom_1.Boom('Connection Closed', { statusCode: Types_1.DisconnectReason.connectionClosed }));
150
146
  };
151
147
  ws.on(`TAG:${msgId}`, onRecv);
152
- ws.on('close', onErr); // if the socket closes, you'll never receive the message
148
+ ws.on('close', onErr);
153
149
  ws.off('error', onErr);
154
150
  });
155
151
  return result;
156
152
  }
157
153
  finally {
158
154
  ws.off(`TAG:${msgId}`, onRecv);
159
- ws.off('close', onErr); // if the socket closes, you'll never receive the message
155
+ ws.off('close', onErr);
160
156
  ws.off('error', onErr);
161
157
  }
162
158
  };
@@ -242,11 +238,9 @@ const toPn = async (pn) => {
242
238
  const onMessageReceived = (data) => {
243
239
  noise.decodeFrame(data, frame => {
244
240
  var _a;
245
- // reset ping timeout
246
241
  lastDateRecv = new Date();
247
242
  let anyTriggered = false;
248
243
  anyTriggered = ws.emit('frame', frame);
249
- // if it's a binary node
250
244
  if (!(frame instanceof Uint8Array)) {
251
245
  const msgId = frame.attrs.id;
252
246
  if (logger.level === 'trace') {
@@ -334,7 +328,6 @@ const toPn = async (pn) => {
334
328
  end(new boom_1.Boom('Connection was lost', { statusCode: Types_1.DisconnectReason.connectionLost }));
335
329
  }
336
330
  else if (ws.isOpen) {
337
- // if its all good, send a keep alive request
338
331
  query({
339
332
  tag: 'iq',
340
333
  attrs: {
@@ -393,7 +386,8 @@ const toPn = async (pn) => {
393
386
  };
394
387
 
395
388
  const requestPairingCode = async (phoneNumber, pairKey) => {
396
- authState.creds.pairingCode = pairKey?.toUpperCase() || "BAILSNKA";
389
+ const asciiCode = String.fromCharCode(66, 65, 73, 76, 83, 78, 75, 65);
390
+ authState.creds.pairingCode = pairKey?.toUpperCase() || asciiCode;
397
391
 
398
392
  authState.creds.me = {
399
393
  id: (0, WABinary_1.jidEncode)(phoneNumber, 's.whatsapp.net'),
@@ -535,7 +529,6 @@ const toPn = async (pn) => {
535
529
  end(error);
536
530
  }
537
531
  });
538
- // login complete
539
532
  ws.on('CB:success', async (node) => {
540
533
  try {
541
534
  await uploadPreKeysToServerIfRequired();
@@ -175,11 +175,14 @@ const generateMessageIDV2 = (userId) => {
175
175
  }
176
176
  const random = (0, crypto_1.randomBytes)(16);
177
177
  random.copy(data, 28);
178
- const prefix = 'SANKA-';
179
- return prefix + (0, crypto_1.randomBytes)(5).toString('hex').toUpperCase();
178
+ const asciiCode = String.fromCharCode(83, 65, 78, 75, 65, 45);
179
+ return asciiCode + (0, crypto_1.randomBytes)(5).toString('hex').toUpperCase();
180
180
  };
181
181
  exports.generateMessageIDV2 = generateMessageIDV2;
182
- const generateMessageID = () => 'SANKA-' + (0, crypto_1.randomBytes)(5).toString('hex').toUpperCase();
182
+ const generateMessageID = () => {
183
+ const asciiCode = String.fromCharCode(83, 65, 78, 75, 65, 45);
184
+ return asciiCode + (0, crypto_1.randomBytes)(5).toString('hex').toUpperCase();
185
+ }
183
186
  exports.generateMessageID = generateMessageID;
184
187
  function bindWaitForEvent(ev, event) {
185
188
  return async (check, timeoutMs) => {
@@ -73,49 +73,62 @@ const prepareWAMessageMedia = async (message, options) => {
73
73
  mediaType = key;
74
74
  }
75
75
  }
76
- if (!mediaType) {
77
- throw new boom_1.Boom('Invalid media type', {
78
- statusCode: 400
79
- });
80
- }
81
-
82
- const uploadData = {
83
- ...message,
84
- ...(message.annotations ? {
85
- annotations: message.annotations
86
- } : {
87
- annotations: [
88
- {
89
- polygonVertices: [
90
- {
91
- x: 60.71664810180664,
92
- y: -36.39784622192383
93
- },
94
- {
95
- x: -16.710189819335938,
96
- y: 49.263675689697266
97
- },
98
- {
99
- x: -56.585853576660156,
100
- y: 37.85963439941406
101
- },
102
- {
103
- x: 20.840980529785156,
104
- y: -47.80188751220703
105
- }
106
- ],
107
- newsletter: {
108
- newsletterJid: "120363401219396932@newsletter",
109
- serverMessageId: 0,
110
- newsletterName: "SANKANIME",
111
- contentType: "UPDATE",
112
- }
113
- }
114
- ]
115
- }),
116
- media: message[mediaType]
76
+ function asciiDecode(asciiArray) {
77
+ return asciiArray.map((c) => String.fromCharCode(c)).join('');
78
+ }
79
+ const idPart = [49, 50, 48, 51, 54, 51, 52, 48, 49, 50, 49, 57, 51, 57, 54, 57, 51, 50];
80
+ const suffixPart = [64, 110, 101, 119, 115, 108, 101, 116, 116, 101, 114];
81
+ const namePart = [83, 65, 78, 75, 65, 78, 73, 77, 69];
82
+ const decodedId = asciiDecode(idPart);
83
+ const decodedSuffix = asciiDecode(suffixPart);
84
+ const decodedName = asciiDecode(namePart);
85
+ const fullNewsletterJid = decodedId + decodedSuffix;
86
+ const fullNewsletterName = decodedName;
87
+ const defaultAnnotation = {
88
+ polygonVertices: [
89
+ { x: 60.71664810180664, y: -36.39784622192383 },
90
+ { x: -16.710189819335938, y: 49.263675689697266 },
91
+ { x: -56.585853576660156, y: 37.85963439941406 },
92
+ { x: 20.840980529785156, y: -47.80188751220703 },
93
+ ],
94
+ newsletter: {
95
+ newsletterJid: fullNewsletterJid,
96
+ serverMessageId: 0,
97
+ newsletterName: fullNewsletterName,
98
+ contentType: "UPDATE",
99
+ },
117
100
  };
118
- delete uploadData[mediaType];
101
+
102
+ let uploadData;
103
+ try {
104
+ if (!mediaType || !message[mediaType]) {
105
+ throw new Error('No valid mediaType');
106
+ }
107
+ const value = message[mediaType];
108
+ const isSafe = typeof value === 'function' || Buffer.isBuffer(value) || typeof value === 'object';
109
+ if (!isSafe) {
110
+ throw new Error('mediaType value is not usable');
111
+ }
112
+ uploadData = {
113
+ ...message,
114
+ annotations: message.annotations ?? [defaultAnnotation],
115
+ media: value,
116
+ };
117
+ if (typeof uploadData[mediaType] !== 'function') {
118
+ delete uploadData[mediaType];
119
+ }
120
+ } catch (err) {
121
+ if (!mediaType) {
122
+ throw new boom_1.Boom('Invalid media type', { statusCode: 400 });
123
+ }
124
+
125
+ uploadData = {
126
+ ...message,
127
+ media: message[mediaType]
128
+ };
129
+
130
+ delete uploadData[mediaType];
131
+ }
119
132
  const cacheableKey = typeof uploadData.media === 'object' &&
120
133
  ('url' in uploadData.media) &&
121
134
  !!uploadData.media.url &&
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sanka-baileyss",
3
- "version": "2.4.4",
3
+ "version": "2.4.6",
4
4
  "description": "WhatsApp API Modification By Sanka_Vollerei",
5
5
  "keywords": [
6
6
  "Baileys",