@vanzxy/baileys 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 (281) hide show
  1. package/NOTICE.md +111 -0
  2. package/README.md +830 -0
  3. package/WAProto/index.d.ts +9 -0
  4. package/WAProto/index.js +142036 -0
  5. package/engine-requirements.js +13 -0
  6. package/lib/Defaults/index.d.ts +152 -0
  7. package/lib/Defaults/index.js +179 -0
  8. package/lib/Framework/Bot.js +209 -0
  9. package/lib/Framework/Context.js +90 -0
  10. package/lib/Framework/MediaManager.js +152 -0
  11. package/lib/Framework/SessionManager.js +34 -0
  12. package/lib/Framework/StatsManager.js +120 -0
  13. package/lib/Framework/Store/SQLiteStore.js +74 -0
  14. package/lib/Framework/index.js +11 -0
  15. package/lib/Signal/Group/ciphertext-message.d.ts +9 -0
  16. package/lib/Signal/Group/ciphertext-message.js +12 -0
  17. package/lib/Signal/Group/group-session-builder.d.ts +7 -0
  18. package/lib/Signal/Group/group-session-builder.js +30 -0
  19. package/lib/Signal/Group/group_cipher.d.ts +10 -0
  20. package/lib/Signal/Group/group_cipher.js +82 -0
  21. package/lib/Signal/Group/index.d.ts +11 -0
  22. package/lib/Signal/Group/index.js +12 -0
  23. package/lib/Signal/Group/keyhelper.d.ts +6 -0
  24. package/lib/Signal/Group/keyhelper.js +18 -0
  25. package/lib/Signal/Group/sender-chain-key.d.ts +13 -0
  26. package/lib/Signal/Group/sender-chain-key.js +26 -0
  27. package/lib/Signal/Group/sender-key-distribution-message.d.ts +16 -0
  28. package/lib/Signal/Group/sender-key-distribution-message.js +63 -0
  29. package/lib/Signal/Group/sender-key-message.d.ts +18 -0
  30. package/lib/Signal/Group/sender-key-message.js +66 -0
  31. package/lib/Signal/Group/sender-key-name.d.ts +11 -0
  32. package/lib/Signal/Group/sender-key-name.js +48 -0
  33. package/lib/Signal/Group/sender-key-record.d.ts +12 -0
  34. package/lib/Signal/Group/sender-key-record.js +41 -0
  35. package/lib/Signal/Group/sender-key-state.d.ts +16 -0
  36. package/lib/Signal/Group/sender-key-state.js +84 -0
  37. package/lib/Signal/Group/sender-message-key.d.ts +11 -0
  38. package/lib/Signal/Group/sender-message-key.js +26 -0
  39. package/lib/Signal/libsignal.d.ts +54 -0
  40. package/lib/Signal/libsignal.js +431 -0
  41. package/lib/Signal/lid-mapping.d.ts +20 -0
  42. package/lib/Signal/lid-mapping.js +277 -0
  43. package/lib/Socket/Client/index.d.ts +2 -0
  44. package/lib/Socket/Client/index.js +3 -0
  45. package/lib/Socket/Client/types.d.ts +5 -0
  46. package/lib/Socket/Client/types.js +11 -0
  47. package/lib/Socket/Client/websocket.d.ts +12 -0
  48. package/lib/Socket/Client/websocket.js +54 -0
  49. package/lib/Socket/business.d.ts +395 -0
  50. package/lib/Socket/business.js +380 -0
  51. package/lib/Socket/chats.d.ts +136 -0
  52. package/lib/Socket/chats.js +1328 -0
  53. package/lib/Socket/communities.d.ts +561 -0
  54. package/lib/Socket/communities.js +434 -0
  55. package/lib/Socket/dugong.d.ts +117 -0
  56. package/lib/Socket/dugong.js +799 -0
  57. package/lib/Socket/groups.d.ts +285 -0
  58. package/lib/Socket/groups.js +355 -0
  59. package/lib/Socket/index.d.ts +531 -0
  60. package/lib/Socket/index.js +34 -0
  61. package/lib/Socket/messages-recv.d.ts +333 -0
  62. package/lib/Socket/messages-recv.js +1782 -0
  63. package/lib/Socket/messages-send.d.ts +329 -0
  64. package/lib/Socket/messages-send.js +1383 -0
  65. package/lib/Socket/mex.d.ts +1 -0
  66. package/lib/Socket/mex.js +42 -0
  67. package/lib/Socket/newsletter.d.ts +281 -0
  68. package/lib/Socket/newsletter.js +321 -0
  69. package/lib/Socket/socket.d.ts +60 -0
  70. package/lib/Socket/socket.js +1001 -0
  71. package/lib/Socket/username.js +153 -0
  72. package/lib/Store/index.d.ts +3 -0
  73. package/lib/Store/index.js +4 -0
  74. package/lib/Store/make-in-memory-store.d.ts +62 -0
  75. package/lib/Store/make-in-memory-store.js +429 -0
  76. package/lib/Store/make-ordered-dictionary.d.ts +12 -0
  77. package/lib/Store/make-ordered-dictionary.js +79 -0
  78. package/lib/Store/object-repository.d.ts +10 -0
  79. package/lib/Store/object-repository.js +24 -0
  80. package/lib/Types/Auth.d.ts +117 -0
  81. package/lib/Types/Auth.js +2 -0
  82. package/lib/Types/Bussines.d.ts +25 -0
  83. package/lib/Types/Bussines.js +2 -0
  84. package/lib/Types/Call.d.ts +15 -0
  85. package/lib/Types/Call.js +2 -0
  86. package/lib/Types/Chat.d.ts +124 -0
  87. package/lib/Types/Chat.js +8 -0
  88. package/lib/Types/Contact.d.ts +26 -0
  89. package/lib/Types/Contact.js +2 -0
  90. package/lib/Types/Events.d.ts +256 -0
  91. package/lib/Types/Events.js +2 -0
  92. package/lib/Types/GroupMetadata.d.ts +71 -0
  93. package/lib/Types/GroupMetadata.js +2 -0
  94. package/lib/Types/Label.d.ts +2 -0
  95. package/lib/Types/Label.js +25 -0
  96. package/lib/Types/LabelAssociation.d.ts +2 -0
  97. package/lib/Types/LabelAssociation.js +7 -0
  98. package/lib/Types/Message.d.ts +11 -0
  99. package/lib/Types/Message.js +18 -0
  100. package/lib/Types/Mex.d.ts +2 -0
  101. package/lib/Types/Mex.js +39 -0
  102. package/lib/Types/Product.d.ts +79 -0
  103. package/lib/Types/Product.js +2 -0
  104. package/lib/Types/RichType.d.ts +2 -0
  105. package/lib/Types/RichType.js +23 -0
  106. package/lib/Types/Signal.d.ts +87 -0
  107. package/lib/Types/Signal.js +2 -0
  108. package/lib/Types/Socket.d.ts +136 -0
  109. package/lib/Types/Socket.js +2 -0
  110. package/lib/Types/State.d.ts +5 -0
  111. package/lib/Types/State.js +56 -0
  112. package/lib/Types/USync.d.ts +26 -0
  113. package/lib/Types/USync.js +2 -0
  114. package/lib/Types/index.d.ts +66 -0
  115. package/lib/Types/index.js +26 -0
  116. package/lib/Utils/A2UI.js +277 -0
  117. package/lib/Utils/MessageBuilder.js +4405 -0
  118. package/lib/Utils/MessageBuilder_d.ts +411 -0
  119. package/lib/Utils/PersistentStore.js +592 -0
  120. package/lib/Utils/PersistentStore_d.ts +60 -0
  121. package/lib/Utils/anti-delete.d.ts +74 -0
  122. package/lib/Utils/anti-delete.js +222 -0
  123. package/lib/Utils/auth-utils.d.ts +57 -0
  124. package/lib/Utils/auth-utils.js +307 -0
  125. package/lib/Utils/auto-reply.d.ts +47 -0
  126. package/lib/Utils/auto-reply.js +158 -0
  127. package/lib/Utils/baileys-event-stream.d.ts +8 -0
  128. package/lib/Utils/baileys-event-stream.js +62 -0
  129. package/lib/Utils/browser-utils.d.ts +8 -0
  130. package/lib/Utils/browser-utils.js +28 -0
  131. package/lib/Utils/business.d.ts +49 -0
  132. package/lib/Utils/business.js +240 -0
  133. package/lib/Utils/button-helper-utils.js +314 -0
  134. package/lib/Utils/button-sender.js +824 -0
  135. package/lib/Utils/chat-control.d.ts +159 -0
  136. package/lib/Utils/chat-control.js +232 -0
  137. package/lib/Utils/chat-history-helpers.d.ts +21 -0
  138. package/lib/Utils/chat-history-helpers.js +71 -0
  139. package/lib/Utils/chat-utils.d.ts +407 -0
  140. package/lib/Utils/chat-utils.js +886 -0
  141. package/lib/Utils/companion-reg-client-utils.d.ts +4 -0
  142. package/lib/Utils/companion-reg-client-utils.js +40 -0
  143. package/lib/Utils/crypto.d.ts +41 -0
  144. package/lib/Utils/crypto.js +148 -0
  145. package/lib/Utils/decode-wa-message.d.ts +83 -0
  146. package/lib/Utils/decode-wa-message.js +317 -0
  147. package/lib/Utils/event-buffer.d.ts +12 -0
  148. package/lib/Utils/event-buffer.js +636 -0
  149. package/lib/Utils/generics.d.ts +69 -0
  150. package/lib/Utils/generics.js +439 -0
  151. package/lib/Utils/history.d.ts +90 -0
  152. package/lib/Utils/history.js +147 -0
  153. package/lib/Utils/identity-change-handler.d.ts +13 -0
  154. package/lib/Utils/identity-change-handler.js +50 -0
  155. package/lib/Utils/index.d.ts +39 -0
  156. package/lib/Utils/index.js +46 -0
  157. package/lib/Utils/link-preview.d.ts +12 -0
  158. package/lib/Utils/link-preview.js +85 -0
  159. package/lib/Utils/logger.d.ts +2 -0
  160. package/lib/Utils/logger.js +3 -0
  161. package/lib/Utils/lt-hash.d.ts +12 -0
  162. package/lib/Utils/lt-hash.js +27 -0
  163. package/lib/Utils/make-mutex.d.ts +6 -0
  164. package/lib/Utils/make-mutex.js +33 -0
  165. package/lib/Utils/media-messages.d.ts +18 -0
  166. package/lib/Utils/media-messages.js +71 -0
  167. package/lib/Utils/media-set.d.ts +13 -0
  168. package/lib/Utils/media-set.js +172 -0
  169. package/lib/Utils/message-kind.js +139 -0
  170. package/lib/Utils/message-retry-manager.d.ts +79 -0
  171. package/lib/Utils/message-retry-manager.js +265 -0
  172. package/lib/Utils/message-search.d.ts +44 -0
  173. package/lib/Utils/message-search.js +189 -0
  174. package/lib/Utils/messages-media.d.ts +135 -0
  175. package/lib/Utils/messages-media.js +869 -0
  176. package/lib/Utils/messages.d.ts +44 -0
  177. package/lib/Utils/messages.js +2155 -0
  178. package/lib/Utils/noise-handler.d.ts +20 -0
  179. package/lib/Utils/noise-handler.js +201 -0
  180. package/lib/Utils/offline-node-processor.d.ts +9 -0
  181. package/lib/Utils/offline-node-processor.js +40 -0
  182. package/lib/Utils/past-participants.d.ts +14 -0
  183. package/lib/Utils/past-participants.js +40 -0
  184. package/lib/Utils/pre-key-manager.d.ts +25 -0
  185. package/lib/Utils/pre-key-manager.js +106 -0
  186. package/lib/Utils/process-message.d.ts +82 -0
  187. package/lib/Utils/process-message.js +809 -0
  188. package/lib/Utils/reporting-utils.d.ts +12 -0
  189. package/lib/Utils/reporting-utils.js +258 -0
  190. package/lib/Utils/rich-message-utils.d.ts +48 -0
  191. package/lib/Utils/rich-message-utils.js +445 -0
  192. package/lib/Utils/scheduling.d.ts +42 -0
  193. package/lib/Utils/scheduling.js +140 -0
  194. package/lib/Utils/signal.d.ts +82 -0
  195. package/lib/Utils/signal.js +201 -0
  196. package/lib/Utils/stanza-ack.d.ts +16 -0
  197. package/lib/Utils/stanza-ack.js +38 -0
  198. package/lib/Utils/status.d.ts +50 -0
  199. package/lib/Utils/status.js +108 -0
  200. package/lib/Utils/stickerpack.d.ts +51 -0
  201. package/lib/Utils/stickerpack.js +275 -0
  202. package/lib/Utils/sync-action-utils.d.ts +2 -0
  203. package/lib/Utils/sync-action-utils.js +49 -0
  204. package/lib/Utils/tc-token-utils.d.ts +29 -0
  205. package/lib/Utils/tc-token-utils.js +163 -0
  206. package/lib/Utils/templates.d.ts +76 -0
  207. package/lib/Utils/templates.js +151 -0
  208. package/lib/Utils/use-cache-manager-auth-state.d.ts +13 -0
  209. package/lib/Utils/use-cache-manager-auth-state.js +82 -0
  210. package/lib/Utils/use-multi-file-auth-state.d.ts +10 -0
  211. package/lib/Utils/use-multi-file-auth-state.js +167 -0
  212. package/lib/Utils/use-single-file-auth-state.d.ts +10 -0
  213. package/lib/Utils/use-single-file-auth-state.js +114 -0
  214. package/lib/Utils/use-sqlite-auth-state.d.ts +11 -0
  215. package/lib/Utils/use-sqlite-auth-state.js +170 -0
  216. package/lib/Utils/validate-connection.d.ts +42 -0
  217. package/lib/Utils/validate-connection.js +199 -0
  218. package/lib/Utils/vcard.d.ts +58 -0
  219. package/lib/Utils/vcard.js +105 -0
  220. package/lib/VoIP/audio-feeder.d.ts +15 -0
  221. package/lib/VoIP/audio-feeder.js +132 -0
  222. package/lib/VoIP/index.js +277 -0
  223. package/lib/VoIP/relay-transport.d.ts +43 -0
  224. package/lib/VoIP/relay-transport.js +559 -0
  225. package/lib/VoIP/signaling.js +624 -0
  226. package/lib/VoIP/types.d.ts +69 -0
  227. package/lib/VoIP/types.js +17 -0
  228. package/lib/VoIP/wasm-engine.d.ts +103 -0
  229. package/lib/VoIP/wasm-engine.js +1214 -0
  230. package/lib/VoIP/worker-bootstrap.js +1042 -0
  231. package/lib/WABinary/constants.d.ts +61 -0
  232. package/lib/WABinary/constants.js +1467 -0
  233. package/lib/WABinary/decode.d.ts +9 -0
  234. package/lib/WABinary/decode.js +262 -0
  235. package/lib/WABinary/encode.d.ts +2 -0
  236. package/lib/WABinary/encode.js +220 -0
  237. package/lib/WABinary/generic-utils.d.ts +74 -0
  238. package/lib/WABinary/generic-utils.js +277 -0
  239. package/lib/WABinary/index.d.ts +5 -0
  240. package/lib/WABinary/index.js +6 -0
  241. package/lib/WABinary/jid-utils.d.ts +28 -0
  242. package/lib/WABinary/jid-utils.js +96 -0
  243. package/lib/WABinary/types.d.ts +19 -0
  244. package/lib/WABinary/types.js +2 -0
  245. package/lib/WAM/BinaryInfo.d.ts +7 -0
  246. package/lib/WAM/BinaryInfo.js +10 -0
  247. package/lib/WAM/constants.d.ts +34926 -0
  248. package/lib/WAM/constants.js +22853 -0
  249. package/lib/WAM/encode.d.ts +1 -0
  250. package/lib/WAM/encode.js +150 -0
  251. package/lib/WAM/index.d.ts +3 -0
  252. package/lib/WAM/index.js +4 -0
  253. package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +36 -0
  254. package/lib/WAUSync/Protocols/USyncContactProtocol.js +52 -0
  255. package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +29 -0
  256. package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +63 -0
  257. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +12 -0
  258. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +27 -0
  259. package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +12 -0
  260. package/lib/WAUSync/Protocols/USyncStatusProtocol.js +38 -0
  261. package/lib/WAUSync/Protocols/USyncUsernameProtocol.d.ts +9 -0
  262. package/lib/WAUSync/Protocols/USyncUsernameProtocol.js +25 -0
  263. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +38 -0
  264. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +51 -0
  265. package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +14 -0
  266. package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +29 -0
  267. package/lib/WAUSync/Protocols/index.d.ts +7 -0
  268. package/lib/WAUSync/Protocols/index.js +8 -0
  269. package/lib/WAUSync/USyncQuery.d.ts +20 -0
  270. package/lib/WAUSync/USyncQuery.js +122 -0
  271. package/lib/WAUSync/USyncUser.d.ts +16 -0
  272. package/lib/WAUSync/USyncUser.js +31 -0
  273. package/lib/WAUSync/index.d.ts +3 -0
  274. package/lib/WAUSync/index.js +4 -0
  275. package/lib/assets/wasm/loader.js +5 -0
  276. package/lib/assets/wasm/whatsapp.wasm +0 -0
  277. package/lib/assets/wasm/worker-modules.js +273 -0
  278. package/lib/index.d.ts +12 -0
  279. package/lib/index.js +20 -0
  280. package/package.json +175 -0
  281. package/postinstall-banner.js +56 -0
