@queenanya/baileys 6.6.6 → 6.7.0

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 (44) hide show
  1. package/CHANGELOG.md +1 -5
  2. package/README.md +31 -93
  3. package/WAProto/WAProto.proto +473 -8
  4. package/WAProto/index.d.ts +4793 -22
  5. package/WAProto/index.js +32548 -19335
  6. package/lib/Defaults/baileys-version.json +1 -1
  7. package/lib/Defaults/index.d.ts +2 -2
  8. package/lib/Defaults/index.js +6 -2
  9. package/lib/Socket/business.d.ts +9 -0
  10. package/lib/Socket/chats.d.ts +4 -0
  11. package/lib/Socket/chats.js +13 -1
  12. package/lib/Socket/groups.d.ts +6 -0
  13. package/lib/Socket/groups.js +9 -2
  14. package/lib/Socket/index.d.ts +9 -0
  15. package/lib/Socket/messages-recv.d.ts +9 -0
  16. package/lib/Socket/messages-recv.js +29 -7
  17. package/lib/Socket/messages-send.d.ts +7 -0
  18. package/lib/Socket/messages-send.js +7 -4
  19. package/lib/Socket/registration.d.ts +9 -0
  20. package/lib/Socket/socket.js +3 -2
  21. package/lib/Store/make-cache-manager-store.d.ts +0 -1
  22. package/lib/Types/Call.d.ts +1 -0
  23. package/lib/Types/Contact.d.ts +1 -0
  24. package/lib/Types/Events.d.ts +5 -0
  25. package/lib/Types/GroupMetadata.d.ts +2 -0
  26. package/lib/Types/Message.d.ts +7 -1
  27. package/lib/Types/Socket.d.ts +2 -0
  28. package/lib/Types/index.d.ts +3 -1
  29. package/lib/Types/index.js +2 -0
  30. package/lib/Utils/chat-utils.js +14 -0
  31. package/lib/Utils/decode-wa-message.d.ts +2 -2
  32. package/lib/Utils/decode-wa-message.js +18 -4
  33. package/lib/Utils/generics.d.ts +1 -0
  34. package/lib/Utils/generics.js +1 -0
  35. package/lib/Utils/messages-media.js +1 -1
  36. package/lib/Utils/messages.d.ts +1 -1
  37. package/lib/Utils/messages.js +11 -5
  38. package/lib/Utils/process-message.js +27 -4
  39. package/lib/Utils/validate-connection.js +33 -2
  40. package/lib/WABinary/decode.js +1 -1
  41. package/lib/WABinary/encode.js +3 -3
  42. package/lib/WABinary/jid-utils.d.ts +4 -2
  43. package/lib/WABinary/jid-utils.js +6 -3
  44. package/package.json +5 -5
package/CHANGELOG.md CHANGED
@@ -1,8 +1,4 @@
1
- # [6.5.0](https://github.com/WhiskeySockets/Baileys/compare/v6.4.2...v6.5.0) (2023-09-28)
2
-
3
-
4
-
5
- ## 6.4.2 (2023-09-28)
1
+ # 6.6.0 (2024-01-19)
6
2
 
7
3
 
8
4
 
package/README.md CHANGED
@@ -134,6 +134,8 @@ type SocketConfig = {
134
134
  customUploadHosts: MediaConnInfo['hosts']
135
135
  /** time to wait between sending new retry requests */
136
136
  retryRequestDelayMs: number
137
+ /** max msg retry count */
138
+ maxMsgRetryCount: number
137
139
  /** time to wait for the generation of the next QR in ms */
138
140
  qrTimeout?: number;
139
141
  /** provide an auth state object to maintain the auth state */
@@ -376,65 +378,6 @@ const sentMsg = await sock.sendMessage(
376
378
  }
377
379
  )
378
380
 
