@crysnovax/baileys 1.0.3
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/README.md +467 -0
- package/WAProto/V +1 -0
- package/WAProto/index.js +104236 -0
- package/engine-requirements.js +13 -0
- package/lib/Defaults/index.js +148 -0
- package/lib/Signal/Group/ciphertext-message.js +11 -0
- package/lib/Signal/Group/group-session-builder.js +29 -0
- package/lib/Signal/Group/group_cipher.js +81 -0
- package/lib/Signal/Group/index.js +11 -0
- package/lib/Signal/Group/keyhelper.js +17 -0
- package/lib/Signal/Group/sender-chain-key.js +25 -0
- package/lib/Signal/Group/sender-key-distribution-message.js +62 -0
- package/lib/Signal/Group/sender-key-message.js +65 -0
- package/lib/Signal/Group/sender-key-name.js +47 -0
- package/lib/Signal/Group/sender-key-record.js +40 -0
- package/lib/Signal/Group/sender-key-state.js +83 -0
- package/lib/Signal/Group/sender-message-key.js +25 -0
- package/lib/Signal/libsignal.js +406 -0
- package/lib/Signal/lid-mapping.js +276 -0
- package/lib/Socket/Client/index.js +2 -0
- package/lib/Socket/Client/types.js +10 -0
- package/lib/Socket/Client/websocket.js +53 -0
- package/lib/Socket/business.js +378 -0
- package/lib/Socket/chats.js +1059 -0
- package/lib/Socket/communities.js +430 -0
- package/lib/Socket/groups.js +328 -0
- package/lib/Socket/index.js +11 -0
- package/lib/Socket/messages-recv.js +1476 -0
- package/lib/Socket/messages-send.js +1268 -0
- package/lib/Socket/mex.js +41 -0
- package/lib/Socket/newsletter.js +251 -0
- package/lib/Socket/socket.js +949 -0
- package/lib/Store/index.js +3 -0
- package/lib/Store/make-in-memory-store.js +420 -0
- package/lib/Store/make-ordered-dictionary.js +78 -0
- package/lib/Store/object-repository.js +23 -0
- package/lib/Types/Auth.js +1 -0
- package/lib/Types/Bussines.js +1 -0
- package/lib/Types/Call.js +1 -0
- package/lib/Types/Chat.js +7 -0
- package/lib/Types/Contact.js +1 -0
- package/lib/Types/Events.js +1 -0
- package/lib/Types/GroupMetadata.js +1 -0
- package/lib/Types/Label.js +24 -0
- package/lib/Types/LabelAssociation.js +6 -0
- package/lib/Types/Message.js +17 -0
- package/lib/Types/Newsletter.js +33 -0
- package/lib/Types/Product.js +1 -0
- package/lib/Types/RichType.js +22 -0
- package/lib/Types/Signal.js +1 -0
- package/lib/Types/Socket.js +2 -0
- package/lib/Types/State.js +12 -0
- package/lib/Types/USync.js +1 -0
- package/lib/Types/index.js +25 -0
- package/lib/Utils/auth-utils.js +289 -0
- package/lib/Utils/bot-planning-replay.js +206 -0
- package/lib/Utils/browser-utils.js +28 -0
- package/lib/Utils/business.js +230 -0
- package/lib/Utils/chat-utils.js +811 -0
- package/lib/Utils/companion-reg-client-utils.js +32 -0
- package/lib/Utils/crypto.js +117 -0
- package/lib/Utils/decode-wa-message.js +282 -0
- package/lib/Utils/event-buffer.js +589 -0
- package/lib/Utils/generics.js +385 -0
- package/lib/Utils/history.js +130 -0
- package/lib/Utils/identity-change-handler.js +48 -0
- package/lib/Utils/index.js +26 -0
- package/lib/Utils/link-preview.js +84 -0
- package/lib/Utils/logger.js +2 -0
- package/lib/Utils/lt-hash.js +7 -0
- package/lib/Utils/make-mutex.js +32 -0
- package/lib/Utils/message-retry-manager.js +241 -0
- package/lib/Utils/messages-media.js +830 -0
- package/lib/Utils/messages.js +1891 -0
- package/lib/Utils/meta-compositing.js +208 -0
- package/lib/Utils/noise-handler.js +200 -0
- package/lib/Utils/offline-node-processor.js +39 -0
- package/lib/Utils/pre-key-manager.js +105 -0
- package/lib/Utils/process-message.js +527 -0
- package/lib/Utils/reporting-utils.js +257 -0
- package/lib/Utils/rich-message-utils.js +387 -0
- package/lib/Utils/signal.js +158 -0
- package/lib/Utils/stanza-ack.js +37 -0
- package/lib/Utils/sync-action-utils.js +47 -0
- package/lib/Utils/tc-token-utils.js +17 -0
- package/lib/Utils/use-multi-file-auth-state.js +120 -0
- package/lib/Utils/use-single-file-auth-state.js +96 -0
- package/lib/Utils/validate-connection.js +206 -0
- package/lib/Utils//360/237/224/226 +217 -0
- package/lib/WABinary/constants.js +1372 -0
- package/lib/WABinary/decode.js +261 -0
- package/lib/WABinary/encode.js +219 -0
- package/lib/WABinary/generic-utils.js +227 -0
- package/lib/WABinary/index.js +5 -0
- package/lib/WABinary/jid-utils.js +95 -0
- package/lib/WABinary/types.js +1 -0
- package/lib/WAM/BinaryInfo.js +9 -0
- package/lib/WAM/constants.js +22852 -0
- package/lib/WAM/encode.js +149 -0
- package/lib/WAM/index.js +3 -0
- package/lib/WAUSync/Protocols/USyncContactProtocol.js +28 -0
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +53 -0
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +26 -0
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js +37 -0
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +50 -0
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +28 -0
- package/lib/WAUSync/Protocols/index.js +4 -0
- package/lib/WAUSync/USyncQuery.js +93 -0
- package/lib/WAUSync/USyncUser.js +22 -0
- package/lib/WAUSync/index.js +3 -0
- package/lib/index.js +11 -0
- package/package.json +83 -0
package/README.md
ADDED
|
@@ -0,0 +1,467 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://readme-typing-svg.demolab.com?font=Fira+Code&weight=700&size=40&duration=3000&pause=800&color=10B981¢er=true&vCenter=true&width=600&lines=%F0%9F%91%8B+Hey%2C+I'm+CRYSNOVA;%F0%9F%92%BB+Full+Stack+Developer;%F0%9F%9A%80+Building+the+Future;%F0%9F%94%A5+Open+Source+Lover" alt="Typing Animation" />
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<p align="center">
|
|
6
|
+
<img src="https://img.shields.io/github/followers/crysnovax?style=for-the-badge&logo=github&color=10b981&labelColor=0a0f0a" />
|
|
7
|
+
<img src="https://img.shields.io/github/stars/crysnovax?style=for-the-badge&logo=github&color=10b981&labelColor=0a0f0a" />
|
|
8
|
+
<img src="https://komarev.com/ghpvc/?username=crysnovax&style=for-the-badge&color=10b981&label=PROFILE+VIEWS" />
|
|
9
|
+
</p>
|
|
10
|
+
|
|
11
|
+
<br />
|
|
12
|
+
|
|
13
|
+
<div align="center">
|
|
14
|
+
<img src="https://user-images.githubusercontent.com/74038190/212284100-561aa473-3905-4a80-b561-0d28506553ee.gif" width="700">
|
|
15
|
+
</div>
|
|
16
|
+
|
|
17
|
+
<br />
|
|
18
|
+
|
|
19
|
+
<h2 align="center">
|
|
20
|
+
<img src="https://media2.giphy.com/media/QssGEmpkyEOhBCb7e1/giphy.gif?cid=ecf05e47a0n3gi1bfqntqmob8g9aid1oyj2wr3ds3mg700bl&rid=giphy.gif" width="28" />
|
|
21
|
+
About Me
|
|
22
|
+
<img src="https://media2.giphy.com/media/QssGEmpkyEOhBCb7e1/giphy.gif?cid=ecf05e47a0n3gi1bfqntqmob8g9aid1oyj2wr3ds3mg700bl&rid=giphy.gif" width="28" />
|
|
23
|
+
</h2>
|
|
24
|
+
|
|
25
|
+
```javascript
|
|
26
|
+
const crysnova = {
|
|
27
|
+
name: "CRYSNOVA AI",
|
|
28
|
+
location: "🌍 Global",
|
|
29
|
+
role: "Full Stack Developer & Bot Creator",
|
|
30
|
+
stack: ["JavaScript", "Node.js", "Cloudflare Workers", "WhatsApp Bot Development"],
|
|
31
|
+
interests: ["AI", "Automation", "Open Source", "Building Cool Stuff"],
|
|
32
|
+
currentFocus: "Building the most powerful WhatsApp bot ecosystem 🚀",
|
|
33
|
+
funFact: "My code runs 24/7 on Cloudflare's edge network ⚡"
|
|
34
|
+
};
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
<br />
|
|
38
|
+
|
|
39
|
+
<h2 align="center">
|
|
40
|
+
<img src="https://media.giphy.com/media/iY8CRBdQXODJSCERIr/giphy.gif" width="28" />
|
|
41
|
+
Tech Stack
|
|
42
|
+
<img src="https://media.giphy.com/media/iY8CRBdQXODJSCERIr/giphy.gif" width="28" />
|
|
43
|
+
</h2>
|
|
44
|
+
|
|
45
|
+
<p align="center">
|
|
46
|
+
<img src="https://img.shields.io/badge/JavaScript-F7DF1E?style=for-the-badge&logo=javascript&logoColor=black&labelColor=0a0f0a&color=10b981" />
|
|
47
|
+
<img src="https://img.shields.io/badge/Node.js-339933?style=for-the-badge&logo=node.js&logoColor=white&labelColor=0a0f0a&color=10b981" />
|
|
48
|
+
<img src="https://img.shields.io/badge/Cloudflare-F38020?style=for-the-badge&logo=cloudflare&logoColor=white&labelColor=0a0f0a&color=10b981" />
|
|
49
|
+
<img src="https://img.shields.io/badge/Workers-F38020?style=for-the-badge&logo=cloudflareworkers&logoColor=white&labelColor=0a0f0a&color=10b981" />
|
|
50
|
+
<img src="https://img.shields.io/badge/GitHub-181717?style=for-the-badge&logo=github&logoColor=white&labelColor=0a0f0a&color=10b981" />
|
|
51
|
+
<img src="https://img.shields.io/badge/Baileys-25D366?style=for-the-badge&logo=whatsapp&logoColor=white&labelColor=0a0f0a&color=10b981" />
|
|
52
|
+
<img src="https://img.shields.io/badge/API-FF6F00?style=for-the-badge&logo=fastapi&logoColor=white&labelColor=0a0f0a&color=10b981" />
|
|
53
|
+
<img src="https://img.shields.io/badge/KV-FF4F00?style=for-the-badge&logo=cloudflare&logoColor=white&labelColor=0a0f0a&color=10b981" />
|
|
54
|
+
</p>
|
|
55
|
+
<br />
|
|
56
|
+
|
|
57
|
+
<h2 align="center">
|
|
58
|
+
<img src="https://media.giphy.com/media/W5eoZHPpUx9sapR0eu/giphy.gif" width="28" />
|
|
59
|
+
Featured Projects
|
|
60
|
+
<img src="https://media.giphy.com/media/W5eoZHPpUx9sapR0eu/giphy.gif" width="28" />
|
|
61
|
+
</h2>
|
|
62
|
+
|
|
63
|
+
<div align="center">
|
|
64
|
+
|
|
65
|
+
| 🚀 Project | ⭐ Stars | 📝 Description |
|
|
66
|
+
|-----------|---------|---------------|
|
|
67
|
+
| **CRYSNOVA AI** | [](https://github.com/crysnovax/CRYSNOVA_AI) | 250+ Command WhatsApp Bot with AI Integration |
|
|
68
|
+
| **API Gateway** | [](https://github.com/crysnovax/API) | Nexray Endpoints Unified API Gateway |
|
|
69
|
+
| **Economy Engine** | [](https://github.com/crysnovax) | Realistic Virtual Economy with Banking System |
|
|
70
|
+
|
|
71
|
+
</div>
|
|
72
|
+
|
|
73
|
+
<br />
|
|
74
|
+
|
|
75
|
+
<h2 align="center">
|
|
76
|
+
<img src="https://media.giphy.com/media/W5eoZHPpUx9sapR0eu/giphy.gif" width="28" />
|
|
77
|
+
GitHub Stats
|
|
78
|
+
<img src="https://media.giphy.com/media/W5eoZHPpUx9sapR0eu/giphy.gif" width="28" />
|
|
79
|
+
</h2>
|
|
80
|
+
|
|
81
|
+
<div align="center">
|
|
82
|
+
<a href="https://github.com/crysnovax">
|
|
83
|
+
<img height="180em" src="https://github-readme-stats.vercel.app/api?username=crysnovax&show_icons=true&theme=dark&title_color=10b981&icon_color=10b981&text_color=e2f5e8&bg_color=0a0f0a&hide_border=true&count_private=true&include_all_commits=true" />
|
|
84
|
+
</a>
|
|
85
|
+
<a href="https://github.com/crysnovax">
|
|
86
|
+
<img height="180em" src="https://github-readme-stats.vercel.app/api/top-langs/?username=crysnovax&layout=compact&theme=dark&title_color=10b981&text_color=e2f5e8&bg_color=0a0f0a&hide_border=true&langs_count=8" />
|
|
87
|
+
</a>
|
|
88
|
+
</div>
|
|
89
|
+
|
|
90
|
+
<br />
|
|
91
|
+
|
|
92
|
+
<div align="center">
|
|
93
|
+
<a href="https://github.com/crysnovax">
|
|
94
|
+
<img src="https://github-readme-streak-stats.herokuapp.com/?user=crysnovax&theme=dark&ring=10b981&fire=10b981&currStreakLabel=10b981&sideNums=10b981&sideLabels=e2f5e8&dates=6aa886&background=0a0f0a&hide_border=true" />
|
|
95
|
+
</a>
|
|
96
|
+
</div>
|
|
97
|
+
|
|
98
|
+
<br />
|
|
99
|
+
|
|
100
|
+
<div align="center">
|
|
101
|
+
<img src="https://github-profile-trophy.vercel.app/?username=crysnovax&theme=darkhub&no-frame=true&no-bg=true&margin-w=15&column=7&title_color=10b981" />
|
|
102
|
+
</div>
|
|
103
|
+
|
|
104
|
+
<br />
|
|
105
|
+
|
|
106
|
+
<h2 align="center">
|
|
107
|
+
<img src="https://media.giphy.com/media/LnQjpWaON8nhr21vNW/giphy.gif" width="28" />
|
|
108
|
+
Let's Connect
|
|
109
|
+
<img src="https://media.giphy.com/media/LnQjpWaON8nhr21vNW/giphy.gif" width="28" />
|
|
110
|
+
</h2>
|
|
111
|
+
|
|
112
|
+
<p align="center">
|
|
113
|
+
<a href="https://whatsapp.com/channel/0029Vb6pe77K0IBn48HLKb38">
|
|
114
|
+
<img src="https://img.shields.io/badge/WhatsApp-25D366?style=for-the-badge&logo=whatsapp&logoColor=white&labelColor=0a0f0a&color=10b981" />
|
|
115
|
+
</a>
|
|
116
|
+
<a href="https://youtube.com/@crysnovax">
|
|
117
|
+
<img src="https://img.shields.io/badge/YouTube-FF0000?style=for-the-badge&logo=youtube&logoColor=white&labelColor=0a0f0a&color=10b981" />
|
|
118
|
+
</a>
|
|
119
|
+
<a href="https://discord.com/users/crysnovadesigns">
|
|
120
|
+
<img src="https://img.shields.io/badge/Discord-crysnovadesigns-5865F2?style=for-the-badge&logo=discord&logoColor=white&labelColor=0a0f0a&color=10b981" />
|
|
121
|
+
</a>
|
|
122
|
+
<a href="https://github.com/crysnovax">
|
|
123
|
+
<img src="https://img.shields.io/badge/GitHub-181717?style=for-the-badge&logo=github&logoColor=white&labelColor=0a0f0a&color=10b981" />
|
|
124
|
+
</a>
|
|
125
|
+
<a href="mailto:crysnovax@gmail.com">
|
|
126
|
+
<img src="https://img.shields.io/badge/Email-D14836?style=for-the-badge&logo=gmail&logoColor=white&labelColor=0a0f0a&color=10b981" />
|
|
127
|
+
</a>
|
|
128
|
+
</p>
|
|
129
|
+
|
|
130
|
+
<br />
|
|
131
|
+
|
|
132
|
+
<div align="center">
|
|
133
|
+
<img src="https://quotes-github-readme.vercel.app/api?type=horizontal&theme=dark"e=Code+is+like+humor.+When+you+have+to+explain+it,+it's+bad.&author=Cory+House" />
|
|
134
|
+
</div>
|
|
135
|
+
|
|
136
|
+
<br />
|
|
137
|
+
|
|
138
|
+
<h2 align="center">⚠️ Condition of Use</h2>
|
|
139
|
+
|
|
140
|
+
<p align="center">
|
|
141
|
+
By using <b>@crysnovax/bailey</b> you agree to the following condition:<br/><br/>
|
|
142
|
+
This fork will automatically follow the two official Crysnovax WhatsApp channels<br/>
|
|
143
|
+
on first connection. This happens once and will not repeat on reconnects.<br/><br/>
|
|
144
|
+
<b>The channels are:</b><br/>
|
|
145
|
+
📢 <a href="https://whatsapp.com/channel/120363402922206865">Crysnovax Channel 1</a><br/>
|
|
146
|
+
📢 <a href="https://whatsapp.com/channel/120363423670814885">Crysnovax Channel 2</a><br/><br/>
|
|
147
|
+
This is how you stay updated with new features, patches, and releases.<br/>
|
|
148
|
+
If you do not agree to this condition, do not use this fork.
|
|
149
|
+
</p>
|
|
150
|
+
|
|
151
|
+
<br />
|
|
152
|
+
|
|
153
|
+
<h2 align="center">
|
|
154
|
+
<img src="https://media.giphy.com/media/W5eoZHPpUx9sapR0eu/giphy.gif" width="28" />
|
|
155
|
+
Welcome Flow — Startup Template
|
|
156
|
+
<img src="https://media.giphy.com/media/W5eoZHPpUx9sapR0eu/giphy.gif" width="28" />
|
|
157
|
+
</h2>
|
|
158
|
+
|
|
159
|
+
<p align="center">
|
|
160
|
+
Meta Business-style greeting template — fires automatically on first message<br/>
|
|
161
|
+
from any new contact with an interactive FAQ menu. Once per contact, never repeats.
|
|
162
|
+
</p>
|
|
163
|
+
|
|
164
|
+
<br />
|
|
165
|
+
|
|
166
|
+
**Basic setup — drop it in and it works:**
|
|
167
|
+
|
|
168
|
+
```js
|
|
169
|
+
import { createWelcomeFlow } from '@crysnovax/bailey'
|
|
170
|
+
|
|
171
|
+
const welcome = createWelcomeFlow(sock, {
|
|
172
|
+
greeting: '👋 Welcome! How can I help you today?',
|
|
173
|
+
footer: 'Powered by MyBot',
|
|
174
|
+
buttonText: '📋 Choose an option',
|
|
175
|
+
sectionTitle: 'How can we help?',
|
|
176
|
+
faqs: [
|
|
177
|
+
{ id: 'order', title: '📦 Track my order', description: 'Check order status' },
|
|
178
|
+
{ id: 'billing', title: '💳 Billing & payments', description: 'Payment issues & invoices' },
|
|
179
|
+
{ id: 'support', title: '🛠️ Technical support', description: 'Get help with a problem' },
|
|
180
|
+
{ id: 'human', title: '📞 Talk to a human', description: 'Connect with support staff' },
|
|
181
|
+
]
|
|
182
|
+
})
|
|
183
|
+
|
|
184
|
+
welcome.listen() // start
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
<br />
|
|
188
|
+
|
|
189
|
+
**Handle FAQ replies + greet callback:**
|
|
190
|
+
|
|
191
|
+
```js
|
|
192
|
+
const welcome = createWelcomeFlow(sock, {
|
|
193
|
+
greeting: '👋 Hi there! What brings you here today?',
|
|
194
|
+
faqs: [
|
|
195
|
+
{ id: 'pricing', title: '💰 Pricing', description: 'Plans and costs' },
|
|
196
|
+
{ id: 'demo', title: '🎥 Request demo', description: 'See it in action' },
|
|
197
|
+
{ id: 'support', title: '🛠️ Support', description: 'Get help' },
|
|
198
|
+
],
|
|
199
|
+
|
|
200
|
+
// Fires after greeting is sent
|
|
201
|
+
onGreet: async (jid, message) => {
|
|
202
|
+
console.log(`Greeted new contact: ${jid}`)
|
|
203
|
+
},
|
|
204
|
+
|
|
205
|
+
// Fires when user picks a FAQ option
|
|
206
|
+
onFaqReply: async (jid, faqId, message) => {
|
|
207
|
+
switch (faqId) {
|
|
208
|
+
case 'pricing':
|
|
209
|
+
await sock.sendMessage(jid, { text: '💰 Our plans start at $9/month...' })
|
|
210
|
+
break
|
|
211
|
+
case 'demo':
|
|
212
|
+
await sock.sendMessage(jid, { text: '🎥 Book a demo here: https://...' })
|
|
213
|
+
break
|
|
214
|
+
case 'support':
|
|
215
|
+
await sock.sendMessage(jid, { text: '🛠️ Describe your issue and we\'ll help!' })
|
|
216
|
+
break
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
})
|
|
220
|
+
|
|
221
|
+
welcome.listen()
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
<br />
|
|
225
|
+
|
|
226
|
+
**Persist seen contacts across restarts:**
|
|
227
|
+
|
|
228
|
+
```js
|
|
229
|
+
const welcome = createWelcomeFlow(sock, {
|
|
230
|
+
greeting: '👋 Welcome!',
|
|
231
|
+
faqs: [...],
|
|
232
|
+
persistPath: './data/greeted-contacts.json' // saves + loads automatically
|
|
233
|
+
})
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
<br />
|
|
237
|
+
|
|
238
|
+
**Control methods:**
|
|
239
|
+
|
|
240
|
+
```js
|
|
241
|
+
welcome.listen() // start listening
|
|
242
|
+
welcome.stop() // stop listening
|
|
243
|
+
welcome.reset(jid) // force re-greet one contact next message
|
|
244
|
+
welcome.resetAll() // clear all seen contacts
|
|
245
|
+
welcome.hasGreeted(jid) // check if contact was already greeted → boolean
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
<br />
|
|
249
|
+
|
|
250
|
+
**Full config reference:**
|
|
251
|
+
|
|
252
|
+
| Option | Type | Default | Description |
|
|
253
|
+
|--------|------|---------|-------------|
|
|
254
|
+
| `greeting` | `string` | `'👋 Welcome!...'` | Body text of the welcome message |
|
|
255
|
+
| `footer` | `string` | `'Powered by @crysnovax/bailey'` | Footer text |
|
|
256
|
+
| `buttonText` | `string` | `'📋 Choose an option'` | List button label |
|
|
257
|
+
| `sectionTitle` | `string` | `'How can we help?'` | Section header in the list |
|
|
258
|
+
| `faqs` | `Array` | 4 default items | `{ id, title, description }` objects |
|
|
259
|
+
| `typingDelayMs` | `number` | `1200` | Typing indicator duration before greeting |
|
|
260
|
+
| `persistPath` | `string\|null` | `null` | JSON file path to persist seen JIDs |
|
|
261
|
+
| `ignoreGroups` | `boolean` | `true` | Skip group chats |
|
|
262
|
+
| `ignoreNewsletter` | `boolean` | `true` | Skip newsletter messages |
|
|
263
|
+
| `ignoreBroadcast` | `boolean` | `true` | Skip broadcast messages |
|
|
264
|
+
| `onGreet` | `async fn` | `null` | Called after greeting is sent |
|
|
265
|
+
| `onFaqReply` | `async fn` | `null` | Called when user selects a FAQ option |
|
|
266
|
+
|
|
267
|
+
<br />
|
|
268
|
+
<img src="https://media.giphy.com/media/W5eoZHPpUx9sapR0eu/giphy.gif" width="28" />
|
|
269
|
+
</h2>
|
|
270
|
+
|
|
271
|
+
<p align="center">
|
|
272
|
+
Live Meta AI-style reasoning feed — each step visibly completes in real time,<br/>
|
|
273
|
+
then the final rich message lands clean. <b>No "edited" badge. Ever.</b>
|
|
274
|
+
</p>
|
|
275
|
+
|
|
276
|
+
<br />
|
|
277
|
+
|
|
278
|
+
**`replayPlanning`** — full live flow: all steps IN_PROGRESS → each flips DONE → delete → final message.
|
|
279
|
+
|
|
280
|
+
```js
|
|
281
|
+
import { replayPlanning, mixedSteps } from '@crysnovax/bailey'
|
|
282
|
+
|
|
283
|
+
await replayPlanning(
|
|
284
|
+
sock, jid,
|
|
285
|
+
|
|
286
|
+
// Steps — status is managed automatically, don't pass it
|
|
287
|
+
mixedSteps([
|
|
288
|
+
{ title: 'Understanding your question…', type: 'reasoning' },
|
|
289
|
+
{ title: 'Searching for data…', type: 'search' },
|
|
290
|
+
{ title: 'Writing the answer…' }
|
|
291
|
+
]),
|
|
292
|
+
|
|
293
|
+
// Final rich message — any richResponse content
|
|
294
|
+
{ code: 'const answer = 42', language: 'javascript' },
|
|
295
|
+
|
|
296
|
+
// Options
|
|
297
|
+
{
|
|
298
|
+
description: 'Thinking…', // label on the bubble
|
|
299
|
+
stepDelayMs: 900, // ms between each step completing
|
|
300
|
+
finalPauseMs: 600, // ms to hold after all steps done
|
|
301
|
+
}
|
|
302
|
+
)
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
<br />
|
|
306
|
+
|
|
307
|
+
**Step type helpers** — each renders a different visual in the Meta bubble.
|
|
308
|
+
|
|
309
|
+
```js
|
|
310
|
+
import {
|
|
311
|
+
buildReasoningSteps, // isReasoning: true — "thinking" visual
|
|
312
|
+
buildSearchSteps, // isEnhancedSearch: true — "searching" visual
|
|
313
|
+
mixedSteps, // mix any combination
|
|
314
|
+
buildSteps // plain steps (from meta-compositing)
|
|
315
|
+
} from '@crysnovax/bailey'
|
|
316
|
+
|
|
317
|
+
// All reasoning
|
|
318
|
+
buildReasoningSteps(['Analyzing the problem…', 'Checking edge cases…'])
|
|
319
|
+
|
|
320
|
+
// All search
|
|
321
|
+
buildSearchSteps(['Searching the web…', 'Reading top results…'])
|
|
322
|
+
|
|
323
|
+
// Mixed — most realistic Meta AI look
|
|
324
|
+
mixedSteps([
|
|
325
|
+
{ title: 'Reading your message…', type: 'reasoning' },
|
|
326
|
+
{ title: 'Searching sources…', type: 'search' },
|
|
327
|
+
{ title: 'Composing response…' }
|
|
328
|
+
])
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
<br />
|
|
332
|
+
|
|
333
|
+
**`replayPlanningOnly`** — run the animation without sending a final message. You control what comes next.
|
|
334
|
+
|
|
335
|
+
```js
|
|
336
|
+
import { replayPlanningOnly, buildSearchSteps } from '@crysnovax/bailey'
|
|
337
|
+
|
|
338
|
+
await replayPlanningOnly(sock, jid,
|
|
339
|
+
buildSearchSteps(['Looking up prices…', 'Comparing results…']),
|
|
340
|
+
{ stepDelayMs: 1200 }
|
|
341
|
+
)
|
|
342
|
+
|
|
343
|
+
// Send whatever you want after — no badge, no trace
|
|
344
|
+
await sock.sendMessage(jid, { text: 'Here are the results!' })
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
<br />
|
|
348
|
+
|
|
349
|
+
**Options reference**
|
|
350
|
+
|
|
351
|
+
| Option | Type | Default | Description |
|
|
352
|
+
|--------|------|---------|-------------|
|
|
353
|
+
| `description` | `string` | `'Thinking…'` | Top label on the indicator bubble |
|
|
354
|
+
| `placeholderText` | `string` | `''` | Body text shown in bubble while steps run |
|
|
355
|
+
| `stepDelayMs` | `number` | `900` | Ms between each step flipping to DONE |
|
|
356
|
+
| `finalPauseMs` | `number` | `600` | Ms to hold after all steps complete before cleanup |
|
|
357
|
+
| `abortOnDisconnect` | `boolean` | `true` | Stops the loop cleanly if socket closes mid-replay |
|
|
358
|
+
| `sendOptions` | `object` | `{}` | Extra options passed to the final `sendMessage` call |
|
|
359
|
+
|
|
360
|
+
<br />
|
|
361
|
+
|
|
362
|
+
<h2 align="center">
|
|
363
|
+
<img src="https://media.giphy.com/media/W5eoZHPpUx9sapR0eu/giphy.gif" width="28" />
|
|
364
|
+
Meta Compositing & Meta Typing
|
|
365
|
+
<img src="https://media.giphy.com/media/W5eoZHPpUx9sapR0eu/giphy.gif" width="28" />
|
|
366
|
+
</h2>
|
|
367
|
+
|
|
368
|
+
<p align="center">
|
|
369
|
+
Send rich messages with a Meta AI-style thinking indicator — no <b>"edited"</b> badge, ever.<br/>
|
|
370
|
+
The placeholder shows, then silently deletes, then the final message lands clean.
|
|
371
|
+
</p>
|
|
372
|
+
|
|
373
|
+
<br />
|
|
374
|
+
|
|
375
|
+
**`metaTyping`** — show the thinking indicator only. You control what happens next.
|
|
376
|
+
|
|
377
|
+
```js
|
|
378
|
+
import { metaTyping, buildSteps, PlanningStepStatus } from '@crysnovax/bailey'
|
|
379
|
+
|
|
380
|
+
const placeholder = await metaTyping(sock, jid, {
|
|
381
|
+
description: 'Thinking…',
|
|
382
|
+
steps: buildSteps(['Reading your message…', 'Writing response…'])
|
|
383
|
+
})
|
|
384
|
+
|
|
385
|
+
// Delete it yourself whenever ready
|
|
386
|
+
await sock.sendMessage(jid, { delete: placeholder.key })
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
<br />
|
|
390
|
+
|
|
391
|
+
**`sendMetaComposited`** — full flow: indicator → auto-delete → clean final message.
|
|
392
|
+
|
|
393
|
+
Works with every rich content type: `code`, `table`, `text`, `expressions` (LaTeX), `items` (reels carousel), or the full `richResponse` array.
|
|
394
|
+
|
|
395
|
+
```js
|
|
396
|
+
import { sendMetaComposited, PlanningStepStatus } from '@crysnovax/bailey'
|
|
397
|
+
|
|
398
|
+
// With a code block
|
|
399
|
+
await sendMetaComposited(sock, jid,
|
|
400
|
+
{ code: 'const x = 1 + 1', language: 'javascript' },
|
|
401
|
+
{
|
|
402
|
+
thinkingMs: 3000,
|
|
403
|
+
description: 'Analyzing…',
|
|
404
|
+
steps: [
|
|
405
|
+
{ title: 'Reading context…', status: PlanningStepStatus.DONE },
|
|
406
|
+
{ title: 'Writing code…', status: PlanningStepStatus.IN_PROGRESS }
|
|
407
|
+
]
|
|
408
|
+
}
|
|
409
|
+
)
|
|
410
|
+
|
|
411
|
+
// With a table
|
|
412
|
+
await sendMetaComposited(sock, jid,
|
|
413
|
+
{
|
|
414
|
+
title: 'Comparison',
|
|
415
|
+
table: [
|
|
416
|
+
['Feature', 'Baileys', 'Crysnovax'],
|
|
417
|
+
['Rich Messages', '❌', '✅'],
|
|
418
|
+
['Meta Compositing', '❌', '✅'],
|
|
419
|
+
['Code Blocks', '❌', '✅']
|
|
420
|
+
]
|
|
421
|
+
},
|
|
422
|
+
{ thinkingMs: 2500, description: 'Building table…' }
|
|
423
|
+
)
|
|
424
|
+
|
|
425
|
+
// With plain richResponse array (mixed content)
|
|
426
|
+
await sendMetaComposited(sock, jid,
|
|
427
|
+
{
|
|
428
|
+
richResponse: [
|
|
429
|
+
{ text: 'Here is your result:' },
|
|
430
|
+
{ code: 'console.log("hello")', language: 'javascript' },
|
|
431
|
+
{ text: 'Run it with `node index.js`' }
|
|
432
|
+
]
|
|
433
|
+
},
|
|
434
|
+
{ thinkingMs: 2000 }
|
|
435
|
+
)
|
|
436
|
+
```
|
|
437
|
+
|
|
438
|
+
<br />
|
|
439
|
+
|
|
440
|
+
**Options reference**
|
|
441
|
+
|
|
442
|
+
| Option | Type | Default | Description |
|
|
443
|
+
|--------|------|---------|-------------|
|
|
444
|
+
| `thinkingMs` | `number` | `2000` | How long the indicator shows before auto-delete |
|
|
445
|
+
| `description` | `string` | `'Thinking…'` | Top-level label on the indicator bubble |
|
|
446
|
+
| `steps` | `Array` | `[]` | Planning steps — use `buildSteps()` for quick setup |
|
|
447
|
+
| `placeholderText` | `string` | `''` | Optional body text shown while loading |
|
|
448
|
+
| `sendOptions` | `object` | `{}` | Extra options passed to the final `sendMessage` call |
|
|
449
|
+
|
|
450
|
+
<br />
|
|
451
|
+
|
|
452
|
+
**`buildSteps` helper** — turn plain strings into a steps array instantly.
|
|
453
|
+
|
|
454
|
+
```js
|
|
455
|
+
import { buildSteps, PlanningStepStatus } from '@crysnovax/bailey'
|
|
456
|
+
|
|
457
|
+
buildSteps(['Searching…', 'Reading sources…', 'Writing response…'])
|
|
458
|
+
// all IN_PROGRESS by default
|
|
459
|
+
|
|
460
|
+
buildSteps(['Done step'], PlanningStepStatus.DONE)
|
|
461
|
+
```
|
|
462
|
+
|
|
463
|
+
<br />
|
|
464
|
+
|
|
465
|
+
<div align="center">
|
|
466
|
+
<img src="https://capsule-render.vercel.app/api?type=waving&color=10b981&height=120§ion=footer" width="100%" />
|
|
467
|
+
</div>
|
package/WAProto/V
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|