@d0v3riz/baileys 6.7.25 → 7.0.0-rc.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.
Files changed (218) hide show
  1. package/README.md +53 -50
  2. package/WAProto/GenerateStatics.sh +2 -2
  3. package/WAProto/WAProto.proto +1339 -493
  4. package/WAProto/fix-imports.js +1 -1
  5. package/WAProto/index.d.ts +4585 -44041
  6. package/WAProto/index.js +80831 -148208
  7. package/lib/Defaults/index.d.ts +13 -3
  8. package/lib/Defaults/index.d.ts.map +1 -1
  9. package/lib/Defaults/index.js +27 -13
  10. package/lib/Defaults/index.js.map +1 -1
  11. package/lib/Signal/Group/group_cipher.d.ts +1 -2
  12. package/lib/Signal/Group/group_cipher.d.ts.map +1 -1
  13. package/lib/Signal/Group/group_cipher.js +29 -41
  14. package/lib/Signal/Group/group_cipher.js.map +1 -1
  15. package/lib/Signal/Group/keyhelper.d.ts.map +1 -1
  16. package/lib/Signal/Group/keyhelper.js +0 -1
  17. package/lib/Signal/Group/keyhelper.js.map +1 -1
  18. package/lib/Signal/Group/sender-chain-key.d.ts +1 -1
  19. package/lib/Signal/Group/sender-chain-key.d.ts.map +1 -1
  20. package/lib/Signal/Group/sender-chain-key.js +1 -7
  21. package/lib/Signal/Group/sender-chain-key.js.map +1 -1
  22. package/lib/Signal/Group/sender-key-distribution-message.js +2 -2
  23. package/lib/Signal/Group/sender-key-distribution-message.js.map +1 -1
  24. package/lib/Signal/Group/sender-key-message.d.ts.map +1 -1
  25. package/lib/Signal/Group/sender-key-message.js +0 -1
  26. package/lib/Signal/Group/sender-key-message.js.map +1 -1
  27. package/lib/Signal/Group/sender-key-record.d.ts +1 -1
  28. package/lib/Signal/Group/sender-key-record.d.ts.map +1 -1
  29. package/lib/Signal/Group/sender-key-record.js +2 -11
  30. package/lib/Signal/Group/sender-key-record.js.map +1 -1
  31. package/lib/Signal/Group/sender-key-state.d.ts +4 -4
  32. package/lib/Signal/Group/sender-key-state.d.ts.map +1 -1
  33. package/lib/Signal/Group/sender-key-state.js +21 -33
  34. package/lib/Signal/Group/sender-key-state.js.map +1 -1
  35. package/lib/Signal/Group/sender-message-key.d.ts.map +1 -1
  36. package/lib/Signal/Group/sender-message-key.js +0 -1
  37. package/lib/Signal/Group/sender-message-key.js.map +1 -1
  38. package/lib/Signal/libsignal.d.ts +4 -3
  39. package/lib/Signal/libsignal.d.ts.map +1 -1
  40. package/lib/Signal/libsignal.js +243 -42
  41. package/lib/Signal/libsignal.js.map +1 -1
  42. package/lib/Signal/lid-mapping.d.ts +23 -0
  43. package/lib/Signal/lid-mapping.d.ts.map +1 -0
  44. package/lib/Signal/lid-mapping.js +171 -0
  45. package/lib/Signal/lid-mapping.js.map +1 -0
  46. package/lib/Socket/Client/types.d.ts +2 -2
  47. package/lib/Socket/Client/types.d.ts.map +1 -1
  48. package/lib/Socket/Client/websocket.d.ts +2 -2
  49. package/lib/Socket/Client/websocket.d.ts.map +1 -1
  50. package/lib/Socket/Client/websocket.js +2 -2
  51. package/lib/Socket/Client/websocket.js.map +1 -1
  52. package/lib/Socket/business.d.ts +31 -17
  53. package/lib/Socket/business.d.ts.map +1 -1
  54. package/lib/Socket/business.js +122 -1
  55. package/lib/Socket/business.js.map +1 -1
  56. package/lib/Socket/chats.d.ts +17 -9
  57. package/lib/Socket/chats.d.ts.map +1 -1
  58. package/lib/Socket/chats.js +54 -23
  59. package/lib/Socket/chats.js.map +1 -1
  60. package/lib/Socket/communities.d.ts +41 -14
  61. package/lib/Socket/communities.d.ts.map +1 -1
  62. package/lib/Socket/communities.js +83 -3
  63. package/lib/Socket/communities.js.map +1 -1
  64. package/lib/Socket/groups.d.ts +16 -9
  65. package/lib/Socket/groups.d.ts.map +1 -1
  66. package/lib/Socket/groups.js +14 -11
  67. package/lib/Socket/groups.js.map +1 -1
  68. package/lib/Socket/index.d.ts +41 -14
  69. package/lib/Socket/index.d.ts.map +1 -1
  70. package/lib/Socket/index.js +1 -0
  71. package/lib/Socket/index.js.map +1 -1
  72. package/lib/Socket/messages-recv.d.ts +26 -16
  73. package/lib/Socket/messages-recv.d.ts.map +1 -1
  74. package/lib/Socket/messages-recv.js +512 -311
  75. package/lib/Socket/messages-recv.js.map +1 -1
  76. package/lib/Socket/messages-send.d.ts +27 -16
  77. package/lib/Socket/messages-send.d.ts.map +1 -1
  78. package/lib/Socket/messages-send.js +394 -133
  79. package/lib/Socket/messages-send.js.map +1 -1
  80. package/lib/Socket/newsletter.d.ts +18 -12
  81. package/lib/Socket/newsletter.d.ts.map +1 -1
  82. package/lib/Socket/newsletter.js +3 -1
  83. package/lib/Socket/newsletter.js.map +1 -1
  84. package/lib/Socket/socket.d.ts +13 -3
  85. package/lib/Socket/socket.d.ts.map +1 -1
  86. package/lib/Socket/socket.js +353 -78
  87. package/lib/Socket/socket.js.map +1 -1
  88. package/lib/Types/Auth.d.ts +12 -1
  89. package/lib/Types/Auth.d.ts.map +1 -1
  90. package/lib/Types/Bussines.d.ts +25 -0
  91. package/lib/Types/Bussines.d.ts.map +1 -0
  92. package/lib/Types/Bussines.js +2 -0
  93. package/lib/Types/Bussines.js.map +1 -0
  94. package/lib/Types/Chat.d.ts +5 -0
  95. package/lib/Types/Chat.d.ts.map +1 -1
  96. package/lib/Types/Chat.js.map +1 -1
  97. package/lib/Types/Contact.d.ts +4 -4
  98. package/lib/Types/Contact.d.ts.map +1 -1
  99. package/lib/Types/Events.d.ts +8 -5
  100. package/lib/Types/Events.d.ts.map +1 -1
  101. package/lib/Types/GroupMetadata.d.ts +7 -4
  102. package/lib/Types/GroupMetadata.d.ts.map +1 -1
  103. package/lib/Types/Message.d.ts +38 -12
  104. package/lib/Types/Message.d.ts.map +1 -1
  105. package/lib/Types/Message.js +5 -1
  106. package/lib/Types/Message.js.map +1 -1
  107. package/lib/Types/Signal.d.ts +18 -0
  108. package/lib/Types/Signal.d.ts.map +1 -1
  109. package/lib/Types/Socket.d.ts +24 -13
  110. package/lib/Types/Socket.d.ts.map +1 -1
  111. package/lib/Types/Socket.js.map +1 -1
  112. package/lib/Utils/auth-utils.d.ts +2 -2
  113. package/lib/Utils/auth-utils.d.ts.map +1 -1
  114. package/lib/Utils/auth-utils.js +178 -111
  115. package/lib/Utils/auth-utils.js.map +1 -1
  116. package/lib/Utils/browser-utils.d.ts +4 -0
  117. package/lib/Utils/browser-utils.d.ts.map +1 -0
  118. package/lib/Utils/browser-utils.js +28 -0
  119. package/lib/Utils/browser-utils.js.map +1 -0
  120. package/lib/Utils/chat-utils.d.ts +6 -7
  121. package/lib/Utils/chat-utils.d.ts.map +1 -1
  122. package/lib/Utils/chat-utils.js +19 -2
  123. package/lib/Utils/chat-utils.js.map +1 -1
  124. package/lib/Utils/crypto.d.ts +6 -6
  125. package/lib/Utils/crypto.d.ts.map +1 -1
  126. package/lib/Utils/crypto.js +16 -12
  127. package/lib/Utils/crypto.js.map +1 -1
  128. package/lib/Utils/decode-wa-message.d.ts +14 -2
  129. package/lib/Utils/decode-wa-message.d.ts.map +1 -1
  130. package/lib/Utils/decode-wa-message.js +104 -15
  131. package/lib/Utils/decode-wa-message.js.map +1 -1
  132. package/lib/Utils/event-buffer.d.ts +0 -1
  133. package/lib/Utils/event-buffer.d.ts.map +1 -1
  134. package/lib/Utils/event-buffer.js +65 -20
  135. package/lib/Utils/event-buffer.js.map +1 -1
  136. package/lib/Utils/generics.d.ts +5 -7
  137. package/lib/Utils/generics.d.ts.map +1 -1
  138. package/lib/Utils/generics.js +59 -51
  139. package/lib/Utils/generics.js.map +1 -1
  140. package/lib/Utils/history.d.ts +8 -9
  141. package/lib/Utils/history.d.ts.map +1 -1
  142. package/lib/Utils/history.js +8 -3
  143. package/lib/Utils/history.js.map +1 -1
  144. package/lib/Utils/index.d.ts +2 -1
  145. package/lib/Utils/index.d.ts.map +1 -1
  146. package/lib/Utils/index.js +2 -1
  147. package/lib/Utils/index.js.map +1 -1
  148. package/lib/Utils/link-preview.d.ts +1 -2
  149. package/lib/Utils/link-preview.d.ts.map +1 -1
  150. package/lib/Utils/link-preview.js +1 -1
  151. package/lib/Utils/link-preview.js.map +1 -1
  152. package/lib/Utils/message-retry-manager.d.ts +82 -0
  153. package/lib/Utils/message-retry-manager.d.ts.map +1 -0
  154. package/lib/Utils/message-retry-manager.js +172 -0
  155. package/lib/Utils/message-retry-manager.js.map +1 -0
  156. package/lib/Utils/messages-media.d.ts +14 -12
  157. package/lib/Utils/messages-media.d.ts.map +1 -1
  158. package/lib/Utils/messages-media.js +48 -24
  159. package/lib/Utils/messages-media.js.map +1 -1
  160. package/lib/Utils/messages.d.ts +17 -4
  161. package/lib/Utils/messages.d.ts.map +1 -1
  162. package/lib/Utils/messages.js +85 -21
  163. package/lib/Utils/messages.js.map +1 -1
  164. package/lib/Utils/noise-handler.js +2 -1
  165. package/lib/Utils/noise-handler.js.map +1 -1
  166. package/lib/Utils/pre-key-manager.d.ts +28 -0
  167. package/lib/Utils/pre-key-manager.d.ts.map +1 -0
  168. package/lib/Utils/pre-key-manager.js +106 -0
  169. package/lib/Utils/pre-key-manager.js.map +1 -0
  170. package/lib/Utils/process-message.d.ts +26 -8
  171. package/lib/Utils/process-message.d.ts.map +1 -1
  172. package/lib/Utils/process-message.js +141 -24
  173. package/lib/Utils/process-message.js.map +1 -1
  174. package/lib/Utils/signal.d.ts +4 -4
  175. package/lib/Utils/signal.d.ts.map +1 -1
  176. package/lib/Utils/signal.js +21 -12
  177. package/lib/Utils/signal.js.map +1 -1
  178. package/lib/Utils/validate-connection.d.ts.map +1 -1
  179. package/lib/Utils/validate-connection.js +50 -14
  180. package/lib/Utils/validate-connection.js.map +1 -1
  181. package/lib/WABinary/decode.d.ts.map +1 -1
  182. package/lib/WABinary/decode.js +12 -2
  183. package/lib/WABinary/decode.js.map +1 -1
  184. package/lib/WABinary/generic-utils.js +1 -1
  185. package/lib/WABinary/generic-utils.js.map +1 -1
  186. package/lib/WABinary/jid-utils.d.ts +18 -6
  187. package/lib/WABinary/jid-utils.d.ts.map +1 -1
  188. package/lib/WABinary/jid-utils.js +52 -8
  189. package/lib/WABinary/jid-utils.js.map +1 -1
  190. package/lib/WAM/constants.d.ts +1 -1
  191. package/lib/WAM/constants.d.ts.map +1 -1
  192. package/lib/WAM/constants.js +18516 -10904
  193. package/lib/WAM/constants.js.map +1 -1
  194. package/lib/WAM/encode.d.ts.map +1 -1
  195. package/lib/WAM/encode.js +0 -1
  196. package/lib/WAM/encode.js.map +1 -1
  197. package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +2 -1
  198. package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts.map +1 -1
  199. package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +10 -2
  200. package/lib/WAUSync/Protocols/UsyncLIDProtocol.js.map +1 -1
  201. package/lib/WAUSync/USyncQuery.d.ts +1 -1
  202. package/lib/WAUSync/USyncQuery.d.ts.map +1 -1
  203. package/lib/WAUSync/USyncQuery.js +23 -20
  204. package/lib/WAUSync/USyncQuery.js.map +1 -1
  205. package/package.json +16 -11
  206. package/lib/Defaults/baileys-version.json +0 -3
  207. package/lib/Signal/Group/queue-job.d.ts +0 -2
  208. package/lib/Signal/Group/queue-job.d.ts.map +0 -1
  209. package/lib/Signal/Group/queue-job.js +0 -54
  210. package/lib/Signal/Group/queue-job.js.map +0 -1
  211. package/lib/Socket/usync.d.ts +0 -37
  212. package/lib/Socket/usync.d.ts.map +0 -1
  213. package/lib/Socket/usync.js +0 -63
  214. package/lib/Socket/usync.js.map +0 -1
  215. package/lib/Utils/baileys-event-stream.d.ts +0 -17
  216. package/lib/Utils/baileys-event-stream.d.ts.map +0 -1
  217. package/lib/Utils/baileys-event-stream.js +0 -56
  218. package/lib/Utils/baileys-event-stream.js.map +0 -1
