@realvare/based 2.7.62 → 2.7.70

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.
Files changed (42) hide show
  1. package/README.MD +25 -114
  2. package/WAProto/WAProto.proto +1073 -244
  3. package/WAProto/index.d.ts +16282 -8183
  4. package/WAProto/index.js +76605 -50628
  5. package/engine-requirements.js +10 -10
  6. package/lib/Defaults/baileys-version.json +1 -1
  7. package/lib/Defaults/index.d.ts +1 -1
  8. package/lib/Defaults/index.js +5 -5
  9. package/lib/Socket/chats.js +53 -16
  10. package/lib/Socket/groups.js +53 -9
  11. package/lib/Socket/messages-recv.js +1298 -1228
  12. package/lib/Socket/messages-send.js +350 -456
  13. package/lib/Socket/socket.js +1 -1
  14. package/lib/Socket/usync.js +57 -4
  15. package/lib/Store/make-in-memory-store.js +28 -15
  16. package/lib/Types/Message.d.ts +316 -6
  17. package/lib/Types/Message.js +1 -1
  18. package/lib/Utils/cache-manager.d.ts +16 -0
  19. package/lib/Utils/cache-manager.js +20 -4
  20. package/lib/Utils/chat-utils.js +17 -13
  21. package/lib/Utils/decode-wa-message.js +1 -11
  22. package/lib/Utils/event-buffer.js +103 -2
  23. package/lib/Utils/generics.js +4 -5
  24. package/lib/Utils/index.d.ts +5 -0
  25. package/lib/Utils/index.js +3 -0
  26. package/lib/Utils/jid-validation.d.ts +2 -0
  27. package/lib/Utils/jid-validation.js +36 -5
  28. package/lib/Utils/link-preview.js +38 -28
  29. package/lib/Utils/messages-media.js +21 -52
  30. package/lib/Utils/messages.js +540 -23
  31. package/lib/Utils/performance-config.d.ts +2 -0
  32. package/lib/Utils/performance-config.js +16 -7
  33. package/lib/Utils/process-message.js +124 -12
  34. package/lib/Utils/rate-limiter.js +15 -20
  35. package/lib/WABinary/jid-utils.js +257 -5
  36. package/lib/WAUSync/Protocols/USyncContactProtocol.js +75 -5
  37. package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +59 -6
  38. package/lib/WAUSync/USyncQuery.js +64 -6
  39. package/lib/index.d.ts +1 -0
  40. package/lib/index.js +5 -2
  41. package/package.json +7 -13
  42. package/WAProto/index.ts.ts +0 -53473
