@hansaka02/baileys 7.3.2 → 7.3.4

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 (202) hide show
  1. package/README.md +247 -203
  2. package/lib/Defaults/connection.js +51 -0
  3. package/lib/Defaults/constants.js +62 -0
  4. package/lib/Defaults/history.js +17 -0
  5. package/lib/Defaults/index.js +36 -142
  6. package/lib/Defaults/media.js +48 -0
  7. package/lib/Defaults/prefix.js +18 -0
  8. package/lib/Signal/Group/group-session-builder.js +10 -42
  9. package/lib/Signal/Group/group_cipher.js +9 -6
  10. package/lib/Signal/Group/index.js +39 -53
  11. package/lib/Signal/Group/keyhelper.js +8 -41
  12. package/lib/Signal/Group/sender-chain-key.js +4 -4
  13. package/lib/Signal/Group/sender-key-distribution-message.js +5 -5
  14. package/lib/Signal/Group/sender-key-message.js +12 -8
  15. package/lib/Signal/Group/sender-key-record.js +7 -7
  16. package/lib/Signal/Group/sender-key-state.js +4 -4
  17. package/lib/Signal/Group/sender-message-key.js +2 -2
  18. package/lib/Signal/libsignal.js +45 -69
  19. package/lib/Signal/lid-mapping.js +15 -11
  20. package/lib/Socket/Client/types.js +2 -2
  21. package/lib/Socket/Client/websocket.js +16 -14
  22. package/lib/Socket/business.js +41 -32
  23. package/lib/Socket/chats.js +123 -98
  24. package/lib/Socket/community.js +50 -40
  25. package/lib/Socket/groups.js +59 -47
  26. package/lib/Socket/index.js +4 -4
  27. package/lib/Socket/messages-recv.js +219 -172
  28. package/lib/Socket/messages-send.js +187 -143
  29. package/lib/Socket/newsletter.js +61 -47
  30. package/lib/Socket/socket.js +133 -90
  31. package/lib/Socket/usync.js +6 -6
  32. package/lib/Store/index.js +27 -11
  33. package/lib/Store/make-cache-manager-store.js +14 -15
  34. package/lib/Store/make-in-memory-store.js +28 -24
  35. package/lib/Types/LabelAssociation.js +2 -2
  36. package/lib/Types/Message.js +6 -6
  37. package/lib/Types/MexUpdates.js +5 -5
  38. package/lib/Types/State.js +4 -4
  39. package/lib/Types/index.js +28 -12
  40. package/lib/Utils/auth-utils.js +28 -26
  41. package/lib/Utils/baileys-event-stream.js +68 -69
  42. package/lib/Utils/business.js +63 -53
  43. package/lib/Utils/chat-utils.js +81 -71
  44. package/lib/Utils/crypto.js +25 -45
  45. package/lib/Utils/decode-wa-message.js +319 -311
  46. package/lib/Utils/event-buffer.js +21 -22
  47. package/lib/Utils/generics.js +65 -82
  48. package/lib/Utils/history.js +21 -21
  49. package/lib/Utils/index.js +27 -13
  50. package/lib/Utils/link-preview.js +7 -30
  51. package/lib/Utils/logger.js +5 -5
  52. package/lib/Utils/lt-hash.js +3 -3
  53. package/lib/Utils/message-retry-manager.js +4 -4
  54. package/lib/Utils/messages-media.js +104 -109
  55. package/lib/Utils/messages.js +203 -171
  56. package/lib/Utils/noise-handler.js +28 -19
  57. package/lib/Utils/process-message.js +111 -96
  58. package/lib/Utils/signal.js +36 -25
  59. package/lib/Utils/use-multi-file-auth-state.js +18 -22
  60. package/lib/Utils/validate-connection.js +52 -45
  61. package/lib/WABinary/decode.js +6 -32
  62. package/lib/WABinary/encode.js +3 -29
  63. package/lib/WABinary/generic-utils.js +4 -4
  64. package/lib/WABinary/index.js +27 -11
  65. package/lib/WAM/encode.js +16 -8
  66. package/lib/WAM/index.js +27 -11
  67. package/lib/WAUSync/Protocols/USyncBotProfileProtocol.js +20 -16
  68. package/lib/WAUSync/Protocols/USyncContactProtocol.js +2 -2
  69. package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +7 -4
  70. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +2 -2
  71. package/lib/WAUSync/Protocols/USyncLIDProtocol.js +0 -2
  72. package/lib/WAUSync/Protocols/USyncStatusProtocol.js +2 -2
  73. package/lib/WAUSync/Protocols/index.js +27 -11
  74. package/lib/WAUSync/USyncQuery.js +17 -10
  75. package/lib/WAUSync/index.js +27 -11
  76. package/lib/index.js +60 -31
  77. package/package.json +8 -14
  78. package/WAProto/AICommon/AICommon.d.ts +0 -11702
  79. package/WAProto/Adv/Adv.d.ts +0 -643
  80. package/WAProto/BotMetadata/BotMetadata.d.ts +0 -5654
  81. package/WAProto/Cert/Cert.d.ts +0 -613
  82. package/WAProto/ChatLockSettings/ChatLockSettings.d.ts +0 -476
  83. package/WAProto/CompanionReg/CompanionReg.d.ts +0 -1361
  84. package/WAProto/DeviceCapabilities/DeviceCapabilities.d.ts +0 -577
  85. package/WAProto/E2E/E2E.d.ts +0 -41724
  86. package/WAProto/Ephemeral/Ephemeral.d.ts +0 -114
  87. package/WAProto/HistorySync/HistorySync.d.ts +0 -51700
  88. package/WAProto/LidMigrationSyncPayload/LidMigrationSyncPayload.d.ts +0 -229
  89. package/WAProto/MdStorageChatRowOpaqueData/MdStorageChatRowOpaqueData.d.ts +0 -583
  90. package/WAProto/MdStorageMsgRowOpaqueData/MdStorageMsgRowOpaqueData.d.ts +0 -42897
  91. package/WAProto/MmsRetry/MmsRetry.d.ts +0 -243
  92. package/WAProto/Protocol/Protocol.d.ts +0 -270
  93. package/WAProto/Reporting/Reporting.d.ts +0 -371
  94. package/WAProto/ServerSync/ServerSync.d.ts +0 -1285
  95. package/WAProto/SignalLocalStorageProtocol/SignalLocalStorageProtocol.d.ts +0 -1868
  96. package/WAProto/SignalWhisperTextProtocol/SignalWhisperTextProtocol.d.ts +0 -767
  97. package/WAProto/StatusAttributions/StatusAttributions.d.ts +0 -1027
  98. package/WAProto/SyncAction/SyncAction.d.ts +0 -11193
  99. package/WAProto/UserPassword/UserPassword.d.ts +0 -363
  100. package/WAProto/VnameCert/VnameCert.d.ts +0 -821
  101. package/WAProto/Wa6/Wa6.d.ts +0 -2128
  102. package/WAProto/Web/Web.d.ts +0 -46383
  103. package/WAProto/index.d.ts +0 -55
  104. package/lib/Defaults/index.d.ts +0 -77
  105. package/lib/Signal/Group/ciphertext-message.d.ts +0 -9
  106. package/lib/Signal/Group/group-session-builder.d.ts +0 -17
  107. package/lib/Signal/Group/group_cipher.d.ts +0 -19
  108. package/lib/Signal/Group/index.d.ts +0 -11
  109. package/lib/Signal/Group/keyhelper.d.ts +0 -16
  110. package/lib/Signal/Group/sender-chain-key.d.ts +0 -14
  111. package/lib/Signal/Group/sender-key-distribution-message.d.ts +0 -17
  112. package/lib/Signal/Group/sender-key-message.d.ts +0 -19
  113. package/lib/Signal/Group/sender-key-name.d.ts +0 -19
  114. package/lib/Signal/Group/sender-key-record.d.ts +0 -32
  115. package/lib/Signal/Group/sender-key-state.d.ts +0 -44
  116. package/lib/Signal/Group/sender-message-key.d.ts +0 -11
  117. package/lib/Signal/libsignal.d.ts +0 -8
  118. package/lib/Signal/lid-mapping.d.ts +0 -28
  119. package/lib/Socket/Client/index.d.ts +0 -2
  120. package/lib/Socket/Client/types.d.ts +0 -16
  121. package/lib/Socket/Client/websocket.d.ts +0 -13
  122. package/lib/Socket/business.d.ts +0 -187
  123. package/lib/Socket/chats.d.ts +0 -97
  124. package/lib/Socket/community.d.ts +0 -129
  125. package/lib/Socket/groups.d.ts +0 -129
  126. package/lib/Socket/index.d.ts +0 -191
  127. package/lib/Socket/messages-recv.d.ts +0 -174
  128. package/lib/Socket/messages-send.d.ts +0 -165
  129. package/lib/Socket/newsletter.d.ts +0 -145
  130. package/lib/Socket/socket.d.ts +0 -45
  131. package/lib/Socket/usync.d.ts +0 -37
  132. package/lib/Store/index.d.ts +0 -4
  133. package/lib/Store/make-cache-manager-store.d.ts +0 -14
  134. package/lib/Store/make-in-memory-store.d.ts +0 -123
  135. package/lib/Store/make-ordered-dictionary.d.ts +0 -12
  136. package/lib/Store/object-repository.d.ts +0 -10
  137. package/lib/Types/Auth.d.ts +0 -121
  138. package/lib/Types/Bussiness.d.ts +0 -28
  139. package/lib/Types/Call.d.ts +0 -14
  140. package/lib/Types/Chat.d.ts +0 -143
  141. package/lib/Types/Contact.d.ts +0 -23
  142. package/lib/Types/Events.d.ts +0 -226
  143. package/lib/Types/GroupMetadata.d.ts +0 -66
  144. package/lib/Types/Label.d.ts +0 -48
  145. package/lib/Types/LabelAssociation.d.ts +0 -35
  146. package/lib/Types/Message.d.ts +0 -484
  147. package/lib/Types/MexUpdates.d.ts +0 -9
  148. package/lib/Types/Newsletter.d.ts +0 -109
  149. package/lib/Types/Product.d.ts +0 -92
  150. package/lib/Types/Signal.d.ts +0 -98
  151. package/lib/Types/Socket.d.ts +0 -141
  152. package/lib/Types/State.d.ts +0 -41
  153. package/lib/Types/USync.d.ts +0 -26
  154. package/lib/Types/index.d.ts +0 -80
  155. package/lib/Utils/auth-utils.d.ts +0 -21
  156. package/lib/Utils/baileys-event-stream.d.ts +0 -18
  157. package/lib/Utils/business.d.ts +0 -29
  158. package/lib/Utils/chat-utils.d.ts +0 -82
  159. package/lib/Utils/crypto.d.ts +0 -56
  160. package/lib/Utils/decode-wa-message.d.ts +0 -53
  161. package/lib/Utils/event-buffer.d.ts +0 -39
  162. package/lib/Utils/generics.d.ts +0 -117
  163. package/lib/Utils/history.d.ts +0 -23
  164. package/lib/Utils/index.d.ts +0 -20
  165. package/lib/Utils/link-preview.d.ts +0 -23
  166. package/lib/Utils/logger.d.ts +0 -13
  167. package/lib/Utils/lt-hash.d.ts +0 -14
  168. package/lib/Utils/make-mutex.d.ts +0 -9
  169. package/lib/Utils/message-retry-manager.d.ts +0 -88
  170. package/lib/Utils/messages-media.d.ts +0 -135
  171. package/lib/Utils/messages.d.ts +0 -105
  172. package/lib/Utils/noise-handler.d.ts +0 -20
  173. package/lib/Utils/process-message.d.ts +0 -49
  174. package/lib/Utils/signal.d.ts +0 -42
  175. package/lib/Utils/use-mongo-file-auth-state.d.ts +0 -6
  176. package/lib/Utils/use-mongo-file-auth-state.js +0 -84
  177. package/lib/Utils/use-multi-file-auth-state.d.ts +0 -13
  178. package/lib/Utils/use-single-file-auth-state.d.ts +0 -13
  179. package/lib/Utils/use-single-file-auth-state.js +0 -80
  180. package/lib/Utils/validate-connection.d.ts +0 -13
  181. package/lib/WABinary/constants.d.ts +0 -30
  182. package/lib/WABinary/decode.d.ts +0 -9
  183. package/lib/WABinary/encode.d.ts +0 -3
  184. package/lib/WABinary/generic-utils.d.ts +0 -28
  185. package/lib/WABinary/index.d.ts +0 -5
  186. package/lib/WABinary/jid-utils.d.ts +0 -58
  187. package/lib/WABinary/types.d.ts +0 -22
  188. package/lib/WAM/BinaryInfo.d.ts +0 -16
  189. package/lib/WAM/constants.d.ts +0 -47
  190. package/lib/WAM/encode.d.ts +0 -3
  191. package/lib/WAM/index.d.ts +0 -3
  192. package/lib/WAUSync/Protocols/USyncBotProfileProtocol.d.ts +0 -28
  193. package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +0 -10
  194. package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +0 -26
  195. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +0 -14
  196. package/lib/WAUSync/Protocols/USyncLIDProtocol.d.ts +0 -10
  197. package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +0 -14
  198. package/lib/WAUSync/Protocols/index.d.ts +0 -6
  199. package/lib/WAUSync/USyncQuery.d.ts +0 -31
  200. package/lib/WAUSync/USyncUser.d.ts +0 -12
  201. package/lib/WAUSync/index.d.ts +0 -3
  202. package/lib/index.d.ts +0 -13
