@vanzxy/baileys 2.0.0 → 2.0.2

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.
package/NOTICE.md CHANGED
@@ -34,9 +34,8 @@ below was MIT-licensed at its source at the time it was ported.
34
34
  entry. Let me know which and I'll finalize it.
35
35
 
36
36
  ### MessageBuilder v4.7 additions (setResponseId/setBotResponseId/hasId/getIds/peek/delete)
37
- - **Source:** credited in-code only as "temen's MessageBuilderV4.7" (`temen` = Indonesian for "friend/buddy") not a resolvable handle or repo.
37
+ - **Source:** Nixel same author/watermark as the main MessageBuilder/AIRich base above ("temen's MessageBuilderV4.7" in the in-code credit refers to Nixel, confirmed by the person who introduced this codebase).
38
38
  - **Location in this package:** `lib/Utils/MessageBuilder.js` (`~line 2120, 2885, 2916`).
39
- - **⚠ Needs your input:** I can't attribute this properly without the actual author/repo name. Let me know who this refers to.
40
39
 
41
40
  ### Button/list addon-kind resolution logic
42
41
  - **Source:** vinikjkkj, [zapo](https://github.com/vinikjkkj/zapo) (MIT).
package/README.md CHANGED
@@ -57,6 +57,7 @@
57
57
  - [Poll](#poll)
58
58
  - [Carousel](#carousel)
59
59
  - [AIRich — rich response cards](#airich--rich-response-cards)
60
+ - [📁 Builders Folder Map](#-builders-folder-map-libbuilders)
60
61
  - [📞 Voice & Video Calls](#-voice--video-calls)
61
62
  - [🔎 User Sync Queries](#-user-sync-queries)
62
63
  - [👤 Username Management](#-username-management)
@@ -73,7 +74,7 @@
73
74
  - [💖 Support](#-support)
74
75
  - [👑 Maintainer](#-maintainer)
75
76
  - [⚠️ Disclaimer](#-disclaimer)
76
- - [📝 Patch Notes](#-v5-patch-notes)
77
+ - [📝 Patch Notes](#-v7-patch-notes)
77
78
 
78
79
  </details>
79
80
 
@@ -511,6 +512,45 @@ await new AIRich(sock)
511
512
 
512
513
  Other builders worth knowing about: **`ButtonV2`** (simpler quick-reply-only buttons), **`ButtonV3`** (`loadFrom(msg)` to edit an existing template message in place), and **`Toolkit`** (static helpers: `Toolkit.resize()`, `Toolkit.fetchBuffer()`, `Toolkit.waitAllPromises()`, `Toolkit.extractIE()` for parsing `[label](url)` links/citations/LaTeX out of plain text).
513
514
 
515
+ ### 📁 Builders Folder Map (`lib/Builders/`)
516
+
517
+ Every message builder lives in its own file under `lib/Builders/`, so you can trace exactly where a class comes from instead of digging through one giant `MessageBuilder.js`. `index.js` is just the barrel file that re-exports everything below (plus their aliases) for the top-level `import { ... } from '@vanzxy/baileys'` syntax.
518
+
519
+ | File | Exports | What it's for |
520
+ |---|---|---|
521
+ | `shared.js` | `Toolkit`, `BaseBuilder`, `RowBuilder` | The shared foundation every other builder is built on. `BaseBuilder` holds the common chainable `send()`/context-info plumbing, `RowBuilder` is the shared row/section helper, and `Toolkit` is the static-helper grab bag (`resize`, `fetchBuffer`, `waitAllPromises`, `extractIE`, media-duration/preview helpers). Nothing here is meant to be instantiated directly in bot code — it exists so `Button`, `Poll`, `Carousel`, etc. don't each reimplement the same plumbing. |
522
+ | `Button.js` | `Button`, `CardBuilder` | The main interactive/native-flow button builder — headers (image/video/document), CTA helpers (`addUrl`, `addCall`, `addReply`, and the wider native-flow set), and `.toCard()` to turn a button message into a `Carousel` card. |
523
+ | `ButtonV2.js` | `ButtonV2` | A lighter-weight variant limited to simple quick-reply buttons — reach for this when you don't need the full native-flow surface of `Button`. |
524
+ | `ButtonV3.js` | `ButtonV3` | Built around `loadFrom(msg)` — loads an existing `templateMessage` (e.g. one you fetched or that was quoted) so you can edit it in place instead of building one from scratch. |
525
+ | `Carousel.js` | `Carousel` | Chains `Button(...).toCard()` results into a swipeable card carousel. Capped at `Carousel.MAX_CARDS` (10) since WhatsApp silently truncates anything beyond that. |
526
+ | `Poll.js` | `Poll` | Poll/vote message builder — question, options, single/multi-select, hidden-voter mode, correct-answer marking, expiry. |
527
+ | `NativeFlow.js` | `NativeFlow` | Modern `interactiveMessage`/`nativeFlowMessage` builder — `cta_url`, `cta_copy`, `cta_call`, `quick_reply`, `single_select`, offer banners, and the "..." options bottom-sheet. The recommended replacement for `ButtonV3`'s legacy hydrated-template buttons. |
528
+ | `Location.js` | `Location` | Static location pins via the existing `location` shorthand, plus live/moving locations (built directly against `WAProto.Message.LiveLocationMessage` since there's no shorthand for that yet — call `send()` again with a higher `setSequence()` to push updates). |
529
+ | `Contact.js` | `Contact` | vCard contact-card builder — one contact sends as `contactMessage`, two or more as `contactsArrayMessage`. `addContact()` generates a minimal VCARD 3.0 block from plain fields; `addRawVcard()` accepts a pre-built vCard string. |
530
+ | `Album.js` | `Album` | Media-group/album builder — bundles 2+ images/videos. Thin wrapper: the actual cover + delayed-follow-up sending is already handled by the `content.album` shorthand in `Socket/messages-send.js`. |
531
+ | `AIRich.js` | `AIRich` (+ aliases `ORich`, `AIVanzxy`, `LeafRich`, `VanzxyAI`, `VanzxyRich`, `RichVanzxy`) | The rich AI-assistant-style response builder described above — headings, formatted text, tables, media/product/post cards, task/progress cards, tip banners, quick-reply suggestions. |
532
+ | `A2UI.js` | `A2UI`, `sendA2UIWidget` | Lower-level A2UI/Bloks widget builder. Builds the flat `components` tree (Column/Row → `children`, Card/Button → `child`, Modal → `trigger`/`content`) that Bloks widgets expect and sends it through the same `getBizBinaryNode()` path as `Button`/`ButtonV2`, so the wire-level node always matches the button names actually sent. |
533
+ | `VanzxyBaileys.js` | `VanzxyBaileys` | A unified builder **hub** — one object that wraps all the builders above behind short method names (`.button()`, `.buttonV2()`, `.buttonV3()`, `.carousel()`, `.poll()`, `.nativeFlow()`, `.location()`, `.contact()`, `.album()`, `.airich()`, `.a2ui()`), plus PascalCase aliases (`.Button()`, `.Carousel()`, `.Poll()`, `.NativeFlow()`, `.Location()`, `.Contact()`, `.Album()`, `.AIRich()`, `.A2UI()`) for developers who prefer that naming style. Nothing new is implemented here — it's purely a single entry point over the individual classes. |
534
+ | `index.js` | everything above, plus `MESSAGE_BUILDER_VERSION` | The barrel file — re-exports every builder and its aliases so `import { Button, Poll, AIRich, VanzxyBaileys } from '@vanzxy/baileys'` works without reaching into individual files. `MESSAGE_BUILDER_VERSION` tracks the builder API surface's own version, independent of the package version (currently `5.0`). |
535
+
536
+ **Unified hub example** — useful if you'd rather carry one object around than import each builder individually:
537
+
538
+ ```js
539
+ import { VanzxyBaileys } from '@vanzxy/baileys'
540
+
541
+ const vx = new VanzxyBaileys(sock)
542
+
543
+ await vx.button()
544
+ .setTitle('Promo Spesial')
545
+ .addReply('Klaim Sekarang', 'claim_promo')
546
+ .send(jid)
547
+
548
+ await vx.poll()
549
+ .setName('Mau makan apa hari ini?')
550
+ .addOptions(['Nasi Goreng', 'Mie Ayam'])
551
+ .send(jid)
552
+ ```
553
+
514
554
  ---
515
555
 
516
556
  ## 📞 Voice & Video Calls
@@ -790,6 +830,27 @@ Use responsibly and follow WhatsApp Terms of Service.
790
830
 
791
831
  ---
792
832
 
833
+ ## 📝 V7 Patch Notes
834
+
835
+ - Added four new builders to `lib/Builders/` (see the [📁 Builders Folder Map](#-builders-folder-map-libbuilders) for details), wired into both `index.js` and the `VanzxyBaileys` hub:
836
+ - `NativeFlow.js` — modern `interactiveMessage`/`nativeFlowMessage` builder (`cta_url`, `cta_copy`, `cta_call`, `quick_reply`, `single_select`), the recommended replacement for `ButtonV3`'s legacy hydrated-template buttons.
837
+ - `Location.js` — static + live location builder.
838
+ - `Contact.js` — single/multi vCard contact-card builder.
839
+ - `Album.js` — media-group/album builder (thin wrapper over the existing `content.album` shorthand).
840
+ - Fixed a version mismatch: `AIRich.js`'s internal `VERSION` constant was still `4.7` while `index.js`'s `MESSAGE_BUILDER_VERSION` had already moved to `4.8`. Both now read `5.0`.
841
+
842
+ ---
843
+
844
+ ## 📝 V6 Patch Notes
845
+
846
+ - Fixed a `package.json` typo: the version field was mistakenly left at `1.0.1` instead of `2.0.1` after the V5 release — corrected to `2.0.1` so the published package version matches the intended release.
847
+ - Expanded README documentation, especially around `lib/Builders/`:
848
+ - Added the new [📁 Builders Folder Map](#-builders-folder-map-libbuilders) section — a per-file breakdown of everything under `lib/Builders/` (`shared.js`, `Button.js`, `ButtonV2.js`, `ButtonV3.js`, `Carousel.js`, `Poll.js`, `AIRich.js`, `A2UI.js`, `VanzxyBaileys.js`, `index.js`), what each file exports, and what it's for — previously `A2UI` and `VanzxyBaileys` in particular had no usage documentation at all.
849
+ - Added a usage example for the `VanzxyBaileys` unified builder hub.
850
+ - Redesigned `postinstall-banner.js`: cleaner box layout with a divider separating the title block from a small info section (Node version + docs link), a 256-color palette instead of basic ANSI colors, and a plain-text fallback when stdout isn't a TTY or `NO_COLOR` is set (CI logs, piped output) instead of forcing a box that may render misaligned.
851
+
852
+ ---
853
+
793
854
  ## 📝 V5 Patch Notes
794
855
 
795
856
  - Added [Username Management](#-username-management): `checkUsername`, `checkUsernameMulti`, `setUsername`, `deleteUsername`, `getMyUsername`, `setUsernamePin`, `findUserByUsername`, `fetchContactUsernames`, `getUsernameRecommendations` — ported from `@queenanya/baileys`, layered onto this fork's existing `USyncUsernameProtocol` support.
@@ -798,7 +859,7 @@ Use responsibly and follow WhatsApp Terms of Service.
798
859
  - `MediaManager`'s sticker/voice-note conversion now reuses this fork's existing lazy `fluent-ffmpeg` loader (see `Utils/MessageBuilder.js`) instead of adding `ffmpeg-static` + a second ffmpeg dependency; `node-webpmux` (sticker EXIF metadata) is lazy-loaded the same way and only when packname/author is actually requested.
799
860
  - `Bot`'s default logger now falls back to this fork's own pino instance instead of a silent no-op stub.
800
861
  - No `.d.ts` files were written for the new Framework module yet — see the note in that section.
801
- - Bumped to `1.0.0`.
862
+ - Bumped to `1.0.1`.
802
863
 
803
864
  ---
804
865
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * lib/Utils/A2UI.js — A2UI (Bloks) widget builder + sender
2
+ * lib/Builders/A2UI.js — A2UI (Bloks) widget builder + sender
3
3
  *
4
4
  * Part of @vanzxy/baileys. Builds the flat `components` array A2UI/Bloks
5
5
  * expects (id-referencing tree: Column/Row hold `children`, Card/Button hold
@@ -16,7 +16,7 @@
16
16
  "use strict";
17
17
 
18
18
  import crypto from "crypto";
19
- import { generateWAMessageFromContent, prepareWAMessageMedia } from "./messages.js";
19
+ import { generateWAMessageFromContent, prepareWAMessageMedia } from "../Utils/messages.js";
20
20
  import { getBizBinaryNode } from "../WABinary/index.js";
21
21
 
22
22
  class A2UI {