379
- // send a buttons message!
380
- const buttons = [
381
- {buttonId: 'id1', buttonText: {displayText: 'Button 1'}, type: 1},
382
- {buttonId: 'id2', buttonText: {displayText: 'Button 2'}, type: 1},
383
- {buttonId: 'id3', buttonText: {displayText: 'Button 3'}, type: 1}
384
- ]
385
-
386
- const buttonMessage = {
387
- text: "Hi it's button message",
388
- footer: 'Hello World',
389
- buttons: buttons,
390
- headerType: 1
391
- }
392
-
393
- const sendMsg = await sock.sendMessage(id, buttonMessage)
394
-
395
- //send a template message!
396
- const templateButtons = [
397
- {index: 1, urlButton: {displayText: '⭐ Star Baileys on GitHub!', url: 'https://github.com/adiwajshing/Baileys'}},
398
- {index: 2, callButton: {displayText: 'Call me!', phoneNumber: '+1 (234) 5678-901'}},
399
- {index: 3, quickReplyButton: {displayText: 'This is a reply, just like normal buttons!', id: 'id-like-buttons-message'}},
400
- ]
401
-
402
- const templateMessage = {
403
- text: "Hi it's a template message",
404
- footer: 'Hello World',
405
- templateButtons: templateButtons
406
- }
407
-
408
- const sendMsg = await sock.sendMessage(id, templateMessage)
409
-
410
- // send a list message!
411
- const sections = [
412
- {
413
- title: "Section 1",
414
- rows: [
415
- {title: "Option 1", rowId: "option1"},
416
- {title: "Option 2", rowId: "option2", description: "This is a description"}
417
- ]
418
- },
419
- {
420
- title: "Section 2",
421
- rows: [
422
- {title: "Option 3", rowId: "option3"},
423
- {title: "Option 4", rowId: "option4", description: "This is a description V2"}
424
- ]
425
- },
426
- ]
427
-
428
- const listMessage = {
429
- text: "This is a list",
430
- footer: "nice footer, link: https://google.com",
431
- title: "Amazing boldfaced list title",
432
- buttonText: "Required, text on the button to view the list",
433
- sections
434
- }
435
-
436
- const sendMsg = await sock.sendMessage(id, listMessage)
437
-
438
381
  const reactionMessage = {
439
382
  react: {
440
383
  text: "💖", // use an empty string to remove the reaction
@@ -489,39 +432,6 @@ await sock.sendMessage(
489
432
  { audio: { url: "./Media/audio.mp3" }, mimetype: 'audio/mp4' }
490
433
  { url: "Media/audio.mp3" }, // can send mp3, mp4, & ogg
491
434
  )
492
-
493
- // send a buttons message with image header!
494
- const buttons = [
495
- {buttonId: 'id1', buttonText: {displayText: 'Button 1'}, type: 1},
496
- {buttonId: 'id2', buttonText: {displayText: 'Button 2'}, type: 1},
497
- {buttonId: 'id3', buttonText: {displayText: 'Button 3'}, type: 1}
498
- ]
499
-
500
- const buttonMessage = {
501
- image: {url: 'https://example.com/image.jpeg'},
502
- caption: "Hi it's button message",
503
- footer: 'Hello World',
504
- buttons: buttons,
505
- headerType: 4
506
- }
507
-
508
- const sendMsg = await sock.sendMessage(id, buttonMessage)
509
-
510
- //send a template message with an image **attached**!
511
- const templateButtons = [
512
- {index: 1, urlButton: {displayText: '⭐ Star Baileys on GitHub!', url: 'https://github.com/adiwajshing/Baileys'}},
513
- {index: 2, callButton: {displayText: 'Call me!', phoneNumber: '+1 (234) 5678-901'}},
514
- {index: 3, quickReplyButton: {displayText: 'This is a reply, just like normal buttons!', id: 'id-like-buttons-message'}},
515
- ]
516
-
517
- const buttonMessage = {
518
- text: "Hi it's a template message",
519
- footer: 'Hello World',
520
- templateButtons: templateButtons,
521
- image: {url: 'https://example.com/image.jpeg'}
522
- }
523
-
524
- const sendMsg = await sock.sendMessage(id, templateMessage)
525
435
  ```
526
436
 
527
437
  ### Notes
@@ -648,6 +558,17 @@ await sock.sendMessage(jid, { delete: response.key })
648
558
 
649
559
  **Note:** deleting for oneself is supported via `chatModify` (next section)
650
560
 
561
+ ## Updating Messages
562
+
563
+ ``` ts
564
+ const jid = '1234@s.whatsapp.net'
565
+
566
+ await sock.sendMessage(jid, {
567
+ text: 'updated text goes here',
568
+ edit: response.key,
569
+ });
570
+ ```
571
+
651
572
  ## Modifying Chats
652
573
 
653
574
  WA uses an encrypted form of communication to send chat/app updates. This has been implemented mostly and you can send the following updates:
@@ -698,6 +619,15 @@ WA uses an encrypted form of communication to send chat/app updates. This has be
698
619
  },
699
620
  '123456@s.whatsapp.net')
700
621
  ```
622
+
623
+ - Star/unstar a message
624
+ ``` ts
625
+ await sock.chatModify({
626
+ star: {
627
+ messages: [{ id: 'messageID', fromMe: true // or `false` }],
628
+ star: true // - true: Star Message; false: Unstar Message
629
+ }},'123456@s.whatsapp.net');
630
+ ```
701
631
 
702
632
  **Note:** if you mess up one of your updates, WA can log you out of all your devices and you'll have to log in again.
703
633
 
@@ -914,7 +844,15 @@ Of course, replace ``` xyz ``` with an actual ID.
914
844
  ```
915
845
  ## Broadcast Lists & Stories
916
846
 
917
- **Note:** messages currently cannot be sent to broadcast lists from the MD version.
847
+ Messages can be sent to broadcasts & stories.
848
+ you need to add the following message options in sendMessage, like this:
849
+ ```ts
850
+ sock.sendMessage(jid, {image: {url: url}, caption: caption}, {backgroundColor : backgroundColor, font : font, statusJidList: statusJidList, broadcast : true})
851
+ ```
852
+ - the message body can be a extendedTextMessage or imageMessage or videoMessage or voiceMessage
853
+ - You can add backgroundColor and other options in the message options
854
+ - broadcast: true enables broadcast mode
855
+ - statusJidList: a list of people that you can get which you need to provide, which are the people who will get this status message.
918
856
 
919
857
  - You can send messages to broadcast lists the same way you send messages to groups & individual chats.
920
858
  - Right now, WA Web does not support creating broadcast lists, but you can still delete them.