package/README.md CHANGED
@@ -1,19 +1,19 @@
1
1
  <h1 align='center'><img alt="Baileys logo" src="https://raw.githubusercontent.com/WhiskeySockets/Baileys/refs/heads/master/Media/logo.png" height="75"/></h1>
2
2
 
3
- <div align='center'>
4
-
5
- ![NPM Downloads](https://img.shields.io/npm/dw/%40whiskeysockets%2Fbaileys?label=npm&color=%23CB3837)
6
- ![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/whiskeysockets/baileys)
7
- ![Discord](https://img.shields.io/discord/725839806084546610?label=discord&color=%235865F2)
3
+ <div align='center'>Baileys is a WebSockets-based TypeScript library for interacting with the WhatsApp Web API.</div>
8
4
 
9
- </div>
10
5
 
11
- <div align='center'>Baileys is a WebSockets-based TypeScript library for interacting with the WhatsApp Web API.</div>
6
+ > [!CAUTION]
7
+ > NOTICE OF BREAKING CHANGE.
8
+ >
9
+ > As of 7.0.0, multiple breaking changes were introduced into the library.
10
+ >
11
+ > Please check out https://whiskey.so/migrate-latest for more information.
12
12
 
13
13
  # Important Note
14
- This is a temporally README, the new guide is at development and will be fully released when it's finished.
14
+ This is a temporary README.md, the new guide is in development and will this file will be replaced with .github/README.md (already a default on GitHub).
15
15
 
16
- New Guide: https://baileys.wiki
16
+ New guide link: https://baileys.wiki
17
17
 
18
18
  # Sponsor
19
19
  If you'd like to financially support this project, you can do so by supporting the current maintainer [here](https://purpshell.dev/sponsor).
@@ -27,8 +27,8 @@ Use at your own discretion. Do not spam people with this. We discourage any stal
27
27
 
28
28
  ##
29
29
 
30
- - Baileys does not require Selenium or any other browser to be interface with WhatsApp Web, it does so directly using a **WebSocket**.
31
- - Not running Selenium or Chromium saves you like **half a gig** of ram :/
30
+ - Baileys does not require Selenium or any other browser to be interface with WhatsApp Web, it does so directly using a **WebSocket**.
31
+ - Not running Selenium or Chromium saves you like **half a gig** of ram :/
32
32
  - Baileys supports interacting with the multi-device & web versions of WhatsApp.
33
33
  - Thank you to [@pokearaujo](https://github.com/pokearaujo/multidevice) for writing his observations on the workings of WhatsApp Multi-Device. Also, thank you to [@Sigalor](https://github.com/sigalor/whatsapp-web-reveng) for writing his observations on the workings of WhatsApp Web and thanks to [@Rhymen](https://github.com/Rhymen/go-whatsapp/) for the __go__ implementation.
34
34
 
@@ -36,7 +36,7 @@ Use at your own discretion. Do not spam people with this. We discourage any stal
36
36
  > The original repository had to be removed by the original author - we now continue development in this repository here.
37
37
  This is the only official repository and is maintained by the community.
38
38
  > **Join the Discord [here](https://discord.gg/WeJM5FP9GG)**
39
-
39
+
40
40
  ## Example
41
41
 
42
42
  Do check out & run [example.ts](Example/example.ts) to see an example usage of the library.
@@ -59,7 +59,7 @@ yarn add github:WhiskeySockets/Baileys
59
59
  ```
60
60
 
61
61
  Then import your code using:
62
- ```ts
62
+ ```ts
63
63
  import makeWASocket from '@whiskeysockets/baileys'
64
64
  ```
65
65
 
@@ -278,7 +278,7 @@ const sock = makeWASocket({
278
278
  ```
279
279
  ## Saving & Restoring Sessions
280
280
 
281
- You obviously don't want to keep scanning the QR code every time you want to connect.
281
+ You obviously don't want to keep scanning the QR code every time you want to connect.
282
282
 
283
283
  So, you can load the credentials to log back in:
284
284
  ```ts
@@ -302,7 +302,7 @@ sock.ev.on('creds.update', saveCreds)
302
302
 
303
303
  ## Handling Events
304
304
 
305
- - Baileys uses the EventEmitter syntax for events.
305
+ - Baileys uses the EventEmitter syntax for events.
306
306
  They're all nicely typed up, so you shouldn't have any issues with an Intellisense editor like VS Code.
307
307
 
308
308
  > [!IMPORTANT]
@@ -321,6 +321,9 @@ sock.ev.on('messages.upsert', ({ messages }) => {
321
321
  > [!NOTE]
322
322
  > This example includes basic auth storage too
323
323
 
324
+ > [!NOTE]
325
+ > For reliable serialization of the authentication state, especially when storing as JSON, always use the BufferJSON utility.
326
+
324
327
  ```ts
325
328
  import makeWASocket, { DisconnectReason, useMultiFileAuthState } from '@whiskeysockets/baileys'
326
329
  import { Boom } from '@hapi/boom'
@@ -436,10 +439,10 @@ The store also provides some simple functions such as `loadMessages` that utiliz
436
439
 
437
440
  ## Whatsapp IDs Explain
438
441
 
439
- - `id` is the WhatsApp ID, called `jid` too, of the person or group you're sending the message to.
442
+ - `id` is the WhatsApp ID, called `jid` too, of the person or group you're sending the message to.
440
443
  - It must be in the format ```[country code][phone number]@s.whatsapp.net```
441
- - Example for people: ```+19999999999@s.whatsapp.net```.
442
- - For groups, it must be in the format ``` 123456789-123345@g.us ```.
444
+ - Example for people: ```+19999999999@s.whatsapp.net```.
445
+ - For groups, it must be in the format ``` 123456789-123345@g.us ```.
443
446
  - For broadcast lists, it's `[timestamp of creation]@broadcast`.
444
447
  - For stories, the ID is `status@broadcast`.
445
448
 
@@ -498,7 +501,7 @@ await sock.sendMessage(jid, { forward: msg }) // WA forward the message!
498
501
  #### Location Message
499
502
  ```ts
500
503
  await sock.sendMessage(
501
- jid,
504
+ jid,
502
505
  {
503
506
  location: {
504
507
  degreesLatitude: 24.121231,
@@ -510,7 +513,7 @@ await sock.sendMessage(
510
513
  #### Contact Message
511
514
  ```ts
512
515
  const vcard = 'BEGIN:VCARD\n' // metadata of the contact card
513
- + 'VERSION:3.0\n'
516
+ + 'VERSION:3.0\n'
514
517
  + 'FN:Jeff Singh\n' // full name
515
518
  + 'ORG:Ashoka Uni;\n' // the organization of the contact
516
519
  + 'TEL;type=CELL;type=VOICE;waid=911234567890:+91 12345 67890\n' // WhatsApp ID + phone number
@@ -518,10 +521,10 @@ const vcard = 'BEGIN:VCARD\n' // metadata of the contact card
518
521
 
519
522
  await sock.sendMessage(
520
523
  id,
521
- {
522
- contacts: {
523
- displayName: 'Jeff',
524
- contacts: [{ vcard }]
524
+ {
525
+ contacts: {
526
+ displayName: 'Jeff',
527
+ contacts: [{ vcard }]
525
528
  }
526
529
  }
527
530
  )
@@ -611,8 +614,8 @@ Sending media (video, stickers, images) is easier & more efficient than ever.
611
614
  - Whatsapp doesn't support `.gif` files, that's why we send gifs as common `.mp4` video with `gifPlayback` flag
612
615
  ```ts
613
616
  await sock.sendMessage(
614
- jid,
615
- {
617
+ jid,
618
+ {
616
619
  video: fs.readFileSync('Media/ma_gif.mp4'),
617
620
  caption: 'hello word',
618
621
  gifPlayback: true
@@ -623,8 +626,8 @@ await sock.sendMessage(
623
626
  #### Video Message
624
627
  ```ts
625
628
  await sock.sendMessage(
626
- id,
627
- {
629
+ id,
630
+ {
628
631
  video: {
629
632
  url: './Media/ma_gif.mp4'
630
633
  },
@@ -648,7 +651,7 @@ await sock.sendMessage(
648
651
  ```
649
652
  ```ts
650
653
  await sock.sendMessage(
651
- jid,
654
+ jid,
652
655
  {
653
656
  audio: {
654
657
  url: './Media/audio.mp3'
@@ -661,8 +664,8 @@ await sock.sendMessage(
661
664
  #### Image Message
662
665
  ```ts
663
666
  await sock.sendMessage(
664
- id,
665
- {
667
+ id,
668
+ {
666
669
  image: {
667
670
  url: './Media/ma_img.png'
668
671
  },
@@ -677,8 +680,8 @@ await sock.sendMessage(
677
680
 
678
681
  ```ts
679
682
  await sock.sendMessage(
680
- id,
681
- {
683
+ id,
684
+ {
682
685
  image: {
683
686
  url: './Media/ma_img.png'
684
687
  },
@@ -733,7 +736,7 @@ sock.ev.on('messages.upsert', async ({ [m] }) => {
733
736
  m,
734
737
  'stream', // can be 'buffer' too
735
738
  { },
736
- {
739
+ {
737
740
  logger,
738
741
  // pass this so that baileys can request a reupload of media
739
742
  // that has been deleted
@@ -749,7 +752,7 @@ sock.ev.on('messages.upsert', async ({ [m] }) => {
749
752
 
750
753
  ### Re-upload Media Message to Whatsapp
751
754
 
752
- - WhatsApp automatically removes old media from their servers. For the device to access said media -- a re-upload is required by another device that has it. This can be accomplished using:
755
+ - WhatsApp automatically removes old media from their servers. For the device to access said media -- a re-upload is required by another device that has it. This can be accomplished using:
753
756
  ```ts
754
757
  await sock.updateMediaMessage(msg)
755
758
  ```
@@ -775,17 +778,17 @@ const key: WAMessageKey
775
778
  await sock.readMessages([key])
776
779
  ```
777
780
 
778
- The message ID is the unique identifier of the message that you are marking as read.
781
+ The message ID is the unique identifier of the message that you are marking as read.
779
782
  On a `WAMessage`, the `messageID` can be accessed using ```messageID = message.key.id```.
780
783
 
781
784
  ### Update Presence
782
785
 
783
786
  - ``` presence ``` can be one of [these](https://baileys.whiskeysockets.io/types/WAPresence.html)
784
787
  - The presence expires after about 10 seconds.
785
- - This lets the person/group with `jid` know whether you're online, offline, typing etc.
788
+ - This lets the person/group with `jid` know whether you're online, offline, typing etc.
786
789
 
787
790
  ```ts
788
- await sock.sendPresenceUpdate('available', jid)
791
+ await sock.sendPresenceUpdate('available', jid)
789
792
  ```
790
793
 
791
794
  > [!NOTE]
@@ -834,12 +837,12 @@ await sock.chatModify(
834
837
  messages: [
835
838
  {
836
839
  id: 'ATWYHDNNWU81732J',
837
- fromMe: true,
840
+ fromMe: true,
838
841
  timestamp: '1654823909'
839
842
  }
840
843
  ]
841
844
  }
842
- },
845
+ },
843
846
  jid
844
847
  )
845
848
 
@@ -900,7 +903,7 @@ await sock.chatModify({
900
903
  ```ts
901
904
  // turn on disappearing messages
902
905
  await sock.sendMessage(
903
- jid,
906
+ jid,
904
907
  // this is 1 week in seconds -- how long you want messages to appear for
905
908
  { disappearingMessagesInChat: WA_DEFAULT_EPHEMERAL }
906
909
  )
@@ -910,7 +913,7 @@ await sock.sendMessage(jid, { text: 'hello' }, { ephemeralExpiration: WA_DEFAULT
910
913
 
911
914
  // turn off disappearing messages
912
915
  await sock.sendMessage(
913
- jid,
916
+ jid,
914
917
  { disappearingMessagesInChat: false }
915
918
  )
916
919
  ```
@@ -965,7 +968,7 @@ console.log('business description: ' + profile.description + ', category: ' + pr
965
968
  sock.ev.on('presence.update', console.log)
966
969
 
967
970
  // request updates for a chat
968
- await sock.presenceSubscribe(jid)
971
+ await sock.presenceSubscribe(jid)
969
972
  ```
970
973
 
971
974
  ## Change Profile
@@ -1007,7 +1010,7 @@ await sock.sendMessage(group.id, { text: 'hello there' }) // say hello to everyo
1007
1010
  ```ts
1008
1011
  // id & people to add to the group (will throw error if it fails)
1009
1012
  await sock.groupParticipantsUpdate(
1010
- jid,
1013
+ jid,
1011
1014
  ['abcd@s.whatsapp.net', 'efgh@s.whatsapp.net'],
1012
1015
  'add' // replace this parameter with 'remove' or 'demote' or 'promote'
1013
1016
  )
@@ -1060,7 +1063,7 @@ console.log('group information: ' + response)
1060
1063
  ```
1061
1064
  ### Query Metadata (participants, name, description...)
1062
1065
  ```ts
1063
- const metadata = await sock.groupMetadata(jid)
1066
+ const metadata = await sock.groupMetadata(jid)
1064
1067
  console.log(metadata.id + ', title: ' + metadata.subject + ', description: ' + metadata.desc)
1065
1068
  ```
1066
1069
  ### Join using `groupInviteMessage`
@@ -1078,7 +1081,7 @@ console.log(response)
1078
1081
  const response = await sock.groupRequestParticipantsUpdate(
1079
1082
  jid, // group id
1080
1083
  ['abcd@s.whatsapp.net', 'efgh@s.whatsapp.net'],
1081
- 'approve' // or 'reject'
1084
+ 'approve' // or 'reject'
1082
1085
  )
1083
1086
  console.log(response)
1084
1087
  ```
@@ -1169,7 +1172,7 @@ await sock.updateGroupsAddPrivacy(value)
1169
1172
  | 90d | 7.776.000 |
1170
1173
 
1171
1174
  ```ts
1172
- const ephemeral = 86400
1175
+ const ephemeral = 86400
1173
1176
  await sock.updateDefaultDisappearingMode(ephemeral)
1174
1177
  ```
1175
1178
 
@@ -1218,14 +1221,14 @@ const sock = makeWASocket({
1218
1221
  logger: P({ level: 'debug' }),
1219
1222
  })
1220
1223
  ```
1221
- This will enable you to see all sorts of messages WhatsApp sends in the console.
1224
+ This will enable you to see all sorts of messages WhatsApp sends in the console.
1222
1225
 
1223
1226
  ### How Whatsapp Communicate With Us
1224
1227
 
1225
1228
  > [!TIP]
1226
1229
  > If you want to learn whatsapp protocol, we recommend to study about Libsignal Protocol and Noise Protocol
1227
1230
 
1228
- - **Example:** Functionality to track the battery percentage of your phone. You enable logging and you'll see a message about your battery pop up in the console:
1231
+ - **Example:** Functionality to track the battery percentage of your phone. You enable logging and you'll see a message about your battery pop up in the console:
1229
1232
  ```
1230
1233
  {
1231
1234
  "level": 10,
@@ -1254,7 +1257,7 @@ This will enable you to see all sorts of messages WhatsApp sends in the console.
1254
1257
  },
1255
1258
  "msg":"communication"
1256
1259
  }
1257
- ```
1260
+ ```
1258
1261
 
1259
1262
  The `'frame'` is what the message received is, it has three components:
1260
1263
  - `tag` -- what this frame is about (eg. message will have 'message')
@@ -1,3 +1,3 @@
1
- yarn pbjs -t static-module -w es6 --no-bundle -o ./index.js ./WAProto.proto;
2
- yarn pbts -o ./index.d.ts ./index.js;
1
+ yarn pbjs -t static-module --no-beautify -w es6 --no-bundle --no-delimited --no-verify --no-comments -o ./index.js ./WAProto.proto;
2
+ yarn pbjs -t static-module --no-beautify -w es6 --no-bundle --no-delimited --no-verify ./WAProto.proto | yarn pbts --no-comments -o ./index.d.ts -;
3
3
  node ./fix-imports.js