package/README.md CHANGED
@@ -2,15 +2,45 @@
2
2
 
3
3
  <div align="center">
4
4
 
5
- <img src="./images/image.jpg" alt="Header Image" width="100%"/>
5
+ <img src="https://wy0xihlhnevw1toh.public.blob.vercel-storage.com/images/ueug_ItsukichanBot-kSBgWKyatxf68Vxl3DMdr14VhAv7tR.png" alt="Header Image" width="100%"/>
6
6
 
7
7
  <br/>
8
+
9
+ <!-- Badges -->
10
+ <p>
11
+ <img src="https://img.shields.io/npm/dw/%40itsukichan%2Fbaileys?label=npm&color=%23CB3837" alt="NPM Downloads"/>
12
+ <img src="https://img.shields.io/github/v/release/itsukichann/baileys?include_prereleases&sort=semver" alt="Latest Release"/>
13
+ <img src="https://img.shields.io/github/languages/code-size/itsukichann/baileys" alt="Code Size"/>
14
+ <img src="https://img.shields.io/github/license/itsukichann/baileys" alt="License"/>
15
+ <img src="https://img.shields.io/github/stars/itsukichann/baileys" alt="Stars"/>
16
+ <img src="https://img.shields.io/github/forks/itsukichann/baileys" alt="Forks"/>
17
+ </p>
18
+
19
+ <!-- GitHub Stats -->
20
+ <p>
21
+ <img src="https://github-readme-stats.vercel.app/api?username=itsukichann&show_icons=true&theme=radical" alt="GitHub Stats"/>
22
+ </p>
23
+
8
24
  </div>
9
25
 
10
- > [!IMPORTANT]
11
- > The original repository had to be removed by the original author
12
- This is a unofficial repository and is maintained by the community.
26
+ ### Important Note
27
+
28
+ This library was originally a project for **CS-2362 at Ashoka University** and is in no way affiliated with or endorsed by WhatsApp. Use at your own discretion. Do not spam people with this. We discourage any stalkerware, bulk or automated messaging usage.
13
29
 