package/README.MD CHANGED
@@ -593,95 +593,33 @@ await conn.sendMessage(jid, {
593
593
  ```
594
594
 
595
595
  #### Advanced Media
596
-
597
596
  ```typescript
598
597
  // Album (Multiple images)
599
598
  await conn.sendMessage(jid, {
600
599
  album: imageBuffers.map(buffer => ({ image: buffer })),
601
600
  caption: 'ts gettin real'
602
601
  });
603
- ```
604
-
605
- #### Stickers
606
602
 
607
- Sending stickers is supported. You can send a sticker from a URL or a buffer. For creating stickers from images, you can use an external library like `wa-sticker-formatter`.
608
-
609
- ```typescript
610
- // Sticker from URL
603
+ // Sticker
611
604
  await conn.sendMessage(jid, {
612
605
  sticker: { url: './stickers/sticker.webp' }
613
606
  });
614
607
 
615
- // Sticker from buffer using wa-sticker-formatter
616
- const { Sticker } = require('wa-sticker-formatter'); // Optional external library
617
- const sticker = new Sticker('path/to/image.jpg', { pack: 'My Pack', author: 'My Bot' });
618
- const buffer = await sticker.toBuffer();
619
- await conn.sendMessage(jid, { sticker: buffer });
620
- ```
621
-
622
- ##### Sticker Packs
623
-
624
- While WhatsApp supports installable sticker packs, Baileys (and this fork) does not have a native feature to create or send a pack as a single multi-sticker message (`StickerPackMessage`). This is a requested feature in Baileys (see issues [#1548](https://github.com/WhiskeySockets/Baileys/issues/1548)), but not yet implemented.
625
-
626
- However, the library provides a way to send a sticker pack by sending a metadata message followed by the individual stickers. This simulates a sticker pack in the chat.
627
-
628
- Here is how you can send a sticker pack:
629
-
630
- ```typescript
631
- import { Sticker } from 'wa-sticker-formatter';
632
-
633
- const sticker1 = new Sticker('path/to/image1.png', { pack: 'My Sticker Pack', author: 'Me' });
634
- const sticker2 = new Sticker('path/to/image2.png', { pack: 'My Sticker Pack', author: 'Me' });
635
-
636
- const stickerPack = {
637
- name: 'My Sticker Pack',
638
- publisher: 'My Bot',
639
- description: 'A cool sticker pack',
640
- cover: 'path/to/cover.png', // or a buffer
641
- stickers: [
642
- {
643
- sticker: await sticker1.toBuffer(),
644
- emojis: ['🎉', '🎊'],
645
- },
646
- {
647
- sticker: await sticker2.toBuffer(),
648
- emojis: ['😄', '😊'],
649
- }
650
- ]
651
- };
652
-
653
- await conn.sendMessage(jid, { stickerPack: stickerPack });
654
- ```
655
-
656
- Alternatively, you can simulate a pack by sending multiple stickers in sequence with a small delay between them:
657
-
658
- ```typescript
659
- // Simulate a pack by sending multiple stickers
660
- const stickers = ['sticker1.webp', 'sticker2.webp'];
661
- for (const url of stickers) {
662
- await conn.sendMessage(jid, { sticker: { url } });
663
- await new Promise(resolve => setTimeout(resolve, 500)); // Small delay
664
- }
665
- ```
666
- To create actual sticker packs that users can install, you should use external tools like the official WhatsApp Sticker Maker app. You can then integrate the individual stickers into your bot.
667
-
668
- ##### Stickers on Status (2025 Feature)
669
-
670
- The new interactive stickers on Status (e.g., with lyrics or questions) can be sent by sending a sticker to `status@broadcast`.
671
-
672
- ```typescript
673
- await conn.sendMessage('status@broadcast', {
674
- sticker: { url: './sticker.webp' },
675
- caption: 'Interactive sticker on Status'
676
- }, { statusJidList: ['user1@s.whatsapp.net', 'user2@s.whatsapp.net'] });
608
+ // Location message
609
+ await conn.sendMessage(jid, {
610
+ location: {
611
+ degreesLatitude: 45.4642,
612
+ degreesLongitude: 9.1900,
613
+ name: "Milano",
614
+ address: "Piazza del Duomo, Milano"
615
+ }
616
+ });
677
617
  ```
678
618
 
679
619
  #### Interactive Messages
680
-
681
- These messages include interactive elements like buttons, lists, and polls.
620
+ These messages include interactive elements like buttons, lists, and templates.
682
621
 
683
622
  ##### Messages with Simple Buttons
684
-
685
623
  Send quick reply buttons.
686
624
 
687
625
  ```typescript
@@ -689,16 +627,15 @@ await conn.sendMessage(jid, {
689
627
  text: 'Choose an option:',
690
628
  footer: 'Footer',
691
629
  buttons: [
692
- { buttonId: 'cmd1', buttonText: { displayText: 'Option 1' }, type: 1 },
693
- { buttonId: 'cmd2', buttonText: { displayText: 'Option 2' }, type: 1 },
630
+ { buttonId: 'cmd1', buttonText: { displayText: 'text1' }, type: 1 },
631
+ { buttonId: 'cmd2', buttonText: { displayText: 'text2' }, type: 1 },
694
632
  ],
695
633
  headerType: 1,
696
634
  });
697
635
  ```
698
636
 
699
637
  ##### Messages with Buttons and Image
700
-
701
- Combine an image with buttons.
638
+ Combine image with buttons.
702
639
 
703
640
  ```typescript
704
641
  await conn.sendMessage(jid, {
@@ -712,8 +649,7 @@ await conn.sendMessage(jid, {
712
649
  ```
713
650
 
714
651
  ##### List Messages
715
-
716
- Send a list of options (only in private chats).
652
+ Send a list of options (only in private).
717
653
 
718
654
  ```typescript
719
655
  await conn.sendMessage(jid, {
@@ -733,29 +669,6 @@ await conn.sendMessage(jid, {
733
669
  });
734
670
  ```
735
671
 
736
- ##### Poll Messages
737
-
738
- Create a poll for users to vote on.
739
-
740
- ```typescript
741
- await conn.sendMessage(jid, {
742
- poll: {
743
- name: 'Favorite Anime?',
744
- values: ['Aot', 'Bleach', 'Death note'],
745
- selectableCount: 1 // or >1 for multi-select
746
- }
747
- });
748
- ```
749
-
750
- #### New Interactive Features (2025)
751
-
752
- WhatsApp introduced several new features in 2025. Here's how to handle them with Baileys:
753
-
754
- - **Missed Call Messages**: Baileys is primarily for messaging and does not handle calls. To approximate this feature, you could potentially listen for call events (if supported) and then send a voice or video note as a follow-up message.
755
- - **Interactive Stickers on Status**: As shown in the sticker section, you can send stickers to `status@broadcast` with an interactive caption.
756
- - **AI-Generated Images**: This is not a native Baileys feature. You need to integrate an external AI image generation API (like Meta AI), generate the image, and then send it as a regular image message.
757
- - **Advanced Interactive Messages**: Features like "native flow" are partially supported in some forks (see issue [#398](https://github.com/WhiskeySockets/Baileys/issues/398)).
758
-
759
672
  #### Other Messages
760
673
  ```typescript
761
674
  // Message with quote
@@ -764,16 +677,6 @@ await conn.sendMessage(jid, {
764
677
  quoted: quotedMessage // The message to quote/reply/cite
765
678
  });
766
679
 
767
- // Location message
768
- await conn.sendMessage(jid, {
769
- location: {
770
- degreesLatitude: 45.4642,
771
- degreesLongitude: 9.1900,
772
- name: "Milano",
773
- address: "Piazza del Duomo, Milano"
774
- }
775
- });
776
-
777
680
  // Contact Messages
778
681
  await conn.sendMessage(jid, {
779
682
  contacts: {
@@ -782,6 +685,15 @@ await conn.sendMessage(jid, {
782
685
  }
783
686
  });
784
687
 
688
+ // Poll Messages (Survey)
689
+ await conn.sendMessage(jid, {
690
+ poll: {
691
+ name: 'Favorite Anime?',
692
+ values: ['Aot', 'Bleach', 'Death note'],
693
+ selectableCount: 1 // how many choices possible
694
+ }
695
+ });
696
+
785
697
  // Ephemeral Messages (Self-Destructing)
786
698
  await conn.sendMessage(jid, {
787
699
  text: "This message will self-destruct {hopefully like israel}"
@@ -1464,5 +1376,4 @@ See [LICENSE](LICENSE) for details.
1464
1376
 
1465
1377
  <br>
1466
1378
  <img src="https://capsule-render.vercel.app/api?type=waving&color=gradient&customColorList=24&height=120&section=footer&text=&fontSize=30&fontColor=ffffff&animation=fadeIn&fontAlignY=35"/>
1467
-
1468
- </div>
1379
+ </div>