@poucode/baileys 1.0.1 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/README.md +21 -2
  2. package/lib/Socket/chats.js +5 -0
  3. package/lib/Socket/graphql.js +716 -0
  4. package/lib/Socket/index.js +10 -2
  5. package/lib/Socket/interop.js +463 -0
  6. package/lib/Socket/luxu.js +1 -1
  7. package/lib/Socket/message-builder.js +475 -0
  8. package/lib/Socket/messages-send.js +29 -4
  9. package/lib/Socket/privacy.js +318 -0
  10. package/lib/Store/make-in-memory-store.js +47 -1
  11. package/lib/Utils/index.js +1 -0
  12. package/lib/Utils/long-safe.js +33 -0
  13. package/lib/Utils/messages-media.js +82 -0
  14. package/lib/Utils/messages.js +137 -3
  15. package/lib/Utils/sticker.js +133 -0
  16. package/lib/Utils/use-sqlite-auth-state.js +162 -0
  17. package/lib/WAUSync/Protocols/USyncBusinessProtocol.js +43 -0
  18. package/lib/WAUSync/Protocols/USyncContactProtocol.js +53 -50
  19. package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +56 -52
  20. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +29 -25
  21. package/lib/WAUSync/Protocols/USyncFeatureProtocol.js +58 -0
  22. package/lib/WAUSync/Protocols/USyncPictureProtocol.js +32 -0
  23. package/lib/WAUSync/Protocols/USyncSidelistProtocol.js +28 -0
  24. package/lib/WAUSync/Protocols/USyncStatusProtocol.js +38 -36
  25. package/lib/WAUSync/Protocols/USyncTextStatusProtocol.js +38 -0
  26. package/lib/WAUSync/Protocols/USyncUsernameProtocol.js +26 -23
  27. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +52 -49
  28. package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +29 -27
  29. package/lib/WAUSync/Protocols/index.js +12 -5
  30. package/lib/WAUSync/USyncQuery.js +150 -96
  31. package/lib/WAUSync/USyncUser.js +55 -29
  32. package/lib/WAUSync/index.js +3 -3
  33. package/lib/index.js +1 -0
  34. package/package.json +12 -7
package/README.md CHANGED
@@ -36,7 +36,7 @@ npm install github:pou-code/Baileys
36
36
  Or add it to your `package.json` manually:
37
37
  ```json
38
38
  "dependencies": {
39
- "@poucode/baileys": "github:pou-code/Baileys"
39
+ "@poucode/baileys": "latest"
40
40
  }
41
41
  ```
42
42
 
@@ -45,7 +45,7 @@ Already have a bot built on the original `@whiskeysockets/baileys` and don't wan
45
45
  name points to this fork:
46
46
  ```json
47
47
  "dependencies": {
48
- "@whiskeysockets/baileys": "github:pou-code/Baileys"
48
+ "@whiskeysockets/baileys": "npm:poucode/baileys"
49
49
  }
50
50
  ```
51
51
  With this alias, keep using `require('@whiskeysockets/baileys')` in your code as-is — npm will
@@ -418,6 +418,25 @@ await client.statusMention(m.chat, {
418
418
 
419
419
  ---
420
420
 
421
+ # Merged Features (1.1.0)
422
+
423
+ WaBail 1.1.0 merges the extra layers of the `wbails` fork on top of the PouCode core:
424
+
425
+ - `sock.*` privacy, interop, GraphQL/Wamo and message-builder layers (see `lib/Socket/privacy.js`, `interop.js`, `graphql.js`, `message-builder.js`)
426
+ - Extra USync protocols: business, picture, text status, sidelist, feature (`lib/WAUSync/`)
427
+ - Sticker pack messages (`{ stickerPacks: {...} }`) and sticker metadata helpers (`lib/Utils/sticker.js`, needs `ffmpeg` in `PATH` for sticker conversion)
428
+ - `useSqliteAuthState` (needs Node 22.5+ because it uses `node:sqlite`; loaded lazily, so Node 20 is unaffected unless you call it)
429
+ - `makeInMemoryStore` persistence helpers: `writeToFile`, `readFromFile`, `writeToFileInterval`
430
+ - 1:1 `cstoken` fallback: stores the NCT salt from app-state sync and attaches `cstoken` on private sends that have no `tctoken`. Disable per message with `{ cstoken: false }`.
431
+
432
+ The newsletter implementation is the one from WaBail (`lib/Socket/newsletter.js`) and is used unchanged.
433
+
434
+ ## Private chat vs group notes
435
+
436
+ - Reply to `msg.key.remoteJid` as-is. In private chats it can be `@lid`; the phone-number form is in `msg.key.remoteJidAlt`.
437
+ - In groups the sender is `msg.key.participant` (alt in `msg.key.participantAlt`).
438
+ - If a send to a user cannot resolve any of the recipient's devices, `relayMessage` now throws `421` instead of silently reporting success.
439
+
421
440
  # Credits
422
441
 
423
442
  PouCode is a fork of [Baileys](https://github.com/WhiskeySockets/Baileys), originally created by
@@ -397,6 +397,11 @@ export const makeChatsSocket = (config) => {
397
397
  return {
398
398
  onMutation(mutation) {
399
399
  processSyncAction(mutation, ev, authState.creds.me, isInitialSync ? { accountSettings: authState.creds.accountSettings } : undefined, logger);
400
+ const nctSalt = mutation?.syncAction?.value?.nctSaltSyncAction?.salt;
401
+ if (nctSalt?.length) {
402
+ authState.keys.set({ 'nct-salt': { default: Buffer.from(nctSalt) } })
403
+ .catch(err => logger?.debug({ err: err?.message }, 'failed to store nct salt'));
404
+ }
400
405
  }
401
406
  };
402
407
  };