30
+ #### Liability and License Notice
31
+ Baileys and its maintainers cannot be held liable for misuse of this application, as stated in the [MIT license](https://github.com/WhiskeySockets/Baileys/blob/master/LICENSE).
32
+ The maintainers of Baileys do not in any way condone the use of this application in practices that violate the Terms of Service of WhatsApp. The maintainers of this application call upon the personal responsibility of its users to use this application in a fair way, as it is intended to be used.
33
+ ##
34
+
35
+ - Baileys does not require Selenium or any other browser to be interface with WhatsApp Web, it does so directly using a **WebSocket**.
36
+ - Not running Selenium or Chromimum saves you like **half a gig** of ram :/
37
+ - Baileys supports interacting with the multi-device & web versions of WhatsApp.
38
+ - 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.
39
+
40
+ > [!IMPORTANT]
41
+ > The original repository had to be removed by the original author - we now continue development in this repository here.
42
+ This is the only official repository and is maintained by the community.
43
+ > **Join the Discord [here] (https://discord.gg/nqssuNjjSH)**
14
44
 
15
45
  ## Example
16
46
 
@@ -25,23 +55,23 @@ To run the example script, download or clone the repo and then type the followin
25
55
 
26
56
  Use the stable version:
27
57
  ```
28
- yarn add @hansaka02/baileys
58
+ yarn add @itsukichan/baileys
29
59
  ```
30
60
 
31
61
  Use the edge version (no guarantee of stability, but latest fixes + features)
32
62
  ```
33
- yarn add github:hansaka02/Baileys
63
+ yarn add github:Itsukichann/Baileys
34
64
  ```
35
65
 
36
66
  Then import your code using:
37
67
  ```ts
38
- import makeWASocket from '@hansaka02/baileys'
68
+ import makeWASocket from '@itsukichan/baileys'
39
69
  ```
40
70
 
41
71
  # Links
42
72
 
43
-
44
- - [Docs of original library](https://guide.whiskeysockets.io/)
73
+ - [Discord](https://discord.gg/nqssuNjjSH)
74
+ - [Docs](https://guide.whiskeysockets.io/)
45
75
 
46
76
  # Index
47
77
 
@@ -58,6 +88,7 @@ import makeWASocket from '@hansaka02/baileys'
58
88
  - [Handling Events](#handling-events)
59
89
  - [Example to Start](#example-to-start)
60
90
  - [Decrypt Poll Votes](#decrypt-poll-votes)
91
+ - [Decrypt Event Response](#decrypt-event-response)
61
92
  - [Summary of Events on First Connection](#summary-of-events-on-first-connection)
62
93
  - [Implementing a Data Store](#implementing-a-data-store)
63
94
  - [Whatsapp IDs Explain](#whatsapp-ids-explain)
@@ -194,9 +225,9 @@ WhatsApp provides a multi-device API that allows Baileys to be authenticated as
194
225
  > You can customize browser name if you connect with **QR-CODE**, with `Browser` constant, we have some browsers config, **see [here](https://baileys.whiskeysockets.io/types/BrowsersMap.html)**
195
226
 
196
227
  ```ts
197
- import makeWASocket from '@hansaka02/baileys'
228
+ import makeWASocket from '@itsukichan/baileys'
198
229
 
199
- const AlexaInc = makeWASocket({
230
+ const suki = makeWASocket({
200
231
  // can provide additional config here
201
232
  browser: Browsers.ubuntu('My App'),
202
233
  printQRInTerminal: true
@@ -214,16 +245,16 @@ If the connection is successful, you will see a QR code printed on your terminal
214
245
  The phone number can't have `+` or `()` or `-`, only numbers, you must provide country code
215
246
 
216
247
  ```ts
217
- import makeWASocket from '@hansaka02/baileys'
248
+ import makeWASocket from '@itsukichan/baileys'
218
249
 
219
- const AlexaInc = makeWASocket({
250
+ const suki = makeWASocket({
220
251
  // can provide additional config here
221
252
  printQRInTerminal: false //need to be false
222
253
  })
223
254
 
224
- if (!AlexaInc.authState.creds.registered) {
255
+ if (!suki.authState.creds.registered) {
225
256
  const number = 'XXXXXXXXXXX'
226
- const code = await AlexaInc.requestPairingCode(number) // or await AlexaInc.requestPairingCode(number, 'CODEOTPS') custom your pairing code
257
+ const code = await suki.requestPairingCode(number) // or await suki.requestPairingCode(number, 'CODEOTPS') custom your pairing code
227
258
  console.log(code)
228
259
  }
229
260
  ```
@@ -235,7 +266,7 @@ if (!AlexaInc.authState.creds.registered) {
235
266
  - If you'd like to emulate a desktop connection (and receive more message history), this browser setting to your Socket config:
236
267
 
237
268
  ```ts
238
- const AlexaInc = makeWASocket({
269
+ const suki = makeWASocket({
239
270
  ...otherOpts,
240
271
  // can use Windows, Ubuntu here too
241
272
  browser: Browsers.macOS('Desktop'),
@@ -251,17 +282,17 @@ const AlexaInc = makeWASocket({
251
282
  ```ts
252
283
  const groupCache = new NodeCache({stdTTL: 5 * 60, useClones: false})
253
284
 
254
- const AlexaInc = makeWASocket({
285
+ const suki = makeWASocket({
255
286
  cachedGroupMetadata: async (jid) => groupCache.get(jid)
256
287
  })
257
288
 
258
- AlexaInc.ev.on('groups.update', async ([event]) => {
259
- const metadata = await AlexaInc.groupMetadata(event.id)
289
+ suki.ev.on('groups.update', async ([event]) => {
290
+ const metadata = await suki.groupMetadata(event.id)
260
291
  groupCache.set(event.id, metadata)
261
292
  })
262
293
 
263
- AlexaInc.ev.on('group-participants.update', async (event) => {
264
- const metadata = await AlexaInc.groupMetadata(event.id)
294
+ suki.ev.on('group-participants.update', async (event) => {
295
+ const metadata = await suki.groupMetadata(event.id)
265
296
  groupCache.set(event.id, metadata)
266
297
  })
267
298
  ```
@@ -269,7 +300,7 @@ const AlexaInc = makeWASocket({
269
300
  ### Improve Retry System & Decrypt Poll Votes
270
301
  - If you want to improve sending message, retrying when error occurs and decrypt poll votes, you need to have a store and set `getMessage` config in socket like this:
271
302
  ```ts
272
- const AlexaInc = makeWASocket({
303
+ const suki = makeWASocket({
273
304
  getMessage: async (key) => await getMessageFromStore(key)
274
305
  })
275
306
  ```
@@ -277,7 +308,7 @@ const AlexaInc = makeWASocket({
277
308
  ### Receive Notifications in Whatsapp App
278
309
  - If you want to receive notifications in whatsapp app, set `markOnlineOnConnect` to `false`
279
310
  ```ts
280
- const AlexaInc = makeWASocket({
311
+ const suki = makeWASocket({
281
312
  markOnlineOnConnect: false
282
313
  })
283
314
  ```
@@ -287,16 +318,16 @@ You obviously don't want to keep scanning the QR code every time you want to con
287
318
 
288
319
  So, you can load the credentials to log back in:
289
320
  ```ts
290
- import makeWASocket, { useMultiFileAuthState } from '@hansaka02/baileys'
321
+ import makeWASocket, { useMultiFileAuthState } from '@itsukichan/baileys'
291
322
 
292
323
  const { state, saveCreds } = await useMultiFileAuthState('auth_info_baileys')
293
324
 
294
325
  // will use the given state to connect
295
326
  // so if valid credentials are available -- it'll connect without QR
296
- const AlexaInc = makeWASocket({ auth: state })
327
+ const suki = makeWASocket({ auth: state })
297
328
 
298
329
  // this will be called as soon as the credentials are updated
299
- AlexaInc.ev.on('creds.update', saveCreds)
330
+ suki.ev.on('creds.update', saveCreds)
300
331
  ```
301
332
 
302
333
  > [!IMPORTANT]
@@ -315,8 +346,8 @@ They're all nicely typed up, so you shouldn't have any issues with an Intellisen
315
346
 
316
347
  You can listen to these events like this:
317
348
  ```ts
318
- const AlexaInc = makeWASocket()
319
- AlexaInc.ev.on('messages.upsert', ({ messages }) => {
349
+ const suki = makeWASocket()
350
+ suki.ev.on('messages.upsert', ({ messages }) => {
320
351
  console.log('got messages', messages)
321
352
  })
322
353
  ```
@@ -327,17 +358,17 @@ AlexaInc.ev.on('messages.upsert', ({ messages }) => {
327
358
  > This example includes basic auth storage too
328
359
 
329
360
  ```ts
330
- import makeWASocket, { DisconnectReason, useMultiFileAuthState } from '@hansaka02/baileys'
361
+ import makeWASocket, { DisconnectReason, useMultiFileAuthState } from '@itsukichan/baileys'
331
362
  import { Boom } from '@hapi/boom'
332
363
 
333
364
  async function connectToWhatsApp () {
334
365
  const { state, saveCreds } = await useMultiFileAuthState('./auth_info_baileys')
335
- const AlexaInc = makeWASocket({
366
+ const suki = makeWASocket({
336
367
  // can provide additional config here
337
368
  auth: state,
338
369
  printQRInTerminal: true
339
370
  })
340
- AlexaInc.ev.on('connection.update', (update) => {
371
+ suki.ev.on('connection.update', (update) => {
341
372
  const { connection, lastDisconnect } = update
342
373
  if(connection === 'close') {
343
374
  const shouldReconnect = (lastDisconnect.error as Boom)?.output?.statusCode !== DisconnectReason.loggedOut
@@ -350,17 +381,17 @@ async function connectToWhatsApp () {
350
381
  console.log('opened connection')
351
382
  }
352
383
  })
353
- AlexaInc.ev.on('messages.upsert', event => {
384
+ suki.ev.on('messages.upsert', event => {
354
385
  for (const m of event.messages) {
355
386
  console.log(JSON.stringify(m, undefined, 2))
356
387
 
357
388
  console.log('replying to', m.key.remoteJid)
358
- await AlexaInc.sendMessage(m.key.remoteJid!, { text: 'Hello Word' })
389
+ await suki.sendMessage(m.key.remoteJid!, { text: 'Hello Word' })
359
390
  }
360
391
  })
361
392
 
362
393
  // to storage creds (session info) when it updates
363
- AlexaInc.ev.on('creds.update', saveCreds)
394
+ suki.ev.on('creds.update', saveCreds)
364
395
  }
365
396
  // run in main file
366
397
  connectToWhatsApp()
@@ -368,16 +399,16 @@ connectToWhatsApp()
368
399
 
369
400
  ### For example if you use useSingleFileAuthState and useMongoFileAuthState
370
401
  ```ts
371
- import makeWASocket, { useSingleFileAuthState, useMongoFileAuthState } from '@hansaka02/baileys'
402
+ import makeWASocket, { useSingleFileAuthState, useMongoFileAuthState } from '@itsukichan/baileys'
372
403
 
373
404
  // Single Auth
374
405
  const { state, saveState } = await useSingleFileAuthState('./auth_info_baileys.json')
375
- const AlexaInc = makeWASocket({
406
+ const suki = makeWASocket({
376
407
  auth: state,
377
408
  printQRInTerminal: true
378
409
  })
379
410
 
380
- AlexaInc.ev.on('creds.update', saveState)
411
+ suki.ev.on('creds.update', saveState)
381
412
 
382
413
  // Mongo Auth
383
414
  import { MongoClient } from "mongodb"
@@ -393,18 +424,18 @@ const connectAuth = async() => {
393
424
  })
394
425
  }
395
426
  await client.connect()
396
- const collection = client.db("@hansaka02").collection("sessions")
427
+ const collection = client.db("@itsukichann").collection("sessions")
397
428
  return collection
398
429
  }
399
430
 
400
431
  const Authentication = await connectAuth()
401
432
  const { state, saveCreds } = await useMongoFileAuthState(Authentication)
402
- const AlexaInc = makeWASocket({
433
+ const suki = makeWASocket({
403
434
  auth: state,
404
435
  printQRInTerminal: true
405
436
  })
406
437
 
407
- AlexaInc.ev.on('creds.update', saveCreds)
438
+ suki.ev.on('creds.update', saveCreds)
408
439
  ```
409
440
 
410
441
  > [!IMPORTANT]
@@ -415,9 +446,9 @@ AlexaInc.ev.on('creds.update', saveCreds)
415
446
  - By default poll votes are encrypted and handled in `messages.update`
416
447
  ```ts
417
448
  import pino from "pino"
418
- import { makeInMemoryStore, getAggregateVotesInPollMessage } from '@hansaka02/baileys'
449
+ import { makeInMemoryStore, getAggregateVotesInPollMessage } from '@itsukichan/baileys'
419
450
 
420
- const logger = pino({ timestamp: () => `,"time":"${new Date().toJSON()}"` }).child({ class: "@hansaka02" })
451
+ const logger = pino({ timestamp: () => `,"time":"${new Date().toJSON()}"` }).child({ class: "@Itsukichann" })
421
452
  logger.level = "fatal"
422
453
  const store = makeInMemoryStore({ logger })
423
454
 
@@ -427,11 +458,11 @@ async function getMessage(key){
427
458
  return msg?.message
428
459
  }
429
460
  return {
430
- conversation: "ItAlexaInci Kawaiii"
461
+ conversation: "Itsukii Kawaiii"
431
462
  }
432
463
  }
433
464
 
434
- AlexaInc.ev.on("messages.update", async (chatUpdate) => {
465
+ suki.ev.on("messages.update", async (chatUpdate) => {
435
466
  for(const { key, update } of chatUpdate) {
436
467
  if(update.pollUpdates && key.fromMe) {
437
468
  const pollCreation = await getMessage(key)
@@ -449,6 +480,19 @@ AlexaInc.ev.on("messages.update", async (chatUpdate) => {
449
480
  })
450
481
  ```
451
482
 
483
+ ### Decrypt Event Response
484
+
485
+ - By default event response are encrypted and handled in `messages.update`
486
+ ```ts
487
+ import { jidNormalizedUser, getAggregateResponsesInEventMessage } from '@itsukichan/baileys'
488
+
489
+ suki.ev.on("messages.update", async ([chatUpdate]) => {
490
+ const eventResponses = chatUpdate.update?.eventResponses
491
+ const agregate = getAggregateResponsesInEventMessage({ eventResponses }, jidNormalizedUser(suki.user.lid))
492
+ console.log(agregate)
493
+ })
494
+ ```
495
+
452
496
  ### Summary of Events on First Connection
453
497
 
454
498
  1. When you connect first time, `connection.update` will be fired requesting you to restart sock
@@ -464,7 +508,7 @@ AlexaInc.ev.on("messages.update", async (chatUpdate) => {
464
508
  It can be used as follows:
465
509
 
466
510
  ```ts
467
- import makeWASocket, { makeInMemoryStore } from '@hansaka02/baileys'
511
+ import makeWASocket, { makeInMemoryStore } from '@itsukichan/baileys'
468
512
  // the store maintains the data of the WA connection in memory
469
513
  // can be written out to a file & read from it
470
514
  const store = makeInMemoryStore({ })
@@ -475,18 +519,18 @@ setInterval(() => {
475
519
  store.writeToFile('./baileys_store.json')
476
520
  }, 10_000)
477
521
 
478
- const AlexaInc = makeWASocket({ })
522
+ const suki = makeWASocket({ })
479
523
  // will listen from this socket
480
524
  // the store can listen from a new socket once the current socket outlives its lifetime
481
- store.bind(AlexaInc.ev)
525
+ store.bind(suki.ev)
482
526
 
483
- AlexaInc.ev.on('chats.upsert', () => {
527
+ suki.ev.on('chats.upsert', () => {
484
528
  // can use 'store.chats' however you want, even after the socket dies out
485
529
  // 'chats' => a KeyedDB instance
486
530
  console.log('got chats', store.chats.all())
487
531
  })
488
532
 
489
- AlexaInc.ev.on('contacts.upsert', () => {
533
+ suki.ev.on('contacts.upsert', () => {
490
534
  console.log('got contacts', Object.values(store.contacts))
491
535
  })
492
536
 
@@ -521,25 +565,25 @@ The store also provides some simple functions such as `loadMessages` that utiliz
521
565
  const content: AnyMessageContent
522
566
  const options: MiscMessageGenerationOptions
523
567
 
524
- AlexaInc.sendMessage(jid, content, options)
568
+ suki.sendMessage(jid, content, options)
525
569
  ```
526
570
 
527
571
  ### Non-Media Messages
528
572
 
529
573
  #### Text Message
530
574
  ```ts
531
- await AlexaInc.sendMessage(jid, { text: 'hello word' })
575
+ await suki.sendMessage(jid, { text: 'hello word' })
532
576
  ```
533
577
 
534
578
  #### Quote Message (works with all types)
535
579
  ```ts
536
- await AlexaInc.sendMessage(jid, { text: 'hello word' }, { quoted: message })
580
+ await suki.sendMessage(jid, { text: 'hello word' }, { quoted: message })
537
581
  ```
538
582
 
539
583
  #### Mention User (works with most types)
540
584
  - @number is to mention in text, it's optional
541
585
  ```ts
542
- await AlexaInc.sendMessage(
586
+ await suki.sendMessage(
543
587
  jid,
544
588
  {
545
589
  text: '@12345678901',
@@ -552,12 +596,12 @@ await AlexaInc.sendMessage(
552
596
  - You need to have message object, can be retrieved from [store](#implementing-a-data-store) or use a [message](https://baileys.whiskeysockets.io/types/WAMessage.html) object
553
597
  ```ts
554
598
  const msg = getMessageFromStore() // implement this on your end
555
- await AlexaInc.sendMessage(jid, { forward: msg, force: true or number }) // WA forward the message!
599
+ await suki.sendMessage(jid, { forward: msg, force: true or number }) // WA forward the message!
556
600
  ```
557
601
 
558
602
  #### Location Message
559
603
  ```ts
560
- await AlexaInc.sendMessage(
604
+ await suki.sendMessage(
561
605
  jid,
562
606
  {
563
607
  location: {
@@ -570,7 +614,7 @@ await AlexaInc.sendMessage(
570
614
 
571
615
  #### Live Location Message
572
616
  ```ts
573
- await AlexaInc.sendMessage(
617
+ await suki.sendMessage(
574
618
  jid,
575
619
  {
576
620
  location: {
@@ -590,11 +634,11 @@ const vcard = 'BEGIN:VCARD\n' // metadata of the contact card
590
634
  + 'TELtype=CELLtype=VOICEwaid=911234567890:+91 12345 67890\n' // WhatsApp ID + phone number
591
635
  + 'END:VCARD'
592
636
 
593
- await AlexaInc.sendMessage(
637
+ await suki.sendMessage(
594
638
  id,
595
639
  {
596
640
  contacts: {
597
- displayName: 'hansaka02',
641
+ displayName: 'Itsukichann',
598
642
  contacts: [{ vcard }]
599
643
  }
600
644
  }
@@ -604,7 +648,7 @@ await AlexaInc.sendMessage(
604
648
  #### Reaction Message
605
649
  - You need to pass the key of message, you can retrieve from [store](#implementing-a-data-store) or use a [key](https://baileys.whiskeysockets.io/types/WAMessageKey.html) object
606
650
  ```ts
607
- await AlexaInc.sendMessage(
651
+ await suki.sendMessage(
608
652
  jid,
609
653
  {
610
654
  react: {
@@ -627,7 +671,7 @@ await AlexaInc.sendMessage(
627
671
  | 30d | 2.592.000 |
628
672
 
629
673
  ```ts
630
- await AlexaInc.sendMessage(
674
+ await suki.sendMessage(
631
675
  jid,
632
676
  {
633
677
  pin: {
@@ -641,7 +685,7 @@ await AlexaInc.sendMessage(
641
685
 
642
686
  ### Keep Message
643
687
  ```ts
644
- await AlexaInc.sendMessage(
688
+ await suki.sendMessage(
645
689
  jid,
646
690
  {
647
691
  keep: {
@@ -654,7 +698,7 @@ await AlexaInc.sendMessage(
654
698
 
655
699
  #### Poll Message
656
700
  ```ts
657
- await AlexaInc.sendMessage(
701
+ await suki.sendMessage(
658
702
  jid,
659
703
  {
660
704
  poll: {
@@ -669,7 +713,7 @@ await AlexaInc.sendMessage(
669
713
 
670
714
  #### Poll Result Message
671
715
  ```ts
672
- await AlexaInc.sendMessage(
716
+ await suki.sendMessage(
673
717
  jid,
674
718
  {
675
719
  pollResult: {
@@ -691,7 +735,7 @@ await AlexaInc.sendMessage(
691
735
 
692
736
  ### Call Message
693
737
  ```ts
694
- await AlexaInc.sendMessage(
738
+ await suki.sendMessage(
695
739
  jid,
696
740
  {
697
741
  call: {
@@ -704,7 +748,7 @@ await AlexaInc.sendMessage(
704
748
 
705
749
  ### Event Message
706
750
  ```ts
707
- await AlexaInc.sendMessage(
751
+ await suki.sendMessage(
708
752
  jid,
709
753
  {
710
754
  event: {
@@ -727,7 +771,7 @@ await AlexaInc.sendMessage(
727
771
 
728
772
  ### Order Message
729
773
  ```ts
730
- await AlexaInc.sendMessage(
774
+ await suki.sendMessage(
731
775
  jid,
732
776
  {
733
777
  order: {
@@ -749,7 +793,7 @@ await AlexaInc.sendMessage(
749
793
 
750
794
  ### Product Message
751
795
  ```ts
752
- await AlexaInc.sendMessage(
796
+ await suki.sendMessage(
753
797
  jid,
754
798
  {
755
799
  product: {
@@ -775,7 +819,7 @@ await AlexaInc.sendMessage(
775
819
 
776
820
  ### Payment Message
777
821
  ```ts
778
- await AlexaInc.sendMessage(
822
+ await suki.sendMessage(
779
823
  jid,
780
824
  {
781
825
  payment: {
@@ -797,7 +841,7 @@ await AlexaInc.sendMessage(
797
841
 
798
842
  #### Payment Invite Message
799
843
  ```ts
800
- await AlexaInc.sendMessage(
844
+ await suki.sendMessage(
801
845
  id,
802
846
  {
803
847
  paymentInvite: {
@@ -810,7 +854,7 @@ await AlexaInc.sendMessage(
810
854
 
811
855
  ### Admin Invite Message
812
856
  ```ts
813
- await AlexaInc.sendMessage(
857
+ await suki.sendMessage(
814
858
  jid,
815
859
  {
816
860
  adminInvite: {
@@ -826,7 +870,7 @@ await AlexaInc.sendMessage(
826
870
 
827
871
  ### Group Invite Message
828
872
  ```ts
829
- await AlexaInc.sendMessage(
873
+ await suki.sendMessage(
830
874
  jid,
831
875
  {
832
876
  groupInvite: {
@@ -844,12 +888,12 @@ await AlexaInc.sendMessage(
844
888
  ### Sticker Pack Message
845
889
  ```ts
846
890
  // I don't know why the sticker doesn't appear
847
- await AlexaInc.sendMessage(
891
+ await suki.sendMessage(
848
892
  jid,
849
893
  {
850
894
  stickerPack: {
851
895
  name: 'Hiii',
852
- publisher: 'By hansaka02',
896
+ publisher: 'By Itsukichann',
853
897
  description: 'Hello',
854
898
  cover: Buffer, // Image buffer
855
899
  stickers: [{
@@ -873,7 +917,7 @@ await AlexaInc.sendMessage(
873
917
 
874
918
  ### Share Phone Number Message
875
919
  ```ts
876
- await AlexaInc.sendMessage(
920
+ await suki.sendMessage(
877
921
  jid,
878
922
  {
879
923
  sharePhoneNumber: {
@@ -884,7 +928,7 @@ await AlexaInc.sendMessage(
884
928
 
885
929
  ### Request Phone Number Message
886
930
  ```ts
887
- await AlexaInc.sendMessage(
931
+ await suki.sendMessage(
888
932
  jid,
889
933
  {
890
934
  requestPhoneNumber: {
@@ -896,7 +940,7 @@ await AlexaInc.sendMessage(
896
940
  ### Buttons Reply Message
897
941
  ```ts
898
942
  // List
899
- await AlexaInc.sendMessage(
943
+ await suki.sendMessage(
900
944
  jid,
901
945
  {
902
946
  buttonReply: {
@@ -908,7 +952,7 @@ await AlexaInc.sendMessage(
908
952
  }
909
953
  )
910
954
  // Plain
911
- await AlexaInc.sendMessage(
955
+ await suki.sendMessage(
912
956
  jid,
913
957
  {
914
958
  buttonReply: {
@@ -920,7 +964,7 @@ await AlexaInc.sendMessage(
920
964
  )
921
965
 
922
966
  // Template
923
- await AlexaInc.sendMessage(
967
+ await suki.sendMessage(
924
968
  jid,
925
969
  {
926
970
  buttonReply: {
@@ -933,7 +977,7 @@ await AlexaInc.sendMessage(
933
977
  )
934
978
 
935
979
  // Interactive
936
- await AlexaInc.sendMessage(
980
+ await suki.sendMessage(
937
981
  jid,
938
982
  {
939
983
  buttonReply: {
@@ -951,7 +995,7 @@ await AlexaInc.sendMessage(
951
995
 
952
996
  ### Buttons Message
953
997
  ```ts
954
- await AlexaInc.sendMessage(
998
+ await suki.sendMessage(
955
999
  jid,
956
1000
  {
957
1001
  text: 'This is a button message!', // image: buffer or // image: { url: url } If you want to use images
@@ -982,7 +1026,7 @@ await AlexaInc.sendMessage(
982
1026
  ### Buttons List Message
983
1027
  ```ts
984
1028
  // Just working in a private chat
985
- await AlexaInc.sendMessage(
1029
+ await suki.sendMessage(
986
1030
  jid,
987
1031
  {
988
1032
  text: 'This is a list!',
@@ -1021,7 +1065,7 @@ await AlexaInc.sendMessage(
1021
1065
  ### Buttons Product List Message
1022
1066
  ```ts
1023
1067
  // Just working in a private chat
1024
- await AlexaInc.sendMessage(
1068
+ await suki.sendMessage(
1025
1069
  jid,
1026
1070
  {
1027
1071
  text: 'This is a list!',
@@ -1047,7 +1091,7 @@ await AlexaInc.sendMessage(
1047
1091
 
1048
1092
  ### Buttons Cards Message
1049
1093
  ```ts
1050
- await AlexaInc.sendMessage(
1094
+ await suki.sendMessage(
1051
1095
  jid,
1052
1096
  {
1053
1097
  text: 'Body Message',
@@ -1107,7 +1151,7 @@ await AlexaInc.sendMessage(
1107
1151
  ### Buttons Template Message
1108
1152
  ```ts
1109
1153
  // This no longer works
1110
- await AlexaInc.sendMessage(
1154
+ await suki.sendMessage(
1111
1155
  jid,
1112
1156
  {
1113
1157
  text: 'This is a template message!',
@@ -1139,7 +1183,7 @@ await AlexaInc.sendMessage(
1139
1183
 
1140
1184
  ### Buttons Interactive Message
1141
1185
  ```ts
1142
- await AlexaInc.sendMessage(
1186
+ await suki.sendMessage(
1143
1187
  jid,
1144
1188
  {
1145
1189
  text: 'This is an Interactive message!',
@@ -1242,7 +1286,7 @@ await AlexaInc.sendMessage(
1242
1286
  flow_message_version: '3',
1243
1287
  flow_token: '1:1307913409923914:293680f87029f5a13d1ec5e35e718af3',
1244
1288
  flow_id: '1307913409923914',
1245
- flow_cta: 'hansaka02 kawaii >\\<',
1289
+ flow_cta: 'Itsukichann kawaii >\\<',
1246
1290
  flow_action: 'navigate',
1247
1291
  flow_action_payload: {
1248
1292
  screen: 'QUESTION_ONE',
@@ -1291,7 +1335,7 @@ await AlexaInc.sendMessage(
1291
1335
  )
1292
1336
 
1293
1337
  // If you want to use an image
1294
- await AlexaInc.sendMessage(
1338
+ await suki.sendMessage(
1295
1339
  jid,
1296
1340
  {
1297
1341
  image: {
@@ -1315,7 +1359,7 @@ await AlexaInc.sendMessage(
1315
1359
  )
1316
1360
 
1317
1361
  // If you want to use an video
1318
- await AlexaInc.sendMessage(
1362
+ await suki.sendMessage(
1319
1363
  jid,
1320
1364
  {
1321
1365
  video: {
@@ -1339,14 +1383,14 @@ await AlexaInc.sendMessage(
1339
1383
  )
1340
1384
 
1341
1385
  // If you want to use an document
1342
- await AlexaInc.sendMessage(
1386
+ await suki.sendMessage(
1343
1387
  jid,
1344
1388
  {
1345
1389
  document: {
1346
1390
  url: 'https://example.com/jdbenkksjs.jpg'
1347
1391
  },
1348
1392
  mimetype: 'image/jpeg',
1349
- jpegThumbnail: await AlexaInc.resize('https://example.com/jdbenkksjs.jpg', 320, 320),
1393
+ jpegThumbnail: await suki.resize('https://example.com/jdbenkksjs.jpg', 320, 320),
1350
1394
  caption: 'Body',
1351
1395
  title: 'Title',
1352
1396
  subtitle: 'Subtitle',
@@ -1365,7 +1409,7 @@ await AlexaInc.sendMessage(
1365
1409
  )
1366
1410
 
1367
1411
  // If you want to use an location
1368
- await AlexaInc.sendMessage(
1412
+ await suki.sendMessage(
1369
1413
  jid,
1370
1414
  {
1371
1415
  location: {
@@ -1391,7 +1435,7 @@ await AlexaInc.sendMessage(
1391
1435
  )
1392
1436
 
1393
1437
  // if you want to use an product
1394
- await AlexaInc.sendMessage(
1438
+ await suki.sendMessage(
1395
1439
  jid,
1396
1440
  {
1397
1441
  product: {
@@ -1403,7 +1447,7 @@ await AlexaInc.sendMessage(
1403
1447
  description: 'Description',
1404
1448
  currencyCode: 'IDR',
1405
1449
  priceAmount1000: '283xxx',
1406
- retailerId: 'hansaka02',
1450
+ retailerId: 'Itsukichann',
1407
1451
  url: 'https://example.com',
1408
1452
  productImageCount: 1
1409
1453
  },
@@ -1428,7 +1472,7 @@ await AlexaInc.sendMessage(
1428
1472
 
1429
1473
  ### Buttons Interactive Message PIX
1430
1474
  ```ts
1431
- await AlexaInc.sendMessage(
1475
+ await suki.sendMessage(
1432
1476
  jid,
1433
1477
  {
1434
1478
  text: '', // This string is required. Even it's empty.
@@ -1439,8 +1483,8 @@ await AlexaInc.sendMessage(
1439
1483
  payment_settings: [{
1440
1484
  type: "pix_static_code",
1441
1485
  pix_static_code: {
1442
- merchant_name: 'hansaka02 kawaii >\\\\\\<',
1443
- key: 'example@hansaka02.com',
1486
+ merchant_name: 'itsukichann kawaii >\\\\\\<',
1487
+ key: 'example@itsukichan.com',
1444
1488
  key_type: 'EMAIL' // PHONE || EMAIL || CPF || EVP
1445
1489
  }
1446
1490
  }]
@@ -1453,7 +1497,7 @@ await AlexaInc.sendMessage(
1453
1497
 
1454
1498
  ### Buttons Interactive Message PAY
1455
1499
  ```ts
1456
- await AlexaInc.sendMessage(
1500
+ await suki.sendMessage(
1457
1501
  jid,
1458
1502
  {
1459
1503
  text: '', // This string is required. Even it's empty.
@@ -1483,7 +1527,7 @@ await AlexaInc.sendMessage(
1483
1527
  order_type: 'PAYMENT_REQUEST',
1484
1528
  items: [{
1485
1529
  retailer_id: 'your_retailer_id',
1486
- name: 'hansaka02 Kawaii >\\\<',
1530
+ name: 'Itsukichann Kawaii >\\\<',
1487
1531
  amount: {
1488
1532
  value: '999999999',
1489
1533
  offset: '100'
@@ -1491,7 +1535,7 @@ await AlexaInc.sendMessage(
1491
1535
  quantity: '1',
1492
1536
  }]
1493
1537
  },
1494
- additional_note: 'hansaka02 Kawaii >\\\<',
1538
+ additional_note: 'Itsukichann Kawaii >\\\<',
1495
1539
  native_payment_methods: [],
1496
1540
  share_payment_status: false
1497
1541
  })
@@ -1511,7 +1555,7 @@ const jidat = [
1511
1555
  '62xxxxxxx@s.whatsapp.net'
1512
1556
  ]
1513
1557
  // Text
1514
- await AlexaInc.sendStatusMentions(
1558
+ await suki.sendStatusMentions(
1515
1559
  {
1516
1560
  text: 'Hello Everyone :3',
1517
1561
  font: 2, // optional
@@ -1522,7 +1566,7 @@ await AlexaInc.sendStatusMentions(
1522
1566
  )
1523
1567
 
1524
1568
  // Image
1525
- await AlexaInc.sendStatusMentions(
1569
+ await suki.sendStatusMentions(
1526
1570
  {
1527
1571
  Image: { url: 'https://example.com/ruriooe.jpg' }, or image buffer
1528
1572
  caption: 'Hello Everyone :3' // optional
@@ -1531,7 +1575,7 @@ await AlexaInc.sendStatusMentions(
1531
1575
  )
1532
1576
 
1533
1577
  // Video
1534
- await AlexaInc.sendStatusMentions(
1578
+ await suki.sendStatusMentions(
1535
1579
  {
1536
1580
  video: { url: 'https://example.com/ruriooe.mp4' }, or video buffer
1537
1581
  caption: 'Hello Everyone :3' // optional
@@ -1540,7 +1584,7 @@ await AlexaInc.sendStatusMentions(
1540
1584
  )
1541
1585
 
1542
1586
  // Audio
1543
- await AlexaInc.sendStatusMentions(
1587
+ await suki.sendStatusMentions(
1544
1588
  {
1545
1589
  audio: { url: 'https://example.com/ruriooe.mp3' }, or audio buffer
1546
1590
  backgroundColor: '#000000', // optional
@@ -1553,7 +1597,7 @@ await AlexaInc.sendStatusMentions(
1553
1597
 
1554
1598
  ### Shop Message
1555
1599
  ```ts
1556
- await AlexaInc.sendMessage(
1600
+ await suki.sendMessage(
1557
1601
  jid,
1558
1602
  {
1559
1603
  text: 'Body',
@@ -1569,7 +1613,7 @@ await AlexaInc.sendMessage(
1569
1613
  )
1570
1614
 
1571
1615
  // Image
1572
- await AlexaInc.sendMessage(
1616
+ await suki.sendMessage(
1573
1617
  jid,
1574
1618
  {
1575
1619
  image: {
@@ -1589,7 +1633,7 @@ await AlexaInc.sendMessage(
1589
1633
  )
1590
1634
 
1591
1635
  // Video
1592
- await AlexaInc.sendMessage(
1636
+ await suki.sendMessage(
1593
1637
  jid,
1594
1638
  {
1595
1639
  video: {
@@ -1609,14 +1653,14 @@ await AlexaInc.sendMessage(
1609
1653
  )
1610
1654
 
1611
1655
  // Document
1612
- await AlexaInc.sendMessage(
1656
+ await suki.sendMessage(
1613
1657
  jid,
1614
1658
  {
1615
1659
  document: {
1616
1660
  url: 'https://example.com/jdbenkksjs.jpg'
1617
1661
  },
1618
1662
  mimetype: 'image/jpeg',
1619
- jpegThumbnail: await AlexaInc.resize('https://example.com/jdbenkksjs.jpg', 320, 320),
1663
+ jpegThumbnail: await suki.resize('https://example.com/jdbenkksjs.jpg', 320, 320),
1620
1664
  caption: 'Body',
1621
1665
  title: 'Title',
1622
1666
  subtitle: 'Subtitle',
@@ -1631,7 +1675,7 @@ await AlexaInc.sendMessage(
1631
1675
  )
1632
1676
 
1633
1677
  // Location
1634
- await AlexaInc.sendMessage(
1678
+ await suki.sendMessage(
1635
1679
  jid,
1636
1680
  {
1637
1681
  location: {
@@ -1653,7 +1697,7 @@ await AlexaInc.sendMessage(
1653
1697
  )
1654
1698
 
1655
1699
  // Product
1656
- await AlexaInc.sendMessage(
1700
+ await suki.sendMessage(
1657
1701
  jid,
1658
1702
  {
1659
1703
  product: {
@@ -1665,7 +1709,7 @@ await AlexaInc.sendMessage(
1665
1709
  description: 'Description',
1666
1710
  currencyCode: 'IDR',
1667
1711
  priceAmount1000: '283xxx',
1668
- retailerId: 'hansaka02',
1712
+ retailerId: 'Itsukichann',
1669
1713
  url: 'https://example.com',
1670
1714
  productImageCount: 1
1671
1715
  },
@@ -1685,7 +1729,7 @@ await AlexaInc.sendMessage(
1685
1729
  ```
1686
1730
  ### Collection Message
1687
1731
  ```ts
1688
- await AlexaInc.sendMessage(
1732
+ await suki.sendMessage(
1689
1733
  jid,
1690
1734
  {
1691
1735
  text: 'Body',
@@ -1702,7 +1746,7 @@ await AlexaInc.sendMessage(
1702
1746
  )
1703
1747
 
1704
1748
  // Image
1705
- await AlexaInc.sendMessage(
1749
+ await suki.sendMessage(
1706
1750
  jid,
1707
1751
  {
1708
1752
  image: {
@@ -1723,7 +1767,7 @@ await AlexaInc.sendMessage(
1723
1767
  )
1724
1768
 
1725
1769
  // Video
1726
- await AlexaInc.sendMessage(
1770
+ await suki.sendMessage(
1727
1771
  jid,
1728
1772
  {
1729
1773
  video: {
@@ -1744,14 +1788,14 @@ await AlexaInc.sendMessage(
1744
1788
  )
1745
1789
 
1746
1790
  // Document
1747
- await AlexaInc.sendMessage(
1791
+ await suki.sendMessage(
1748
1792
  jid,
1749
1793
  {
1750
1794
  document: {
1751
1795
  url: 'https://example.com/jdbenkksjs.jpg'
1752
1796
  },
1753
1797
  mimetype: 'image/jpeg',
1754
- jpegThumbnail: await AlexaInc.resize('https://example.com/jdbenkksjs.jpg', 320, 320),
1798
+ jpegThumbnail: await suki.resize('https://example.com/jdbenkksjs.jpg', 320, 320),
1755
1799
  caption: 'Body',
1756
1800
  title: 'Title',
1757
1801
  subtitle: 'Subtitle',
@@ -1767,7 +1811,7 @@ await AlexaInc.sendMessage(
1767
1811
  )
1768
1812
 
1769
1813
  // Location
1770
- await AlexaInc.sendMessage(
1814
+ await suki.sendMessage(
1771
1815
  jid,
1772
1816
  {
1773
1817
  location: {
@@ -1790,7 +1834,7 @@ await AlexaInc.sendMessage(
1790
1834
  )
1791
1835
 
1792
1836
  // Product
1793
- await AlexaInc.sendMessage(
1837
+ await suki.sendMessage(
1794
1838
  jid,
1795
1839
  {
1796
1840
  product: {
@@ -1802,7 +1846,7 @@ await AlexaInc.sendMessage(
1802
1846
  description: 'Description',
1803
1847
  currencyCode: 'IDR',
1804
1848
  priceAmount1000: '283xxx',
1805
- retailerId: 'hansaka02',
1849
+ retailerId: 'Itsukichann',
1806
1850
  url: 'https://example.com',
1807
1851
  productImageCount: 1
1808
1852
  },
@@ -1824,7 +1868,7 @@ await AlexaInc.sendMessage(
1824
1868
 
1825
1869
  ### AI Icon Feature
1826
1870
  ```ts
1827
- await AlexaInc.sendMessage(
1871
+ await suki.sendMessage(
1828
1872
  jid,
1829
1873
  {
1830
1874
  text: 'Hi'
@@ -1834,7 +1878,7 @@ await AlexaInc.sendMessage(
1834
1878
  )
1835
1879
 
1836
1880
  // If using relay
1837
- await AlexaInc.relayMessage(
1881
+ await suki.relayMessage(
1838
1882
  jid,
1839
1883
  {
1840
1884
  extendedTextMessage: {
@@ -1853,7 +1897,7 @@ await AlexaInc.relayMessage(
1853
1897
  3. To enable this function's usage, add `link-preview-js` as a dependency to your project with `yarn add link-preview-js`
1854
1898
  4. Send a link:
1855
1899
  ```ts
1856
- await AlexaInc.sendMessage(
1900
+ await suki.sendMessage(
1857
1901
  jid,
1858
1902
  {
1859
1903
  text: 'Hi, this was sent using https://github.com/whiskeysockets/baileys'
@@ -1876,7 +1920,7 @@ Sending media (video, stickers, images) is easier & more efficient than ever.
1876
1920
  #### Gif Message
1877
1921
  - Whatsapp doesn't support `.gif` files, that's why we send gifs as common `.mp4` video with `gifPlayback` flag
1878
1922
  ```ts
1879
- await AlexaInc.sendMessage(
1923
+ await suki.sendMessage(
1880
1924
  jid,
1881
1925
  {
1882
1926
  video: fs.readFileSync('Media/ma_gif.mp4'),
@@ -1888,7 +1932,7 @@ await AlexaInc.sendMessage(
1888
1932
 
1889
1933
  #### Video Message
1890
1934
  ```ts
1891
- await AlexaInc.sendMessage(
1935
+ await suki.sendMessage(
1892
1936
  id,
1893
1937
  {
1894
1938
  video: {
@@ -1901,7 +1945,7 @@ await AlexaInc.sendMessage(
1901
1945
 
1902
1946
  #### Video Ptv Message
1903
1947
  ```ts
1904
- await AlexaInc.sendMessage(
1948
+ await suki.sendMessage(
1905
1949
  id,
1906
1950
  {
1907
1951
  video: {
@@ -1925,7 +1969,7 @@ await AlexaInc.sendMessage(
1925
1969
  ffmpeg -i input.mp4 -avoid_negative_ts make_zero -ac 1 output.ogg
1926
1970
  ```
1927
1971
  ```ts
1928
- await AlexaInc.sendMessage(
1972
+ await suki.sendMessage(
1929
1973
  jid,
1930
1974
  {
1931
1975
  audio: {
@@ -1938,7 +1982,7 @@ await AlexaInc.sendMessage(
1938
1982
 
1939
1983
  #### Image Message
1940
1984
  ```ts
1941
- await AlexaInc.sendMessage(
1985
+ await suki.sendMessage(
1942
1986
  id,
1943
1987
  {
1944
1988
  image: {
@@ -1951,12 +1995,12 @@ await AlexaInc.sendMessage(
1951
1995
 
1952
1996
  ### Album Message
1953
1997
  ```ts
1954
- await AlexaInc.sendMessage(
1998
+ await suki.sendMessage(
1955
1999
  id,
1956
2000
  {
1957
2001
  album: [{
1958
2002
  image: {
1959
- url: 'https://example.com/hansaka02.jpg'
2003
+ url: 'https://example.com/itsukichan.jpg'
1960
2004
  },
1961
2005
  caption: 'Hay'
1962
2006
  }, {
@@ -1964,7 +2008,7 @@ await AlexaInc.sendMessage(
1964
2008
  caption: 'Hay'
1965
2009
  }, {
1966
2010
  video: {
1967
- url: 'https://example.com/hansaka02.mp4'
2011
+ url: 'https://example.com/itsukichan.mp4'
1968
2012
  },
1969
2013
  caption: 'Hay'
1970
2014
  }, {
@@ -1980,7 +2024,7 @@ await AlexaInc.sendMessage(
1980
2024
  - You can send all messages above as `viewOnce`, you only need to pass `viewOnce: true` in content object
1981
2025
 
1982
2026
  ```ts
1983
- await AlexaInc.sendMessage(
2027
+ await suki.sendMessage(
1984
2028
  id,
1985
2029
  {
1986
2030
  image: {
@@ -1997,8 +2041,8 @@ await AlexaInc.sendMessage(
1997
2041
  ### Deleting Messages (for everyone)
1998
2042
 
1999
2043
  ```ts
2000
- const msg = await AlexaInc.sendMessage(jid, { text: 'hello word' })
2001
- await AlexaInc.sendMessage(jid, { delete: msg.key })
2044
+ const msg = await suki.sendMessage(jid, { text: 'hello word' })
2045
+ await suki.sendMessage(jid, { delete: msg.key })
2002
2046
  ```
2003
2047
 
2004
2048
  **Note:** deleting for oneself is supported via `chatModify`, see in [this section](#modifying-chats)
@@ -2007,7 +2051,7 @@ await AlexaInc.sendMessage(jid, { delete: msg.key })
2007
2051
 
2008
2052
  - You can pass all editable contents here
2009
2053
  ```ts
2010
- await AlexaInc.sendMessage(jid, {
2054
+ await suki.sendMessage(jid, {
2011
2055
  text: 'updated text goes here',
2012
2056
  edit: response.key,
2013
2057
  })
@@ -2024,9 +2068,9 @@ await AlexaInc.sendMessage(jid, {
2024
2068
  If you want to save the media you received
2025
2069
  ```ts
2026
2070
  import { createWriteStream } from 'fs'
2027
- import { downloadMediaMessage, getContentType } from '@hansaka02/baileys'
2071
+ import { downloadMediaMessage, getContentType } from '@itsukichan/baileys'
2028
2072
 
2029
- AlexaInc.ev.on('messages.upsert', async ({ [m] }) => {
2073
+ suki.ev.on('messages.upsert', async ({ [m] }) => {
2030
2074
  if (!m.message) return // if there is no text or media message
2031
2075
  const messageType = getContentType(m) // get what type of message it is (text, image, video...)
2032
2076
 
@@ -2041,7 +2085,7 @@ AlexaInc.ev.on('messages.upsert', async ({ [m] }) => {
2041
2085
  logger,
2042
2086
  // pass this so that baileys can request a reupload of media
2043
2087
  // that has been deleted
2044
- reuploadRequest: AlexaInc.updateMediaMessage
2088
+ reuploadRequest: suki.updateMediaMessage
2045
2089
  }
2046
2090
  )
2047
2091
  // save to file
@@ -2055,7 +2099,7 @@ AlexaInc.ev.on('messages.upsert', async ({ [m] }) => {
2055
2099
 
2056
2100
  - 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:
2057
2101
  ```ts
2058
- await AlexaInc.updateMediaMessage(msg)
2102
+ await suki.updateMediaMessage(msg)
2059
2103
  ```
2060
2104
 
2061
2105
  ## Reject Call
@@ -2063,7 +2107,7 @@ await AlexaInc.updateMediaMessage(msg)
2063
2107
  - You can obtain `callId` and `callFrom` from `call` event
2064
2108
 
2065
2109
  ```ts
2066
- await AlexaInc.rejectCall(callId, callFrom)
2110
+ await suki.rejectCall(callId, callFrom)
2067
2111
  ```
2068
2112
 
2069
2113
  ## Send States in Chat
@@ -2076,7 +2120,7 @@ This means you have to keep track of unread messages.
2076
2120
  ```ts
2077
2121
  const key: WAMessageKey
2078
2122
  // can pass multiple keys to read multiple messages as well
2079
- await AlexaInc.readMessages([key])
2123
+ await suki.readMessages([key])
2080
2124
  ```
2081
2125
 
2082
2126
  The message ID is the unique identifier of the message that you are marking as read.
@@ -2089,11 +2133,11 @@ On a `WAMessage`, the `messageID` can be accessed using ```messageID = message.k
2089
2133
  - This lets the person/group with `jid` know whether you're online, offline, typing etc.
2090
2134
 
2091
2135
  ```ts
2092
- await AlexaInc.sendPresenceUpdate('available', jid)
2136
+ await suki.sendPresenceUpdate('available', jid)
2093
2137
  ```
2094
2138
 
2095
2139
  > [!NOTE]
2096
- > If a desktop client is active, WA doesn't send push notifications to the device. If you would like to receive said notifications -- mark your Baileys client offline using `AlexaInc.sendPresenceUpdate('unavailable')`
2140
+ > If a desktop client is active, WA doesn't send push notifications to the device. If you would like to receive said notifications -- mark your Baileys client offline using `suki.sendPresenceUpdate('unavailable')`
2097
2141
 
2098
2142
  ## Modifying Chats
2099
2143
 
@@ -2105,7 +2149,7 @@ WA uses an encrypted form of communication to send chat/app updates. This has be
2105
2149
  ### Archive a Chat
2106
2150
  ```ts
2107
2151
  const lastMsgInChat = await getLastMessageInChat(jid) // implement this on your end
2108
- await AlexaInc.chatModify({ archive: true, lastMessages: [lastMsgInChat] }, jid)
2152
+ await suki.chatModify({ archive: true, lastMessages: [lastMsgInChat] }, jid)
2109
2153
  ```
2110
2154
  ### Mute/Unmute a Chat
2111
2155
 
@@ -2119,20 +2163,20 @@ await AlexaInc.chatModify({ archive: true, lastMessages: [lastMsgInChat] }, jid)
2119
2163
 
2120
2164
  ```ts
2121
2165
  // mute for 8 hours
2122
- await AlexaInc.chatModify({ mute: 8 * 60 * 60 * 1000 }, jid)
2166
+ await suki.chatModify({ mute: 8 * 60 * 60 * 1000 }, jid)
2123
2167
  // unmute
2124
- await AlexaInc.chatModify({ mute: null }, jid)
2168
+ await suki.chatModify({ mute: null }, jid)
2125
2169
  ```
2126
2170
  ### Mark a Chat Read/Unread
2127
2171
  ```ts
2128
2172
  const lastMsgInChat = await getLastMessageInChat(jid) // implement this on your end
2129
2173
  // mark it unread
2130
- await AlexaInc.chatModify({ markRead: false, lastMessages: [lastMsgInChat] }, jid)
2174
+ await suki.chatModify({ markRead: false, lastMessages: [lastMsgInChat] }, jid)
2131
2175
  ```
2132
2176
 
2133
2177
  ### Delete a Message for Me
2134
2178
  ```ts
2135
- await AlexaInc.chatModify(
2179
+ await suki.chatModify(
2136
2180
  {
2137
2181
  clear: {
2138
2182
  messages: [
@@ -2151,7 +2195,7 @@ await AlexaInc.chatModify(
2151
2195
  ### Delete a Chat
2152
2196
  ```ts
2153
2197
  const lastMsgInChat = await getLastMessageInChat(jid) // implement this on your end
2154
- await AlexaInc.chatModify({
2198
+ await suki.chatModify({
2155
2199
  delete: true,
2156
2200
  lastMessages: [
2157
2201
  {
@@ -2165,7 +2209,7 @@ await AlexaInc.chatModify({
2165
2209
  ```
2166
2210
  ### Pin/Unpin a Chat
2167
2211
  ```ts
2168
- await AlexaInc.chatModify({
2212
+ await suki.chatModify({
2169
2213
  pin: true // or `false` to unpin
2170
2214
  },
2171
2215
  jid
@@ -2173,7 +2217,7 @@ await AlexaInc.chatModify({
2173
2217
  ```
2174
2218
  ### Star/Unstar a Message
2175
2219
  ```ts
2176
- await AlexaInc.chatModify({
2220
+ await suki.chatModify({
2177
2221
  star: {
2178
2222
  messages: [
2179
2223
  {
@@ -2203,17 +2247,17 @@ await AlexaInc.chatModify({
2203
2247
 
2204
2248
  ```ts
2205
2249
  // turn on disappearing messages
2206
- await AlexaInc.sendMessage(
2250
+ await suki.sendMessage(
2207
2251
  jid,
2208
2252
  // this is 1 week in seconds -- how long you want messages to appear for
2209
2253
  { disappearingMessagesInChat: WA_DEFAULT_EPHEMERAL }
2210
2254
  )
2211
2255
 
2212
2256
  // will send as a disappearing message
2213
- await AlexaInc.sendMessage(jid, { text: 'hello' }, { ephemeralExpiration: WA_DEFAULT_EPHEMERAL })
2257
+ await suki.sendMessage(jid, { text: 'hello' }, { ephemeralExpiration: WA_DEFAULT_EPHEMERAL })
2214
2258
 
2215
2259
  // turn off disappearing messages
2216
- await AlexaInc.sendMessage(
2260
+ await suki.sendMessage(
2217
2261
  jid,
2218
2262
  { disappearingMessagesInChat: false }
2219
2263
  )
@@ -2221,14 +2265,14 @@ await AlexaInc.sendMessage(
2221
2265
 
2222
2266
  ### Clear Messages
2223
2267
  ```ts
2224
- await AlexaInc.clearMessage(jid, key, timestamps)
2268
+ await suki.clearMessage(jid, key, timestamps)
2225
2269
  ```
2226
2270
 
2227
2271
  ## User Querys
2228
2272
 
2229
2273
  ### Check If ID Exists in Whatsapp
2230
2274
  ```ts
2231
- const [result] = await AlexaInc.onWhatsApp(jid)
2275
+ const [result] = await suki.onWhatsApp(jid)
2232
2276
  if (result.exists) console.log (`${jid} exists on WhatsApp, as jid: ${result.jid}`)
2233
2277
  ```
2234
2278
 
@@ -2237,7 +2281,7 @@ if (result.exists) console.log (`${jid} exists on WhatsApp, as jid: ${result.jid
2237
2281
  - You need to have oldest message in chat
2238
2282
  ```ts
2239
2283
  const msg = await getOldestMessageInChat(jid)
2240
- await AlexaInc.fetchMessageHistory(
2284
+ await suki.fetchMessageHistory(
2241
2285
  50, //quantity (max: 50 per query)
2242
2286
  msg.key,
2243
2287
  msg.messageTimestamp
@@ -2247,7 +2291,7 @@ await AlexaInc.fetchMessageHistory(
2247
2291
 
2248
2292
  ### Fetch Status
2249
2293
  ```ts
2250
- const status = await AlexaInc.fetchStatus(jid)
2294
+ const status = await suki.fetchStatus(jid)
2251
2295
  console.log('status: ' + status)
2252
2296
  ```
2253
2297
 
@@ -2255,34 +2299,34 @@ console.log('status: ' + status)
2255
2299
  - To get the display picture of some person, group and channel
2256
2300
  ```ts
2257
2301
  // for low res picture
2258
- const ppUrl = await AlexaInc.profilePictureUrl(jid)
2302
+ const ppUrl = await suki.profilePictureUrl(jid)
2259
2303
  console.log(ppUrl)
2260
2304
  ```
2261
2305
 
2262
2306
  ### Fetch Bussines Profile (such as description or category)
2263
2307
  ```ts
2264
- const profile = await AlexaInc.getBusinessProfile(jid)
2308
+ const profile = await suki.getBusinessProfile(jid)
2265
2309
  console.log('business description: ' + profile.description + ', category: ' + profile.category)
2266
2310
  ```
2267
2311
 
2268
2312
  ### Fetch Someone's Presence (if they're typing or online)
2269
2313
  ```ts
2270
2314
  // the presence update is fetched and called here
2271
- AlexaInc.ev.on('presence.update', console.log)
2315
+ suki.ev.on('presence.update', console.log)
2272
2316
 
2273
2317
  // request updates for a chat
2274
- await AlexaInc.presenceSubscribe(jid)
2318
+ await suki.presenceSubscribe(jid)
2275
2319
  ```
2276
2320
 
2277
2321
  ## Change Profile
2278
2322
 
2279
2323
  ### Change Profile Status
2280
2324
  ```ts
2281
- await AlexaInc.updateProfileStatus('Hello World!')
2325
+ await suki.updateProfileStatus('Hello World!')
2282
2326
  ```
2283
2327
  ### Change Profile Name
2284
2328
  ```ts
2285
- await AlexaInc.updateProfileName('My name')
2329
+ await suki.updateProfileName('My name')
2286
2330
  ```
2287
2331
  ### Change Display Picture (groups too)
2288
2332
  - To change your display picture or a group's
@@ -2291,11 +2335,11 @@ await AlexaInc.updateProfileName('My name')
2291
2335
  > Like media messages, you can pass `{ stream: Stream }` or `{ url: Url }` or `Buffer` directly, you can see more [here](https://baileys.whiskeysockets.io/types/WAMediaUpload.html)
2292
2336
 
2293
2337
  ```ts
2294
- await AlexaInc.updateProfilePicture(jid, { url: './new-profile-picture.jpeg' })
2338
+ await suki.updateProfilePicture(jid, { url: './new-profile-picture.jpeg' })
2295
2339
  ```
2296
2340
  ### Remove display picture (groups too)
2297
2341
  ```ts
2298
- await AlexaInc.removeProfilePicture(jid)
2342
+ await suki.removeProfilePicture(jid)
2299
2343
  ```
2300
2344
 
2301
2345
  ## Groups
@@ -2305,14 +2349,14 @@ await AlexaInc.removeProfilePicture(jid)
2305
2349
  ### Create a Group
2306
2350
  ```ts
2307
2351
  // title & participants
2308
- const group = await AlexaInc.groupCreate('My Fab Group', ['1234@s.whatsapp.net', '4564@s.whatsapp.net'])
2352
+ const group = await suki.groupCreate('My Fab Group', ['1234@s.whatsapp.net', '4564@s.whatsapp.net'])
2309
2353
  console.log('created group with id: ' + group.gid)
2310
- await AlexaInc.sendMessage(group.id, { text: 'hello there' }) // say hello to everyone on the group
2354
+ await suki.sendMessage(group.id, { text: 'hello there' }) // say hello to everyone on the group
2311
2355
  ```
2312
2356
  ### Add/Remove or Demote/Promote
2313
2357
  ```ts
2314
2358
  // id & people to add to the group (will throw error if it fails)
2315
- await AlexaInc.groupParticipantsUpdate(
2359
+ await suki.groupParticipantsUpdate(
2316
2360
  jid,
2317
2361
  ['abcd@s.whatsapp.net', 'efgh@s.whatsapp.net'],
2318
2362
  'add' // replace this parameter with 'remove' or 'demote' or 'promote'
@@ -2320,68 +2364,68 @@ await AlexaInc.groupParticipantsUpdate(
2320
2364
  ```
2321
2365
  ### Change Subject (name)
2322
2366
  ```ts
2323
- await AlexaInc.groupUpdateSubject(jid, 'New Subject!')
2367
+ await suki.groupUpdateSubject(jid, 'New Subject!')
2324
2368
  ```
2325
2369
  ### Change Description
2326
2370
  ```ts
2327
- await AlexaInc.groupUpdateDescription(jid, 'New Description!')
2371
+ await suki.groupUpdateDescription(jid, 'New Description!')
2328
2372
  ```
2329
2373
  ### Change Settings
2330
2374
  ```ts
2331
2375
  // only allow admins to send messages
2332
- await AlexaInc.groupSettingUpdate(jid, 'announcement')
2376
+ await suki.groupSettingUpdate(jid, 'announcement')
2333
2377
  // allow everyone to send messages
2334
- await AlexaInc.groupSettingUpdate(jid, 'not_announcement')
2378
+ await suki.groupSettingUpdate(jid, 'not_announcement')
2335
2379
  // allow everyone to modify the group's settings -- like display picture etc.
2336
- await AlexaInc.groupSettingUpdate(jid, 'unlocked')
2380
+ await suki.groupSettingUpdate(jid, 'unlocked')
2337
2381
  // only allow admins to modify the group's settings
2338
- await AlexaInc.groupSettingUpdate(jid, 'locked')
2382
+ await suki.groupSettingUpdate(jid, 'locked')
2339
2383
  ```
2340
2384
  ### Leave a Group
2341
2385
  ```ts
2342
2386
  // will throw error if it fails
2343
- await AlexaInc.groupLeave(jid)
2387
+ await suki.groupLeave(jid)
2344
2388
  ```
2345
2389
  ### Get Invite Code
2346
2390
  - To create link with code use `'https://chat.whatsapp.com/' + code`
2347
2391
  ```ts
2348
- const code = await AlexaInc.groupInviteCode(jid)
2392
+ const code = await suki.groupInviteCode(jid)
2349
2393
  console.log('group code: ' + code)
2350
2394
  ```
2351
2395
  ### Revoke Invite Code
2352
2396
  ```ts
2353
- const code = await AlexaInc.groupRevokeInvite(jid)
2397
+ const code = await suki.groupRevokeInvite(jid)
2354
2398
  console.log('New group code: ' + code)
2355
2399
  ```
2356
2400
  ### Join Using Invitation Code
2357
2401
  - Code can't have `https://chat.whatsapp.com/`, only code
2358
2402
  ```ts
2359
- const response = await AlexaInc.groupAcceptInvite(code)
2403
+ const response = await suki.groupAcceptInvite(code)
2360
2404
  console.log('joined to: ' + response)
2361
2405
  ```
2362
2406
  ### Get Group Info by Invite Code
2363
2407
  ```ts
2364
- const response = await AlexaInc.groupGetInviteInfo(code)
2408
+ const response = await suki.groupGetInviteInfo(code)
2365
2409
  console.log('group information: ' + response)
2366
2410
  ```
2367
2411
  ### Query Metadata (participants, name, description...)
2368
2412
  ```ts
2369
- const metadata = await AlexaInc.groupMetadata(jid)
2413
+ const metadata = await suki.groupMetadata(jid)
2370
2414
  console.log(metadata.id + ', title: ' + metadata.subject + ', description: ' + metadata.desc)
2371
2415
  ```
2372
2416
  ### Join using `groupInviteMessage`
2373
2417
  ```ts
2374
- const response = await AlexaInc.groupAcceptInviteV4(jid, groupInviteMessage)
2418
+ const response = await suki.groupAcceptInviteV4(jid, groupInviteMessage)
2375
2419
  console.log('joined to: ' + response)
2376
2420
  ```
2377
2421
  ### Get Request Join List
2378
2422
  ```ts
2379
- const response = await AlexaInc.groupRequestParticipantsList(jid)
2423
+ const response = await suki.groupRequestParticipantsList(jid)
2380
2424
  console.log(response)
2381
2425
  ```
2382
2426
  ### Approve/Reject Request Join
2383
2427
  ```ts
2384
- const response = await AlexaInc.groupRequestParticipantsUpdate(
2428
+ const response = await suki.groupRequestParticipantsUpdate(
2385
2429
  jid, // group id
2386
2430
  ['abcd@s.whatsapp.net', 'efgh@s.whatsapp.net'],
2387
2431
  'approve' // or 'reject'
@@ -2390,7 +2434,7 @@ console.log(response)
2390
2434
  ```
2391
2435
  ### Get All Participating Groups Metadata
2392
2436
  ```ts
2393
- const response = await AlexaInc.groupFetchAllParticipating()
2437
+ const response = await suki.groupFetchAllParticipating()
2394
2438
  console.log(response)
2395
2439
  ```
2396
2440
  ### Toggle Ephemeral
@@ -2405,12 +2449,12 @@ console.log(response)
2405
2449
  | 90d | 7.776.000 |
2406
2450
 
2407
2451
  ```ts
2408
- await AlexaInc.groupToggleEphemeral(jid, 86400)
2452
+ await suki.groupToggleEphemeral(jid, 86400)
2409
2453
  ```
2410
2454
 
2411
2455
  ### Change Add Mode
2412
2456
  ```ts
2413
- await AlexaInc.groupMemberAddMode(
2457
+ await suki.groupMemberAddMode(
2414
2458
  jid,
2415
2459
  'all_member_add' // or 'admin_add'
2416
2460
  )
@@ -2420,48 +2464,48 @@ await AlexaInc.groupMemberAddMode(
2420
2464
 
2421
2465
  ### Block/Unblock User
2422
2466
  ```ts
2423
- await AlexaInc.updateBlockStatus(jid, 'block') // Block user
2424
- await AlexaInc.updateBlockStatus(jid, 'unblock') // Unblock user
2467
+ await suki.updateBlockStatus(jid, 'block') // Block user
2468
+ await suki.updateBlockStatus(jid, 'unblock') // Unblock user
2425
2469
  ```
2426
2470
  ### Get Privacy Settings
2427
2471
  ```ts
2428
- const privacySettings = await AlexaInc.fetchPrivacySettings(true)
2472
+ const privacySettings = await suki.fetchPrivacySettings(true)
2429
2473
  console.log('privacy settings: ' + privacySettings)
2430
2474
  ```
2431
2475
  ### Get BlockList
2432
2476
  ```ts
2433
- const response = await AlexaInc.fetchBlocklist()
2477
+ const response = await suki.fetchBlocklist()
2434
2478
  console.log(response)
2435
2479
  ```
2436
2480
  ### Update LastSeen Privacy
2437
2481
  ```ts
2438
2482
  const value = 'all' // 'contacts' | 'contact_blacklist' | 'none'
2439
- await AlexaInc.updateLastSeenPrivacy(value)
2483
+ await suki.updateLastSeenPrivacy(value)
2440
2484
  ```
2441
2485
  ### Update Online Privacy
2442
2486
  ```ts
2443
2487
  const value = 'all' // 'match_last_seen'
2444
- await AlexaInc.updateOnlinePrivacy(value)
2488
+ await suki.updateOnlinePrivacy(value)
2445
2489
  ```
2446
2490
  ### Update Profile Picture Privacy
2447
2491
  ```ts
2448
2492
  const value = 'all' // 'contacts' | 'contact_blacklist' | 'none'
2449
- await AlexaInc.updateProfilePicturePrivacy(value)
2493
+ await suki.updateProfilePicturePrivacy(value)
2450
2494
  ```
2451
2495
  ### Update Status Privacy
2452
2496
  ```ts
2453
2497
  const value = 'all' // 'contacts' | 'contact_blacklist' | 'none'
2454
- await AlexaInc.updateStatusPrivacy(value)
2498
+ await suki.updateStatusPrivacy(value)
2455
2499
  ```
2456
2500
  ### Update Read Receipts Privacy
2457
2501
  ```ts
2458
2502
  const value = 'all' // 'none'
2459
- await AlexaInc.updateReadReceiptsPrivacy(value)
2503
+ await suki.updateReadReceiptsPrivacy(value)
2460
2504
  ```
2461
2505
  ### Update Groups Add Privacy
2462
2506
  ```ts
2463
2507
  const value = 'all' // 'contacts' | 'contact_blacklist'
2464
- await AlexaInc.updateGroupsAddPrivacy(value)
2508
+ await suki.updateGroupsAddPrivacy(value)
2465
2509
  ```
2466
2510
  ### Update Default Disappearing Mode
2467
2511
 
@@ -2476,7 +2520,7 @@ await AlexaInc.updateGroupsAddPrivacy(value)
2476
2520
 
2477
2521
  ```ts
2478
2522
  const ephemeral = 86400
2479
- await AlexaInc.updateDefaultDisappearingMode(ephemeral)
2523
+ await suki.updateDefaultDisappearingMode(ephemeral)
2480
2524
  ```
2481
2525
 
2482
2526
  ## Broadcast Lists & Stories
@@ -2484,7 +2528,7 @@ await AlexaInc.updateDefaultDisappearingMode(ephemeral)
2484
2528
  ### Send Broadcast & Stories
2485
2529
  - Messages can be sent to broadcasts & stories. You need to add the following message options in sendMessage, like this:
2486
2530
  ```ts
2487
- await AlexaInc.sendMessage(
2531
+ await suki.sendMessage(
2488
2532
  jid,
2489
2533
  {
2490
2534
  image: {
@@ -2510,7 +2554,7 @@ await AlexaInc.sendMessage(
2510
2554
  - Broadcast IDs are in the format `12345678@broadcast`
2511
2555
  ### Query a Broadcast List's Recipients & Name
2512
2556
  ```ts
2513
- const bList = await AlexaInc.getBroadcastListInfo('1234@broadcast')
2557
+ const bList = await suki.getBroadcastListInfo('1234@broadcast')
2514
2558
  console.log (`list name: ${bList.name}, recps: ${bList.recipients}`)
2515
2559
  ```
2516
2560
 
@@ -2520,7 +2564,7 @@ Baileys is written with custom functionality in mind. Instead of forking the pro
2520
2564
  ### Enabling Debug Level in Baileys Logs
2521
2565
  First, enable the logging of unhandled messages from WhatsApp by setting:
2522
2566
  ```ts
2523
- const AlexaInc = makeWASocket({
2567
+ const suki = makeWASocket({
2524
2568
  logger: P({ level: 'debug' }),
2525
2569
  })
2526
2570
  ```
@@ -2575,13 +2619,13 @@ The `'frame'` is what the message received is, it has three components:
2575
2619
 
2576
2620
  ```ts
2577
2621
  // for any message with tag 'edge_routing'
2578
- AlexaInc.ws.on('CB:edge_routing', (node: BinaryNode) => { })
2622
+ suki.ws.on('CB:edge_routing', (node: BinaryNode) => { })
2579
2623
 
2580
2624
  // for any message with tag 'edge_routing' and id attribute = abcd
2581
- AlexaInc.ws.on('CB:edge_routing,id:abcd', (node: BinaryNode) => { })
2625
+ suki.ws.on('CB:edge_routing,id:abcd', (node: BinaryNode) => { })
2582
2626
 
2583
2627
  // for any message with tag 'edge_routing', id attribute = abcd & first content node routing_info
2584
- AlexaInc.ws.on('CB:edge_routing,id:abcd,routing_info', (node: BinaryNode) => { })
2628
+ suki.ws.on('CB:edge_routing,id:abcd,routing_info', (node: BinaryNode) => { })
2585
2629
  ```
2586
2630
 
2587
2631
  > [!NOTE]