package/README.md ADDED
@@ -0,0 +1,830 @@
1
+ <div align="center" id="top">
2
+
3
+ <img src="https://files.catbox.moe/l72xji.svg" width="100%" alt="Sakura night banner"/>
4
+
5
+ <p>
6
+ <img src="https://readme-typing-svg.demolab.com?font=Fira+Code&size=18&pause=1200&color=2ECC71&center=true&vCenter=true&width=650&lines=Extended+interactive+messages+%26+native+flow;Status+tools+%2B+quality-of-life+fixes;Built+on+top+of+WhiskeySockets%2FBaileys" alt="Typing SVG" />
7
+ </p>
8
+
9
+ <p>
10
+ <a href="https://www.npmjs.com/package/@vanzxy/baileys" target="_blank"><img src="https://img.shields.io/npm/v/@vanzxy/baileys?color=2ecc71&label=npm&style=for-the-badge" alt="npm version"/></a>
11
+ <a href="https://www.npmjs.com/package/@vanzxy/baileys" target="_blank"><img src="https://img.shields.io/npm/dt/@vanzxy/baileys?color=3498db&style=for-the-badge" alt="npm downloads"/></a>
12
+ <a href="https://github.com/vanzxysenpai/vanzxybaileys/stargazers" target="_blank"><img src="https://img.shields.io/github/stars/vanzxysenpai/vanzxybaileys?color=f1c40f&style=for-the-badge" alt="GitHub stars"/></a>
13
+ <a href="https://github.com/vanzxysenpai/vanzxybaileys/issues" target="_blank"><img src="https://img.shields.io/github/issues/vanzxysenpai/vanzxybaileys?color=e74c3c&style=for-the-badge" alt="GitHub issues"/></a>
14
+ </p>
15
+ <p>
16
+ <img src="https://img.shields.io/github/last-commit/vanzxysenpai/vanzxybaileys?color=9b59b6&style=flat-square" alt="Last commit"/>
17
+ <img src="https://img.shields.io/github/commit-activity/m/vanzxysenpai/vanzxybaileys?color=1abc9c&style=flat-square" alt="Commit activity"/>
18
+ <img src="https://img.shields.io/github/languages/code-size/vanzxysenpai/vanzxybaileys?color=e67e22&style=flat-square" alt="Code size"/>
19
+ <img src="https://img.shields.io/badge/node-%3E%3D20-brightgreen?style=flat-square" alt="Node >=20"/>
20
+ <img src="https://img.shields.io/badge/module-ESM-blue?style=flat-square" alt="ESM"/>
21
+ <img src="https://img.shields.io/badge/types-included-blue?style=flat-square" alt="TypeScript types included"/>
22
+ <img src="https://img.shields.io/badge/license-see%20NOTICE-lightgrey?style=flat-square" alt="License"/>
23
+ </p>
24
+
25
+ <p>
26
+ <img src="https://komarev.com/ghpvc/?username=vanzxysenpai&repo=vanzxybaileys&color=2ecc71&style=for-the-badge&label=Repo+Views" alt="Visitor count"/>
27
+ </p>
28
+
29
+ <p>
30
+ <a href="#-why-vanzxybaileys">About</a> &#xa0;|&#xa0;
31
+ <a href="#-comparison">Comparison</a> &#xa0;|&#xa0;
32
+ <a href="#-features">Features</a> &#xa0;|&#xa0;
33
+ <a href="#-installation">Installation</a> &#xa0;|&#xa0;
34
+ <a href="#-quick-start">Quick Start</a> &#xa0;|&#xa0;
35
+ <a href="#-usage-examples">Examples</a> &#xa0;|&#xa0;
36
+ <a href="#-faq--troubleshooting">FAQ</a> &#xa0;|&#xa0;
37
+ <a href="#-contributing">Contributing</a> &#xa0;|&#xa0;
38
+ <a href="#-credits">Credits</a> &#xa0;|&#xa0;
39
+ <a href="#-maintainer">Maintainer</a>
40
+ </p>
41
+
42
+ <details>
43
+ <summary>📖 Full table of contents</summary>
44
+ <br/>
45
+
46
+ - [🍃 Why @vanzxy/baileys](#-why-vanzxybaileys)
47
+ - [🆚 Comparison](#-comparison)
48
+ - [🧰 Built With](#-built-with)
49
+ - [🔥 Features](#-features)
50
+ - [✨ Exclusive Vanzxy Enhancements](#-exclusive-vanzxy-enhancements)
51
+ - [📦 Installation](#-installation)
52
+ - [🚀 Quick Start](#-quick-start)
53
+ - [🔐 Authentication](#-authentication)
54
+ - [🗄️ Store Backends](#-store-backends)
55
+ - [💡 Usage Examples](#-usage-examples)
56
+ - [Buttons & Native Flow](#buttons--native-flow)
57
+ - [Poll](#poll)
58
+ - [Carousel](#carousel)
59
+ - [AIRich — rich response cards](#airich--rich-response-cards)
60
+ - [📞 Voice & Video Calls](#-voice--video-calls)
61
+ - [🔎 User Sync Queries](#-user-sync-queries)
62
+ - [👤 Username Management](#-username-management)
63
+ - [🤖 Bot Framework](#-bot-framework)
64
+ - [🧩 Utility Modules](#-utility-modules)
65
+ - [🛎️ System Notification Filter](#-system-notification-filter)
66
+ - [🛠 Recommended Environment](#-recommended-environment)
67
+ - [📘 TypeScript Support](#-typescript-support)
68
+ - [📚 Fork Lineage](#-fork-lineage)
69
+ - [❓ FAQ & Troubleshooting](#-faq--troubleshooting)
70
+ - [🤝 Contributing](#-contributing)
71
+ - [🙏 Credits](#-credits)
72
+ - [📈 Repo Activity](#-repo-activity)
73
+ - [💖 Support](#-support)
74
+ - [👑 Maintainer](#-maintainer)
75
+ - [⚠️ Disclaimer](#-disclaimer)
76
+ - [📝 Patch Notes](#-v5-patch-notes)
77
+
78
+ </details>
79
+
80
+ </div>
81
+
82
+ ---
83
+
84
+ <div align="center">
85
+ <img src="https://files.catbox.moe/o2zpaq.png" width="100%" alt="Vanzxy banner art"/>
86
+ </div>
87
+
88
+ ---
89
+
90
+ ## 🍃 Why @vanzxy/baileys?
91
+
92
+ This fork focuses on:
93
+
94
+ | | |
95
+ |---|---|
96
+ | 🚀 | Better developer experience |
97
+ | 🎯 | Extended native flow support |
98
+ | 📢 | Advanced status & broadcast features |
99
+ | 🧩 | More interactive message types |
100
+ | ⚡ | Cleaner implementation for bot developers |
101
+ | 🔧 | Extra utilities not available in standard Baileys forks |
102
+ | 🗄️ | Multiple auth & store backends out of the box (file, SQLite, MongoDB, MySQL, PostgreSQL, Redis) |
103
+ | 📞 | Experimental voice-call (VoIP) support |
104
+
105
+ ---
106
+
107
+ ## 🆚 Comparison
108
+
109
+ How `@vanzxy/baileys` stacks up against its own lineage and the wider Baileys fork ecosystem:
110
+
111
+ | Capability | `@vanzxy/baileys` | `@itsliaaa/baileys` | `WhiskeySockets/Baileys` |
112
+ |---|:---:|:---:|:---:|
113
+ | Native Flow buttons (V1/V2/V3) | ✅ | ✅ | ⚠️ basic only |
114
+ | Carousel messages | ✅ | ❌ | ❌ |
115
+ | Rich response cards (AIRich) | ✅ | ❌ | ❌ |
116
+ | Commerce flow (catalog/order/payment) | ✅ | ⚠️ partial | ❌ |
117
+ | Voice calling (VoIP) | ✅ experimental | ❌ | ❌ |
118
+ | Multi-backend store (SQL/Mongo/Redis) | ✅ | ⚠️ file/SQLite only | ⚠️ in-memory only |
119
+ | Full `.d.ts` TypeScript definitions | ✅ | ⚠️ partial | ⚠️ partial |
120
+ | User sync queries (WAUSync) | ✅ | ✅ | ✅ |
121
+ | Username management (check/set/pin/recommend) | ✅ | ❌ | ❌ |
122
+ | Bot framework (middleware, session, stats) | ✅ | ❌ | ❌ |
123
+
124
+ > Tabel ini menggambarkan fitur di level package, bukan benchmark performa. PR untuk memperbarui/mengoreksi tabel ini dipersilakan lewat [Contributing](#-contributing).
125
+
126
+ ---
127
+
128
+ ## 🧰 Built With
129
+
130
+ <p>
131
+ <img src="https://img.shields.io/badge/node.js-%2343853D.svg?style=for-the-badge&logo=node.js&logoColor=white" alt="Node.js"/>
132
+ <img src="https://img.shields.io/badge/javascript-%23323330.svg?style=for-the-badge&logo=javascript&logoColor=%23F7DF1E" alt="JavaScript"/>
133
+ <img src="https://img.shields.io/badge/esm-%23F7DF1E.svg?style=for-the-badge&logo=javascript&logoColor=black" alt="ESM"/>
134
+ <img src="https://img.shields.io/badge/websocket-%23000000.svg?style=for-the-badge&logo=socket.io&logoColor=white" alt="WebSocket"/>
135
+ <img src="https://img.shields.io/badge/signal%20protocol-%233A76F0.svg?style=for-the-badge&logo=signal&logoColor=white" alt="Signal Protocol"/>
136
+ <img src="https://img.shields.io/badge/protobuf-%23345?style=for-the-badge&logo=google&logoColor=white" alt="Protobuf"/>
137
+ <img src="https://img.shields.io/badge/npm-%23CB3837.svg?style=for-the-badge&logo=npm&logoColor=white" alt="npm"/>
138
+ </p>
139
+
140
+ <p>
141
+ <a href="https://skillicons.dev">
142
+ <img src="https://skillicons.dev/icons?i=nodejs,js,ts,npm,docker,redis,mongodb,mysql,postgresql,sqlite" alt="Tech stack icons"/>
143
+ </a>
144
+ </p>
145
+
146
+ ---
147
+
148
+ ## 🔥 Features
149
+
150
+ <table>
151
+ <tr>
152
+ <th align="center">💬 Interactive Messages</th>
153
+ <th align="center">🛒 Commerce & Business</th>
154
+ <th align="center">🧩 Utility Features</th>
155
+ </tr>
156
+ <tr>
157
+ <td valign="top">
158
+
159
+ - Native Flow
160
+ - Buttons (V1 / V2 / V3)
161
+ - Lists
162
+ - Carousel Messages
163
+ - Poll & Quiz Messages
164
+ - Rich Response Messages (AIRich)
165
+ - CTA / Reply / URL Buttons
166
+ - Call Buttons
167
+ - OTP Buttons
168
+ - Authentication Buttons
169
+
170
+ </td>
171
+ <td valign="top">
172
+
173
+ - Catalog Message
174
+ - Order Details
175
+ - Order Status
176
+ - Review & Pay
177
+ - Payment Status
178
+ - Payment Method
179
+ - Track Order
180
+ - Reorder
181
+ - Cancel Order
182
+
183
+ </td>
184
+ <td valign="top">
185
+
186
+ - Group Status Support
187
+ - Mention All
188
+ - Lottie Sticker Support
189
+ - Newsletter Support
190
+ - ExternalAdReply Helper
191
+ - View Once Support
192
+ - Rich Formatting
193
+ - Code Highlighting
194
+
195
+ </td>
196
+ </tr>
197
+ </table>
198
+
199
+ <table>
200
+ <tr>
201
+ <th align="center">🔐 Auth & Storage</th>
202
+ <th align="center">📞 Realtime</th>
203
+ <th align="center">🛠 Developer Tooling</th>
204
+ </tr>
205
+ <tr>
206
+ <td valign="top">
207
+
208
+ - Multi-file auth state
209
+ - Single-file auth state
210
+ - SQLite auth state
211
+ - Cache-manager auth state
212
+ - In-memory store
213
+ - SQLite / MongoDB / MySQL /
214
+ PostgreSQL / Redis store adapters
215
+
216
+ </td>
217
+ <td valign="top">
218
+
219
+ - Voice calling (VoIP, WASM engine)
220
+ - User sync queries (WAUSync)
221
+ - Presence / status / device lookup
222
+ - Event buffer for high-volume bots
223
+
224
+ </td>
225
+ <td valign="top">
226
+
227
+ - Full TypeScript definitions (`.d.ts`)
228
+ - Anti-delete detection
229
+ - Message search helpers
230
+ - Auto-reply engine
231
+ - Scheduling helpers
232
+ - Message retry manager
233
+
234
+ </td>
235
+ </tr>
236
+ </table>
237
+
238
+ ---
239
+
240
+ ## ✨ Exclusive Vanzxy Enhancements
241
+
242
+ ### Audio Group Status Fix
243
+ Audio status uses a more compatible implementation to avoid unsupported-version errors on older WhatsApp clients.
244
+
245
+ ### AIRich — the rich-response message builder
246
+ A chainable builder (`AIRich`, also exported as `AIVanzxy` / `LeafRich` / `VanzxyAI` / `VanzxyRich`) with 40+ `add*()`/`set*()` methods covering headings, formatted text (hyperlinks/citations/LaTeX), code blocks, tables, image/video/product/post cards, task & progress cards, tip banners, and quick-reply suggestions — the kind of rich card layout you'd normally only see from an official AI/assistant-style bot. See [Usage Examples](#airich--rich-response-cards) below.
247
+
248
+ ### Native Flow Expansion
249
+
250
+ <table>
251
+ <tr>
252
+ <td valign="top" width="33%">
253
+
254
+ **Buttons & Actions**
255
+ - cta_reminder
256
+ - cta_cancel_reminder
257
+ - otp_button
258
+ - authentication_button
259
+ - call_button
260
+ - url_button
261
+ - reply_button
262
+ - voice_call
263
+ - video_call_button
264
+
265
+ </td>
266
+ <td valign="top" width="33%">
267
+
268
+ **Commerce Flow**
269
+ - catalog_message
270
+ - mpm
271
+ - card_message
272
+ - order_details
273
+ - order_status
274
+ - review_and_pay
275
+ - payment_status
276
+ - payment_method
277
+
278
+ </td>
279
+ <td valign="top" width="33%">
280
+
281
+ **Navigation & Misc**
282
+ - address_message
283
+ - send_location
284
+ - track_order
285
+ - reorder
286
+ - cancel_order
287
+ - clear_chat
288
+ - navigateToScreen
289
+ - flow_action
290
+
291
+ </td>
292
+ </tr>
293
+ </table>
294
+
295
+ ### System Notification Filter
296
+
297
+ Messages include:
298
+
299
+ ```js
300
+ message.isSystemNotification
301
+ ```
302
+
303
+ Useful for filtering:
304
+
305
+ - E2E notices
306
+ - Meta service notices
307
+ - Other system-generated messages
308
+
309
+ ---
310
+
311
+ ## 📦 Installation
312
+
313
+ ```bash
314
+ npm install @vanzxy/baileys
315
+ ```
316
+
317
+ Directly from GitHub:
318
+
319
+ ```bash
320
+ npm install github:vanzxysenpai/vanzxybaileys
321
+ ```
322
+
323
+ > Requires **Node.js 20+** — install will refuse to run below that (checked by `engine-requirements.js` on `preinstall`).
324
+
325
+ ### Optional peer dependencies
326
+
327
+ Everything below is **optional** — the socket works without any of them. Install only what the features you use need; missing ones fail with a clear install hint instead of a silent crash.
328
+
329
+ | Package | Unlocks |
330
+ |---|---|
331
+ | `sharp` | Fast image resizing/processing (used by the message builders' `Toolkit.resize`) |
332
+ | `@napi-rs/image` | Lighter native alternative to `sharp` for image ops |
333
+ | `jimp` | Pure-JS image fallback when neither of the above is installed |
334
+ | `fluent-ffmpeg` | Audio/video conversion for media messages |
335
+ | `audio-decode` | Audio waveform/duration extraction (voice notes, VoIP capture) |
336
+ | `link-preview-js` | Rich link previews for URLs in outgoing text messages |
337
+ | `better-sqlite3` | SQLite auth state, SQLite store adapter, **and** the [Bot Framework](#-bot-framework)'s `SQLiteStore`/`StatsManager` |
338
+ | `node-webpmux` | Packname/author EXIF metadata on stickers made via `MediaManager.convertToSticker()` — not needed for plain sticker conversion |
339
+ | `mongodb` | MongoDB store adapter |
340
+ | `mysql2` | MySQL store adapter |
341
+ | `pg` | PostgreSQL store adapter |
342
+ | `ioredis` | Redis store adapter |
343
+ | `@roamhq/wrtc` | Native WebRTC bindings for [voice calling](#-voice--video-calls) |
344
+
345
+ ---
346
+
347
+ ## 🚀 Quick Start
348
+
349
+ ```js
350
+ import { makeWASocket, useMultiFileAuthState } from '@vanzxy/baileys'
351
+
352
+ const { state, saveCreds } = await useMultiFileAuthState('auth_info')
353
+
354
+ const sock = makeWASocket({
355
+ auth: state
356
+ })
357
+
358
+ // persist credentials whenever Baileys updates them
359
+ sock.ev.on('creds.update', saveCreds)
360
+
361
+ sock.ev.on('connection.update', (update) => {
362
+ const { connection, qr } = update
363
+
364
+ // `printQRInTerminal` is deprecated upstream — render the QR yourself,
365
+ // e.g. with the `qrcode-terminal` package:
366
+ // import qrcode from 'qrcode-terminal'
367
+ // if (qr) qrcode.generate(qr, { small: true })
368
+ if (qr) console.log('Scan this QR:', qr)
369
+
370
+ if (connection === 'open') console.log('🍃 Connected!')
371
+ })
372
+
373
+ sock.ev.on('messages.upsert', ({ messages }) => {
374
+ const msg = messages[0]
375
+ if (!msg.message || msg.key.fromMe) return
376
+ console.log('New message from', msg.key.remoteJid)
377
+ })
378
+ ```
379
+
380
+ ---
381
+
382
+ ## 🔐 Authentication
383
+
384
+ Four auth-state backends ship out of the box. All return the same `{ state, saveCreds }` shape expected by `makeWASocket({ auth })`, so they're drop-in interchangeable.
385
+
386
+ | Function | Storage | Best for |
387
+ |---|---|---|
388
+ | `useMultiFileAuthState(folder)` | One JSON file per key, on disk | Default choice — simple, debuggable, works everywhere |
389
+ | `useSingleFileAuthState(fileName)` | One JSON file, on disk | Small bots where a single file is easier to manage/back up |
390
+ | `useSqliteAuthState(opts)` | SQLite (`better-sqlite3`) | Bots that already use SQLite, or want auth in one embedded DB file |
391
+ | `useCacheManagerAuthState(store, sessionKey)` | Any [`cacheable`](https://www.npmjs.com/package/@cacheable/node-cache)-compatible store | Multi-session hosting panels, Redis-backed setups |
392
+
393
+ ```js
394
+ import { makeWASocket, useMultiFileAuthState } from '@vanzxy/baileys'
395
+
396
+ const { state, saveCreds } = await useMultiFileAuthState('auth_info')
397
+ const sock = makeWASocket({ auth: state })
398
+ sock.ev.on('creds.update', saveCreds)
399
+ ```
400
+
401
+ ```js
402
+ // SQLite variant
403
+ import { makeWASocket, useSqliteAuthState } from '@vanzxy/baileys'
404
+
405
+ const { state, saveCreds } = await useSqliteAuthState({ database: './auth.db' })
406
+ const sock = makeWASocket({ auth: state })
407
+ sock.ev.on('creds.update', saveCreds)
408
+ ```
409
+
410
+ `useMultiFileAuthState` also exports `pruneStaleAuthFiles(folder, options)` to clean up old sender-key files on a schedule — useful for long-running bots that accumulate thousands of stale key files.
411
+
412
+ ---
413
+
414
+ ## 🗄️ Store Backends
415
+
416
+ `makeInMemoryStore()` from `lib/Store` gives you the classic in-memory chat/contact/message cache. For anything that needs to survive a restart, `makePersistentStore()` (from `PersistentStore.js`) wraps one of five backends behind the same interface:
417
+
418
+ | Backend | Function |
419
+ |---|---|
420
+ | SQLite | `createSqliteStoreAdapter(opts)` |
421
+ | MongoDB | `createMongoStoreAdapter(opts)` |
422
+ | MySQL | `createMysqlStoreAdapter(opts)` |
423
+ | PostgreSQL | `createPostgresStoreAdapter(opts)` |
424
+ | Redis | `createRedisStoreAdapter(opts)` |
425
+
426
+ ```js
427
+ import { makeWASocket, makeInMemoryStore } from '@vanzxy/baileys'
428
+
429
+ const store = makeInMemoryStore({})
430
+ store.readFromFile('./baileys_store.json')
431
+ setInterval(() => store.writeToFile('./baileys_store.json'), 10_000)
432
+
433
+ const sock = makeWASocket({ /* ...auth etc */ })
434
+ store.bind(sock.ev)
435
+ ```
436
+
437
+ ---
438
+
439
+ ## 💡 Usage Examples
440
+
441
+ ### Buttons & Native Flow
442
+
443
+ ```js
444
+ import { Button } from '@vanzxy/baileys'
445
+
446
+ await new Button(sock)
447
+ .setTitle('Promo Spesial')
448
+ .setBody('Diskon 20% cuma hari ini')
449
+ .setFooter('@vanzxy/baileys')
450
+ .addReply('Klaim Sekarang', 'claim_promo')
451
+ .addUrl('Lihat Katalog', 'https://example.com/catalog')
452
+ .addCall('Hubungi Kami', '628123456789')
453
+ .send(jid)
454
+ ```
455
+
456
+ ### Poll
457
+
458
+ ```js
459
+ import { Poll } from '@vanzxy/baileys'
460
+
461
+ await new Poll(sock)
462
+ .setName('Mau makan apa hari ini?')
463
+ .addOptions(['Nasi Goreng', 'Mie Ayam', 'Bakso'])
464
+ .setSelectable(1)
465
+ .send(jid)
466
+ ```
467
+
468
+ ### Carousel
469
+
470
+ > Each card must be built with `Button(...).toCard()` first — a carousel card is really just a button card with an image/video header.
471
+
472
+ ```js
473
+ import { Button, Carousel } from '@vanzxy/baileys'
474
+
475
+ const cardA = await new Button(sock)
476
+ .setImage('https://example.com/a.jpg')
477
+ .setTitle('Produk A')
478
+ .addUrl('Lihat', 'https://example.com/a')
479
+ .toCard()
480
+
481
+ const cardB = await new Button(sock)
482
+ .setImage('https://example.com/b.jpg')
483
+ .setTitle('Produk B')
484
+ .addUrl('Lihat', 'https://example.com/b')
485
+ .toCard()
486
+
487
+ await new Carousel(sock)
488
+ .setBody('Pilih salah satu produk di bawah ini')
489
+ .addCard([cardA, cardB])
490
+ .send(jid)
491
+ ```
492
+
493
+ ### AIRich — rich response cards
494
+
495
+ ```js
496
+ import { AIRich } from '@vanzxy/baileys'
497
+
498
+ await new AIRich(sock)
499
+ .addHeading('Ringkasan Order')
500
+ .addText('Pesananmu sedang diproses.')
501
+ .addTable([
502
+ ['Item', 'Qty'],
503
+ ['Kopi Susu', '2']
504
+ ])
505
+ .addTip('Pesanan biasanya siap dalam 15 menit')
506
+ .addSuggest('Lacak Order')
507
+ .send(jid)
508
+ ```
509
+
510
+ `AIRich` supports `{ id, insertAt }` on every `add*()`/`set*()` call, so you can insert a block relative to one you added earlier instead of always appending to the end — handy for streaming/edit-in-place style responses combined with `sendEdit(jid, id)`.
511
+
512
+ 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
+
516
+ ## 📞 Voice & Video Calls
517
+
518
+ Experimental audio-call support (ported from ourin-baileys) via a WASM call stack + WebRTC relay. Requires the optional `@roamhq/wrtc` peer dependency.
519
+
520
+ ```js
521
+ import { VoipClient } from '@vanzxy/baileys'
522
+
523
+ const voip = new VoipClient({ resourcesPath: './voip-resources' })
524
+ await voip.connectWithSocket(sock)
525
+
526
+ const call = await voip.call('628123456789')
527
+
528
+ call.on('ringing', () => console.log('Ringing...'))
529
+ call.on('connected', () => console.log('Call connected'))
530
+ call.on('ended', (reason) => console.log('Call ended:', reason))
531
+ ```
532
+
533
+ `ActiveCall` (returned by `.call()`) and `CallState` are also exported directly if you need finer-grained control over call state.
534
+
535
+ ---
536
+
537
+ ## 🔎 User Sync Queries
538
+
539
+ `WAUSync` (`USyncQuery` / `USyncUser` + protocols) lets you check things like WhatsApp registration, device lists, status, and username info for a JID before you message it — the same mechanism behind `sock.onWhatsApp()`.
540
+
541
+ ```js
542
+ import { USyncQuery, USyncUser, USyncContactProtocol } from '@vanzxy/baileys'
543
+
544
+ const query = new USyncQuery()
545
+ .withContext('interactive')
546
+ .withMode('query')
547
+ .withUser(new USyncUser().withPhone('628123456789'))
548
+
549
+ query.protocols.push(new USyncContactProtocol())
550
+
551
+ const result = await sock.executeUSyncQuery(query)
552
+ ```
553
+
554
+ Available protocols: `USyncContactProtocol`, `USyncDeviceProtocol`, `USyncStatusProtocol`, `USyncUsernameProtocol`, `USyncDisappearingModeProtocol`, `UsyncBotProfileProtocol`, `UsyncLIDProtocol`.
555
+
556
+ ---
557
+
558
+ ## 👤 Username Management
559
+
560
+ High-level wrappers around WhatsApp's username feature (the `@username` handle you can set instead of exposing your phone number), sitting on top of `USyncUsernameProtocol`. Query IDs are captured from live WA Web sessions — if a call starts throwing `unexpected response structure`, WA has rotated them and they need re-capturing.
561
+
562
+ ```js
563
+ // Check availability + get suggestions if taken
564
+ const check = await sock.checkUsername('vanzxy')
565
+ // { available: true, username: 'vanzxy' }
566
+ // or: { available: false, suggestions: [...], rejectionReasons: [...] }
567
+
568
+ // Claim a username
569
+ await sock.setUsername('vanzxy', { source: sock.USERNAME_SOURCE.USER_INPUT })
570
+
571
+ // Lock it behind a PIN so it can't be changed without one
572
+ await sock.setUsernamePin('123456')
573
+
574
+ // Read your own username / drop it
575
+ const mine = await sock.getMyUsername()
576
+ await sock.deleteUsername()
577
+
578
+ // Resolve a username to a JID (USync-based, like onWhatsApp() but by username)
579
+ const user = await sock.findUserByUsername('someone')
580
+ // { jid: '628...@s.whatsapp.net', contact: false }
581
+
582
+ // Batch-resolve usernames for a list of known contacts
583
+ const usernames = await sock.fetchContactUsernames(jid1, jid2, jid3)
584
+
585
+ // Get WA's own suggestions (e.g. for onboarding flows)
586
+ const recs = await sock.getUsernameRecommendations()
587
+ ```
588
+
589
+ > Requires a Community/Contact-tier account in good standing — accounts under WA's usual restrictions for new/unverified numbers may see `INVALID` or empty suggestions regardless of the username's actual availability.
590
+
591
+ ---
592
+
593
+ <div align="center">
594
+ <img src="https://capsule-render.vercel.app/api?type=soft&color=0:2ecc71,100:1d6a23&height=70&section=header" width="100%"/>
595
+ </div>
596
+
597
+ ## 🤖 Bot Framework
598
+
599
+ An optional, higher-level layer on top of the raw socket: middleware routing, a `!command` dispatcher, a message queue that survives disconnects, exponential-backoff auto-reconnect, per-JID session storage, group activity stats, and media (sticker/voice-note) conversion helpers — so a new bot project doesn't have to hand-roll session/context management every time.
600
+
601
+ Needs the `better-sqlite3` peer dependency (session + stats storage) and `fluent-ffmpeg` (sticker/voice-note conversion, already listed above) — both fail with an install hint rather than crashing if you use a Framework feature that needs them without installing them first.
602
+
603
+ ```js
604
+ import { Bot } from '@vanzxy/baileys'
605
+
606
+ const bot = new Bot({
607
+ socketConfig: { printQRInTerminal: true },
608
+ dbPath: './bot.db', // sessions + stats, defaults to 'baileys_store.db'
609
+ enableStats: true // group message/sticker leaderboards + ghost detection
610
+ })
611
+
612
+ bot.command('!ping', async (ctx) => {
613
+ await ctx.reply({ text: 'pong' })
614
+ })
615
+
616
+ bot.command('!sticker', async (ctx) => {
617
+ if (!ctx.quoted?.imageMessage) return ctx.reply({ text: 'Reply to an image with !sticker' })
618
+ // ctx.replySticker() handles the WebP conversion for you
619
+ await ctx.replySticker(imageBuffer, { packname: 'Vanzxy Pack', author: 'you' })
620
+ })
621
+
622
+ bot.onText(async (ctx) => {
623
+ // ctx.session() / ctx.setSession() / ctx.updateSession() / ctx.clearSession()
624
+ // persist small per-chat state (e.g. multi-step flows) to SQLite automatically
625
+ const state = ctx.session()
626
+ if (state?.awaitingReply) {
627
+ ctx.updateSession((s) => ({ ...s, awaitingReply: false }))
628
+ }
629
+ })
630
+
631
+ await bot.start()
632
+ ```
633
+
634
+ `Context`, `SessionManager`, `StatsManager`, `MediaManager`, and `SQLiteStore` are also exported individually if you only need one piece rather than the full `Bot` class.
635
+
636
+ > These files ship as plain `.js` for now — hand-written `.d.ts` declarations for the Framework module haven't been added yet, unlike the rest of this fork's fully-typed surface.
637
+
638
+ ---
639
+
640
+ ## 🧩 Utility Modules
641
+
642
+ A sample of the utilities exported from `lib/Utils` beyond the message builders above:
643
+
644
+ | Module | What it does |
645
+ |---|---|
646
+ | `anti-delete` | Detect and recover messages the sender deleted for everyone |
647
+ | `auto-reply` | Simple keyword/pattern-based auto-responder engine |
648
+ | `message-search` | Search cached/stored messages, peeling off ephemeral/view-once wrappers first |
649
+ | `message-retry-manager` | Handles WhatsApp's retry-receipt protocol for undecryptable messages |
650
+ | `scheduling` | Schedule messages/actions for later delivery |
651
+ | `business` | Business-profile & catalog helpers |
652
+ | `chat-control` | Pin, mute, archive, and mark-read/unread helpers |
653
+ | `chat-history-helpers` | Work with synced chat history payloads |
654
+ | `link-preview` | Generate link preview metadata for outgoing messages |
655
+ | `stickerpack` | Build and send sticker packs (including animated/Lottie) |
656
+ | `templates` | Legacy WhatsApp Business template message helpers |
657
+ | `vcard` | Build vCard (contact card) payloads |
658
+ | `status` | Post and manage WhatsApp Status updates |
659
+ | `event-buffer` | Buffers/coalesces high-volume socket events for heavier bots |
660
+
661
+ Every module above ships a matching `.d.ts`, so your editor will show full hover-docs regardless of which ones you import.
662
+
663
+ ---
664
+
665
+ ## 🛠 Recommended Environment
666
+
667
+ | Requirement | Version |
668
+ |---|---|
669
+ | Node.js | 20+ |
670
+ | Module system | ESM |
671
+ | WhatsApp | Latest Multi Device |
672
+
673
+ ---
674
+
675
+ ## 📘 TypeScript Support
676
+
677
+ Every file in `lib/` ships a matching `.d.ts`, including the message builders (`MessageBuilder_d.ts`) and all `Types/*` definitions (Auth, Chat, Contact, Events, GroupMetadata, Message, Product, Signal, USync, and more). No `@types/` package needed — plain `import { ... } from '@vanzxy/baileys'` gets full autocomplete in TS or JS-with-checkJS projects.
678
+
679
+ ---
680
+
681
+ ## 📚 Fork Lineage
682
+
683
+ ```
684
+ @vanzxy/baileys
685
+ └── @itsliaaa/baileys
686
+ └── WhiskeySockets/Baileys
687
+ ```
688
+
689
+ Respect to all original maintainers and contributors.
690
+
691
+ ---
692
+
693
+ ## ❓ FAQ & Troubleshooting
694
+
695
+ <details>
696
+ <summary><b>Koneksi terus putus / reconnect loop</b></summary>
697
+ <br/>
698
+
699
+ Cek `connection.update` untuk field `lastDisconnect.error`. Kalau status code-nya `401` (loggedOut), sesi memang sudah invalid dan perlu scan ulang QR — jangan auto-reconnect di kondisi ini. Untuk status lain (`428`, `440`, dsb.), reconnect dengan backoff biasanya cukup.
700
+
701
+ </details>
702
+
703
+ <details>
704
+ <summary><b>QR tidak muncul / tidak ke-scan</b></summary>
705
+ <br/>
706
+
707
+ `printQRInTerminal` sudah deprecated di upstream Baileys — pastikan kamu render QR sendiri dari event `qr` (lihat contoh di [Quick Start](#-quick-start)). Kalau QR muncul tapi gagal linking, biasanya karena versi WA Web (`version` di `makeWASocket`) sudah kedaluwarsa; fetch versi terbaru lewat `fetchLatestBaileysVersion()`.
708
+
709
+ </details>
710
+
711
+ <details>
712
+ <summary><b>Error "Bad MAC" / pesan gagal didekripsi</b></summary>
713
+ <br/>
714
+
715
+ Umumnya terjadi kalau folder auth state korup atau sesi dipakai di lebih dari satu proses secara bersamaan. Pastikan hanya satu instance yang menulis ke folder auth state yang sama, dan pertimbangkan `pruneStaleAuthFiles()` untuk membersihkan sender-key lama secara berkala.
716
+
717
+ </details>
718
+
719
+ <details>
720
+ <summary><b>Memory terus naik di bot yang jalan lama</b></summary>
721
+ <br/>
722
+
723
+ Kalau pakai `makeInMemoryStore()`, cache chat/message/contact akan terus tumbuh tanpa batas. Untuk bot yang jalan lama, pertimbangkan pindah ke salah satu backend `makePersistentStore()` (SQLite/Redis/dst) dan pakai `event-buffer` untuk meredam lonjakan event di trafik tinggi.
724
+
725
+ </details>
726
+
727
+ <details>
728
+ <summary><b>Voice call gagal connect</b></summary>
729
+ <br/>
730
+
731
+ Fitur ini masih experimental dan butuh peer dependency `@roamhq/wrtc` — pastikan sudah terinstall dan platform kamu didukung native binding-nya. Cek event `call.on('ended', reason => ...)` untuk detail penyebab gagalnya.
732
+
733
+ </details>
734
+
735
+ ---
736
+
737
+ ## 🤝 Contributing
738
+
739
+ Kontribusi dipersilakan, terutama untuk perbaikan bug, dokumentasi, dan enhancement pada `MessageBuilder` / `AIRich`.
740
+
741
+ 1. Fork repo ini, buat branch dari `main` (`feat/nama-fitur` atau `fix/nama-bug`)
742
+ 2. Pastikan perubahan tetap ESM-only dan menyertakan/menyesuaikan `.d.ts` terkait
743
+ 3. Uji perubahan pada minimal satu jalur auth state + satu store backend sebelum PR
744
+ 4. Buka Pull Request dengan deskripsi singkat: apa yang berubah dan kenapa
745
+
746
+ Untuk laporan bug, sertakan versi Node.js, cara reproduksi, dan potongan log `lastDisconnect.error` bila relevan.
747
+
748
+ ---
749
+
750
+ ## 🙏 Credits
751
+
752
+ - **Nixel** (with contributions from **Ahmad tumbuh kembang**) — base implementation of the `MessageBuilder` (AIRich / Button / Carousel / Toolkit), originally "NIXCODE — Advanced WhatsApp Interactive Message Builder"
753
+ - **vinikjkkj** ([zapo](https://github.com/vinikjkkj/zapo)) — button/list addon-kind resolution logic
754
+ - **QueenAnya** (`@queenanya/baileys`) — interactive/native-flow button send layer
755
+ - **WhiskeySockets/Baileys** & **@itsliaaa/baileys** — upstream base
756
+
757
+ Full details and license terms per component: see [`NOTICE.md`](./NOTICE.md).
758
+
759
+ ---
760
+
761
+ ## 👑 Maintainer
762
+
763
+ <table>
764
+ <tr>
765
+ <td width="180">
766
+ <img src="https://files.catbox.moe/reqhur.png" width="160" alt="Vanzxy portrait"/>
767
+ </td>
768
+ <td>
769
+
770
+ **Vanzxy**
771
+
772
+ - GitHub: [github.com/vanzxysenpai](https://github.com/vanzxysenpai)
773
+ - Package: [`@vanzxy/baileys`](https://www.npmjs.com/package/@vanzxy/baileys)
774
+ - ✦ Maintains this fork solo — issues & PRs are welcome and reviewed personally.
775
+
776
+ </td>
777
+ </tr>
778
+ </table>
779
+
780
+ <p align="center">
781
+ <img src="https://raw.githubusercontent.com/vanzxysenpai/vanzxysenpai/output/github-contribution-grid-snake.svg" width="100%" alt="Contribution snake animation"/>
782
+ </p>
783
+
784
+ ---
785
+
786
+ ## ⚠️ Disclaimer
787
+
788
+ This project is an independent fork.
789
+ Use responsibly and follow WhatsApp Terms of Service.
790
+
791
+ ---
792
+
793
+ ## 📝 V5 Patch Notes
794
+
795
+ - 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.
796
+ - Added the [Bot Framework](#-bot-framework) (`Bot`, `Context`, `SessionManager`, `StatsManager`, `MediaManager`, `SQLiteStore`) — ported from `@queenanya/baileys` (originally WhiskeySockets PR #2710 by LuferOS). Adapted on the way in:
797
+ - `SQLiteStore`/`StatsManager` construction moved behind an async `.create()` factory so `better-sqlite3` stays a lazily-loaded optional peer dep instead of a hard top-level import that would crash the Framework module for anyone without it installed.
798
+ - `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
+ - `Bot`'s default logger now falls back to this fork's own pino instance instead of a silent no-op stub.
800
+ - No `.d.ts` files were written for the new Framework module yet — see the note in that section.
801
+ - Bumped to `1.0.0`.
802
+
803
+ ---
804
+
805
+ ## 📝 V4 Patch Notes
806
+
807
+ - Kept the existing Vanzxy custom MessageBuilder classes and AIRich implementation intact.
808
+ - Added `whatsapp-rust-bridge@0.5.5` as a runtime dependency. The library already dynamically imports this module for LT Hash/app-state and crypto helpers; declaring it prevents accidental missing-module fallbacks in normal installations.
809
+ - Existing guarded fallbacks for platforms where the native bridge cannot load remain in place.
810
+ - ESM-only package metadata is preserved; no CommonJS build is included.
811
+
812
+ Reference audit: the supplied Ourin, Elaina, ItsLiaaa, and Noxleyss packages were compared before this patch. Their broader core changes were not copied wholesale because the current Vanzxy tree already contains additional LID, retry, media, interactive, and AIRich fixes that would risk regressions if replaced.
813
+
814
+ ---
815
+
816
+ <div align="center">
817
+
818
+ <img src="https://files.catbox.moe/tfqh0f.gif" width="60%" alt="Thanks for visiting"/>
819
+
820
+ Thanks for visiting, bye 👋
821
+
822
+ <img src="https://capsule-render.vercel.app/api?type=waving&color=0:2ecc71,100:1d6a23&height=100&section=footer" width="100%"/>
823
+
824
+ Made with 🍃 by **Vanzxy**
825
+
826
+ Thanks for stopping by! ✌️
827
+
828
+ <a href="#top">⬆️ Back to top</a>
829
+
830
+ </div>