ishumdz-bail 1.0.8 → 1.0.10
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 +259 -873
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,992 +1,378 @@
|
|
|
1
1
|
<div align="center">
|
|
2
|
-
<img src="https://capsule-render.vercel.app/api?type=waving&height=220&color=0:ff6b6b,40:f06595,100:845ef7&text=ishumdz-bail&fontAlignY=40&fontSize=44&fontColor=ffffff&desc=Stable%20WhatsApp%20Web%20API%20Fork%20for%20Production%20Bots&descAlignY=60&descSize=16" alt="Header Banner" />
|
|
3
2
|
|
|
4
|
-
|
|
3
|
+
```
|
|
4
|
+
╔═══════════════════════════════════════════════════════════════════════════╗
|
|
5
|
+
║ 📱 MAIN FEATURES ║
|
|
6
|
+
╠═══════════════════════════════════════════════════════════════════════════╣
|
|
7
|
+
║ ║
|
|
8
|
+
║ ┌─────────────────────────────────────────────────────────────────────┐ ║
|
|
9
|
+
║ │ 🎮 GAMES │ 📞 VOIP CALLER │ ⚡ PRO METHODS │ ║
|
|
10
|
+
║ │ ├─ Blackjack │ ├─ Auto Answer │ ├─ sendPoll │ ║
|
|
11
|
+
║ │ ├─ Slots │ ├─ Audio Playback │ ├─ sendPollVote │ ║
|
|
12
|
+
║ │ ├─ Dice │ └─ VoipClient │ ├─ editMessage │ ║
|
|
13
|
+
║ │ ├─ Coin Flip │ │ ├─ deleteMessage │ ║
|
|
14
|
+
║ │ ├─ Roulette │ 📊 POLLS │ ├─ pinMessage │ ║
|
|
15
|
+
║ │ ├─ Mines │ ├─ Create Poll │ ├─ starMessage │ ║
|
|
16
|
+
║ │ ├─ Trivia │ ├─ Vote Poll │ ├─ reactMessage │ ║
|
|
17
|
+
║ │ └─ RPS │ └─ Get Results │ ├─ sendPresence │ ║
|
|
18
|
+
║ └─────────────────────────────────────────────────────────────────────┘ ║
|
|
19
|
+
║ ║
|
|
20
|
+
║ ┌─────────────────────────────────────────────────────────────────────┐ ║
|
|
21
|
+
║ │ 📢 NEWSLETTER │ 🟢 STATUS │ 💬 CHAT │ ║
|
|
22
|
+
║ │ ├─ channelVote │ ├─ sendText │ ├─ editMessage │ ║
|
|
23
|
+
║ │ ├─ newsletterReact │ ├─ sendMedia │ ├─ deleteMessage │ ║
|
|
24
|
+
║ │ ├─ getMessages │ ├─ readStatus │ ├─ pinMessage │ ║
|
|
25
|
+
║ │ ├─ searchChannels │ └─ reactStatus │ ├─ unpinMessage │ ║
|
|
26
|
+
║ │ └─ listChannels │ │ ├─ starMessage │ ║
|
|
27
|
+
║ └─────────────────────────────────────────────────────────────────────┘ ║
|
|
28
|
+
║ ║
|
|
29
|
+
║ ┌─────────────────────────────────────────────────────────────────────┐ ║
|
|
30
|
+
║ │ 👥 GROUPS │ 👤 PROFILE │ 📰 MEDIA │ ║
|
|
31
|
+
║ │ ├─ Get Invite Info │ ├─ checkNumber │ ├─ Newsletter Paths │ ║
|
|
32
|
+
║ │ ├─ Join via Invite │ ├─ setBio │ ├─ Image Upload │ ║
|
|
33
|
+
║ │ ├─ Set Announcement │ ├─ updateName │ ├─ Video Upload │ ║
|
|
34
|
+
║ │ ├─ Set Locked │ ├─ setProfilePic │ ├─ Audio Upload │ ║
|
|
35
|
+
║ │ ├─ Request List │ ├─ removeProfilePic │ ├─ Document Upload │ ║
|
|
36
|
+
║ │ ├─ Approve │ └─ rejectCall │ └─ Sticker Upload │ ║
|
|
37
|
+
║ │ └─ Reject │ │ │ ║
|
|
38
|
+
║ └─────────────────────────────────────────────────────────────────────┘ ║
|
|
39
|
+
║ ║
|
|
40
|
+
║ ✅ No Browser Required ✅ Multi-Device ✅ WebSocket Based ║
|
|
41
|
+
║ ✅ Active Maintenance ✅ MIT License ✅ Full API Coverage ║
|
|
42
|
+
║ ║
|
|
43
|
+
╚═══════════════════════════════════════════════════════════════════════════╝
|
|
44
|
+
```
|
|
5
45
|
|
|
6
|
-
|
|
7
|
-
<a href="https://ishanx-pro.site.je">
|
|
8
|
-
<kbd>
|
|
9
|
-
<img src="https://i.postimg.cc/9Q6q2Pv6/IMG-20260925-WA4965.jpg" alt="WhatsApp Baileys 2026" width="720" />
|
|
10
|
-
</kbd>
|
|
11
|
-
</a>
|
|
46
|
+
<br/>
|
|
12
47
|
|
|
13
|
-
|
|
48
|
+
```
|
|
49
|
+
██╗ ██╗██████╗ █████╗ ███████╗████████╗
|
|
50
|
+
██║ ██║██╔══██╗██╔══██╗██╔════╝╚══██╔══╝
|
|
51
|
+
███████║██████╔╝███████║███████╗ ██║
|
|
52
|
+
██╔══██║██╔══██╗██╔══██║╚════██║ ██║
|
|
53
|
+
██║ ██║██████╔╝██║ ██║███████║ ██║
|
|
54
|
+
╚═╝ ╚═╝╚═════╝ ╚═╝ ╚═╝╚══════╝ ╚═╝
|
|
14
55
|
|
|
56
|
+
WhatsApp Web API Fork
|
|
57
|
+
By Lovely ❤️
|
|
58
|
+
```
|
|
15
59
|
|
|
16
|
-
|
|
60
|
+
<img src="https://i.postimg.cc/9Q6q2Pv6/IMG-20260925-WA4965.jpg" alt="ishumdz-bail" width="700" />
|
|
17
61
|
|
|
18
|
-
<
|
|
19
|
-
<img src="https://img.shields.io/badge/Node.js-%3E%3D20-339933?style=for-the-badge&logo=nodedotjs&logoColor=white" />
|
|
20
|
-
<img src="https://img.shields.io/badge/WhatsApp-25D366?style=for-the-badge&logo=whatsapp&logoColor=white" />
|
|
21
|
-
<img src="https://img.shields.io/badge/WebSocket-010101?style=for-the-badge&logo=socketdotio&logoColor=white" />
|
|
22
|
-
<img src="https://img.shields.io/badge/Open%20Source-FF4500?style=for-the-badge&logo=github&logoColor=white" />
|
|
23
|
-
<img src="https://img.shields.io/badge/license-MIT-blue?style=for-the-badge" />
|
|
24
|
-
</p>
|
|
62
|
+
<br/>
|
|
25
63
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
64
|
+
[](https://www.npmjs.com/package/ishumdz-bail)
|
|
65
|
+
[](https://github.com/lovelyofficial/ishumdz-bail)
|
|
66
|
+
[](https://nodejs.org)
|
|
67
|
+
[](LICENSE)
|
|
68
|
+
[](https://whatsapp.com)
|
|
30
69
|
|
|
31
70
|
**Open-source WhatsApp automation library — no browser required.**
|
|
32
71
|
Built on WebSocket for speed, stability, and full multi-device support.
|
|
33
72
|
|
|
34
|
-
<br/>
|
|
35
|
-
|
|
36
|
-
[Installation](#-getting-started) • [Features](#-main-features) • [Stability](#-stability--disconnect-handling) • [Website](https://ishanx-pro.site.je) • [WhatsApp Channel](https://shyracore.indevs.in)
|
|
37
|
-
|
|
38
73
|
</div>
|
|
39
74
|
|
|
40
75
|
---
|
|
41
76
|
|
|
42
|
-
##
|
|
43
|
-
|
|
44
|
-
**ishumdz-bail** (`ishumdz-bail`) is a powerful, open-source WhatsApp Web library built on top of the Baileys protocol stack — extended with features not found in any other public fork. It connects directly to WhatsApp's multi-device WebSocket protocol. No Selenium, no Puppeteer, no browser overhead.
|
|
45
|
-
|
|
46
|
-
> ⚡ **Node.js ≥ 20 required.**
|
|
47
|
-
|
|
48
|
-
---
|
|
49
|
-
|
|
50
|
-
## 🚀 Getting Started
|
|
77
|
+
## 🚀 Installation
|
|
51
78
|
|
|
52
79
|
```bash
|
|
53
80
|
npm install ishumdz-bail
|
|
54
81
|
```
|
|
55
82
|
|
|
56
|
-
```javascript
|
|
57
|
-
import { makeWASocket, useMultiFileAuthState } from 'ishumdz-bail'
|
|
58
|
-
|
|
59
|
-
const { state, saveCreds } = await useMultiFileAuthState('auth_info')
|
|
60
|
-
const sock = makeWASocket({
|
|
61
|
-
auth: state,
|
|
62
|
-
syncFullHistory: false, // skip history sync — bot works immediately
|
|
63
|
-
aiLabel: true, // stamp messages with AI bot marker (default: true)
|
|
64
|
-
})
|
|
65
|
-
|
|
66
|
-
sock.ev.on('creds.update', saveCreds)
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
---
|
|
70
|
-
|
|
71
|
-
## 🧩 Main Features
|
|
72
|
-
|
|
73
|
-
| Feature | Description |
|
|
74
|
-
|---|---|
|
|
75
|
-
| 💬 **Rich Response (GenAI Bubble)** | Send Meta AI-style messages: markdown, code blocks, tables, LaTeX, maps, inline images, HTML — rendered natively as GenAI bubble in WA client |
|
|
76
|
-
| 🚫 **4-Factor Ban Checker** | Detect ban status via 4 independent signals: live registry, public send-page, identity-key probe, device-count signature |
|
|
77
|
-
| 🆔 **Username Socket (w:mex)** | Full WA username API: check availability, set, delete, pin, find by username, fetch recommendations — via WhatsApp's internal Pando/MEX GraphQL protocol |
|
|
78
|
-
| 🏘️ **Communities Socket** | Full community management: create, link/unlink groups, manage participants, invite codes, ephemeral toggle, approval mode |
|
|
79
|
-
| 🔕 **noSelfSync** | Skip syncing outgoing messages to your own other devices — reduces noise and bandwidth. Includes silent-drop guard (throws 421 instead of pretending the send succeeded) |
|
|
80
|
-
| ⚙️ **Rust-powered Crypto** | `md5`, `hkdf`, LT-Hash anti-tampering offloaded to `whatsapp-rust-bridge` native module for raw speed |
|
|
81
|
-
| 🗂️ **LID Mapping Store** | Persistent LID ↔ phone-number bi-directional cache with LRU eviction and in-flight dedup — prevents duplicate USync lookups |
|
|
82
|
-
| 🔐 **Pre-Key Manager** | Concurrency-safe Signal pre-key operations via per-key-type PQueue — no race conditions on key updates/deletions |
|
|
83
|
-
| 🔄 **Classify Disconnect** | Maps every WA disconnect code to `{ category, shouldReconnect, backoffMs }` — properly handles code 515 (restartRequired) as recoverable, not fatal |
|
|
84
|
-
| ⏱️ **Rate Limiter** | Anti-spam pacing calculator: enforces per-minute/hour/day caps, burst allowance, new-chat delays, identical-message dedup |
|
|
85
|
-
| 🖼️ **Album Message** | Send multiple images/videos as a single WA album/grid, with per-item or top-level caption and `gifPlayback` support |
|
|
86
|
-
| 🤖 **AI Label Config** | `aiLabel: true/false` in socket config — controls whether outgoing messages carry the `biz_bot` attribute that WA uses to render the AI icon |
|
|
87
|
-
| 🔎 **USync Username Protocol** | Username resolution baked into USync queries — resolve WA usernames alongside contacts in a single round-trip |
|
|
88
|
-
| 📥 **Offline Node Processor** | Batch-processes pending stanzas received while offline, preventing message loss on reconnect |
|
|
89
|
-
| 🔑 **Identity Change Handler** | Dedicated handler for Signal identity key changes — prevents session corruption when a contact re-registers |
|
|
90
|
-
| 📣 **Newsletter/Channel Media Upload** | Full support for uploading images, videos, audio, stickers to channels using correct `/newsletter/newsletter-*` paths |
|
|
91
|
-
| 😀 **Newsletter Reactions** | React to channel messages with emojis, track votes, and manage newsletter engagement |
|
|
92
|
-
| 📊 **Poll Voting** | Create polls, track encrypted votes, display results, and support multiple selection polls |
|
|
93
|
-
| 🎮 **Built-in Games** | 8 games: Blackjack, Slots, Dice, Coin Flip, Roulette, Mines, Trivia, Rock Paper Scissors |
|
|
94
|
-
| 📞 **VoIP Caller** | Answer incoming calls with audio playback using WASM VoIP engine |
|
|
95
|
-
| ⚡ **Pro Methods** | 34 convenience methods: Polls, Newsletter, Status, Chat, Groups, Profile |
|
|
96
|
-
|
|
97
|
-
---
|
|
98
|
-
|
|
99
|
-
## 📞 VoIP Caller (Call Answer + Audio)
|
|
100
|
-
|
|
101
|
-
Answer incoming WhatsApp calls and play audio automatically:
|
|
102
|
-
|
|
103
|
-
```javascript
|
|
104
|
-
const { makeWASocket, enableCallAutoAnswer } = require('ishumdz-bail');
|
|
105
|
-
|
|
106
|
-
const sock = makeWASocket({ auth: state });
|
|
107
|
-
|
|
108
|
-
// Enable auto-answer with audio playback
|
|
109
|
-
sock.enableCallAutoAnswer({
|
|
110
|
-
audio: './welcome.wav', // Audio file to play (MP3/WAV)
|
|
111
|
-
autoAnswer: true, // Auto-answer incoming calls
|
|
112
|
-
answerDelayMs: 200, // Delay before answering
|
|
113
|
-
durationMs: 60000, // Max call duration (60s)
|
|
114
|
-
loop: true, // Loop audio
|
|
115
|
-
onCall: (call) => {}, // Callback on incoming call
|
|
116
|
-
onAnswer: (call) => {}, // Callback when answered
|
|
117
|
-
onEnd: (call, reason) => {} // Callback when ended
|
|
118
|
-
});
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
**Manual call handling:**
|
|
122
|
-
```javascript
|
|
123
|
-
sock.ev.on('call', async ([call]) => {
|
|
124
|
-
if (call.status === 'offer') {
|
|
125
|
-
// Reject call
|
|
126
|
-
await sock.rejectCall(call.id, call.from);
|
|
127
|
-
|
|
128
|
-
// Or accept with VoIP client
|
|
129
|
-
const voipClient = getActiveVoipClient();
|
|
130
|
-
if (voipClient) {
|
|
131
|
-
const activeCall = voipClient.activeCall;
|
|
132
|
-
activeCall.accept('./audio.wav');
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
});
|
|
136
|
-
```
|
|
137
|
-
|
|
138
83
|
---
|
|
139
84
|
|
|
140
|
-
## ⚡
|
|
141
|
-
|
|
142
|
-
34 convenience methods attached to socket via `attachProMethods()`:
|
|
85
|
+
## ⚡ Quick Start
|
|
143
86
|
|
|
144
87
|
```javascript
|
|
145
|
-
const { makeWASocket, attachProMethods } = require('ishumdz-bail');
|
|
88
|
+
const { makeWASocket, useMultiFileAuthState, attachProMethods } = require('ishumdz-bail');
|
|
146
89
|
|
|
147
|
-
const
|
|
148
|
-
attachProMethods(sock); // Attach all Pro methods
|
|
149
|
-
```
|
|
90
|
+
const { state, saveCreds } = await useMultiFileAuthState('auth_info');
|
|
150
91
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
await sock.sendPoll(jid, {
|
|
156
|
-
name: 'What is your favorite color?',
|
|
157
|
-
values: ['Red', 'Blue', 'Green', 'Yellow'],
|
|
158
|
-
selectableCount: 1
|
|
92
|
+
const sock = makeWASocket({
|
|
93
|
+
auth: state,
|
|
94
|
+
syncFullHistory: false,
|
|
95
|
+
aiLabel: true,
|
|
159
96
|
});
|
|
160
97
|
|
|
161
|
-
|
|
162
|
-
await sock.sendPollVote(jid, pollMessage, ['Red']);
|
|
98
|
+
attachProMethods(sock);
|
|
163
99
|
|
|
164
|
-
|
|
165
|
-
const votes = sock.getAggregatePollVotes(pollMessage);
|
|
166
|
-
```
|
|
167
|
-
|
|
168
|
-
### 📢 Newsletter/Channel Pro
|
|
169
|
-
|
|
170
|
-
```javascript
|
|
171
|
-
// Smart channel poll vote (auto-resolves links, IDs)
|
|
172
|
-
await sock.channelVote('https://whatsapp.com/channel/xxx/123', 1);
|
|
173
|
-
|
|
174
|
-
// React to channel post
|
|
175
|
-
await sock.newsletterReact(channelJid, serverId, '👍');
|
|
176
|
-
|
|
177
|
-
// Get channel messages (decoded)
|
|
178
|
-
const messages = await sock.newsletterGetMessages(channelJid, 50);
|
|
179
|
-
|
|
180
|
-
// Search channels
|
|
181
|
-
const results = await sock.newsletterSearch('technology');
|
|
182
|
-
|
|
183
|
-
// List followed channels
|
|
184
|
-
const channels = await sock.newsletterList();
|
|
185
|
-
```
|
|
186
|
-
|
|
187
|
-
### 🟢 Status/Stories Pro
|
|
188
|
-
|
|
189
|
-
```javascript
|
|
190
|
-
// Send text status
|
|
191
|
-
await sock.sendStatusText('Hello World!', {
|
|
192
|
-
backgroundColor: '#25D366',
|
|
193
|
-
font: 1
|
|
194
|
-
});
|
|
100
|
+
sock.ev.on('creds.update', saveCreds);
|
|
195
101
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
102
|
+
sock.ev.on('connection.update', ({ connection }) => {
|
|
103
|
+
if (connection === 'open') {
|
|
104
|
+
console.log('✅ Connected!');
|
|
105
|
+
}
|
|
200
106
|
});
|
|
201
|
-
|
|
202
|
-
// React to status
|
|
203
|
-
await sock.reactStatus(statusKey, '❤️');
|
|
204
|
-
```
|
|
205
|
-
|
|
206
|
-
### 💬 Chat Pro
|
|
207
|
-
|
|
208
|
-
```javascript
|
|
209
|
-
// Edit a message
|
|
210
|
-
await sock.editMessage(jid, messageKey, 'Updated text!');
|
|
211
|
-
|
|
212
|
-
// Delete a message
|
|
213
|
-
await sock.deleteMessage(jid, messageKey);
|
|
214
|
-
|
|
215
|
-
// Pin a message (24h, 7d, or 30d)
|
|
216
|
-
await sock.pinMessage(jid, messageKey, 86400); // 24 hours
|
|
217
|
-
|
|
218
|
-
// Star/unstar a message
|
|
219
|
-
await sock.starMessage(jid, messageKey, true);
|
|
220
|
-
|
|
221
|
-
// React to a message
|
|
222
|
-
await sock.reactMessage(jid, messageKey, '😂');
|
|
223
|
-
|
|
224
|
-
// Send presence (typing indicator)
|
|
225
|
-
await sock.sendPresence(jid, 'composing');
|
|
226
|
-
|
|
227
|
-
// Quick reply with quote
|
|
228
|
-
await sock.reply(jid, 'This is a reply!', quotedMessage);
|
|
229
|
-
```
|
|
230
|
-
|
|
231
|
-
### 👥 Groups Pro
|
|
232
|
-
|
|
233
|
-
```javascript
|
|
234
|
-
// Get group info from invite link
|
|
235
|
-
const info = await sock.groupGetInviteInfo('https://chat.whatsapp.com/xxx');
|
|
236
|
-
|
|
237
|
-
// Join group via invite
|
|
238
|
-
await sock.groupJoinViaInvite('https://chat.whatsapp.com/xxx');
|
|
239
|
-
|
|
240
|
-
// Set announcement mode (admin only)
|
|
241
|
-
await sock.groupSetAnnouncement(groupJid, true);
|
|
242
|
-
|
|
243
|
-
// Set locked mode (admin only)
|
|
244
|
-
await sock.groupSetLocked(groupJid, true);
|
|
245
|
-
|
|
246
|
-
// Manage join requests
|
|
247
|
-
const requests = await sock.groupRequestParticipantsList(groupJid);
|
|
248
|
-
await sock.groupApproveParticipants(groupJid, [participant1, participant2]);
|
|
249
|
-
await sock.groupRejectParticipants(groupJid, [participant3]);
|
|
250
|
-
```
|
|
251
|
-
|
|
252
|
-
### 👤 Profile Pro
|
|
253
|
-
|
|
254
|
-
```javascript
|
|
255
|
-
// Check if number exists on WhatsApp
|
|
256
|
-
const result = await sock.checkNumber('1234567890');
|
|
257
|
-
console.log(result.exists); // true/false
|
|
258
|
-
|
|
259
|
-
// Update bio
|
|
260
|
-
await sock.setBio('Hello, I am a bot!');
|
|
261
|
-
|
|
262
|
-
// Update display name
|
|
263
|
-
await sock.updateProfileName('My Bot');
|
|
264
|
-
|
|
265
|
-
// Set profile picture
|
|
266
|
-
await sock.setProfilePicture(jid, './avatar.jpg');
|
|
267
|
-
|
|
268
|
-
// Remove profile picture
|
|
269
|
-
await sock.removeProfilePicture(jid);
|
|
270
107
|
```
|
|
271
108
|
|
|
272
109
|
---
|
|
273
110
|
|
|
274
|
-
## 🎮
|
|
275
|
-
|
|
276
|
-
8 fun games for your WhatsApp bot:
|
|
111
|
+
## 🎮 Games
|
|
277
112
|
|
|
278
113
|
```javascript
|
|
279
114
|
const { blackjack, slotMachine, diceGame, coinFlip, roulette, rps, trivia, createMines } = require('ishumdz-bail');
|
|
280
115
|
|
|
281
|
-
// Blackjack
|
|
282
|
-
const
|
|
283
|
-
//
|
|
116
|
+
// 🃏 Blackjack
|
|
117
|
+
const bj = blackjack('start', [], [], 100);
|
|
118
|
+
// bj.playerHand, bj.dealerHand, bj.status
|
|
284
119
|
|
|
285
|
-
// Slots
|
|
120
|
+
// 🎰 Slots
|
|
286
121
|
const slots = slotMachine(100);
|
|
287
122
|
// slots.reels, slots.payout
|
|
288
123
|
|
|
289
|
-
// Dice
|
|
290
|
-
const dice = diceGame(100, 'high');
|
|
124
|
+
// 🎲 Dice
|
|
125
|
+
const dice = diceGame(100, 'high');
|
|
291
126
|
// dice.total, dice.dice1, dice.dice2
|
|
292
127
|
|
|
293
|
-
// Coin Flip
|
|
128
|
+
// 🪙 Coin Flip
|
|
294
129
|
const flip = coinFlip(100, 'heads');
|
|
295
130
|
// flip.result, flip.payout
|
|
296
131
|
|
|
297
|
-
// Roulette
|
|
132
|
+
// 🎡 Roulette
|
|
298
133
|
const spin = roulette(100, 'red');
|
|
299
|
-
// spin.number, spin.color
|
|
134
|
+
// spin.number, spin.color
|
|
300
135
|
|
|
301
|
-
// Rock Paper Scissors
|
|
136
|
+
// ✊ Rock Paper Scissors
|
|
302
137
|
const game = rps('rock');
|
|
303
138
|
// game.playerChoice, game.botChoice, game.result
|
|
304
139
|
|
|
305
|
-
// Trivia
|
|
306
|
-
const
|
|
307
|
-
//
|
|
308
|
-
|
|
309
|
-
// Mines
|
|
310
|
-
const mines = createMines(5, 5, 5); // 5x5 grid, 5 mines
|
|
311
|
-
const tile = revealTile(mines, 0, 0); // Reveal tile at (0,0)
|
|
312
|
-
// tile.safe, tile.mine
|
|
313
|
-
const cashout = cashoutMines(mines, 100); // Cash out
|
|
314
|
-
// cashout.payout
|
|
315
|
-
```
|
|
316
|
-
|
|
317
|
-
## 💬 Rich Response (GenAI Bubble)
|
|
318
|
-
|
|
319
|
-
Send messages that render as Meta AI-style bubbles inside WhatsApp. Supports multiple primitives in a single message:
|
|
320
|
-
|
|
321
|
-
```javascript
|
|
322
|
-
// Markdown text
|
|
323
|
-
await sock.sendMessage(jid, {
|
|
324
|
-
richResponse: {
|
|
325
|
-
text: '**Hello** from *ishumdz-bail*',
|
|
326
|
-
responseId: 'optional-uuid'
|
|
327
|
-
}
|
|
328
|
-
})
|
|
329
|
-
|
|
330
|
-
// Code block
|
|
331
|
-
await sock.sendMessage(jid, {
|
|
332
|
-
richResponse: {
|
|
333
|
-
code: 'console.log("hello")',
|
|
334
|
-
language: 'javascript'
|
|
335
|
-
}
|
|
336
|
-
})
|
|
337
|
-
|
|
338
|
-
// Table
|
|
339
|
-
await sock.sendMessage(jid, {
|
|
340
|
-
richResponse: {
|
|
341
|
-
table: {
|
|
342
|
-
rows: [
|
|
343
|
-
['Name', 'Age'],
|
|
344
|
-
['Alice', '25'],
|
|
345
|
-
['Bob', '30']
|
|
346
|
-
]
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
})
|
|
350
|
-
|
|
351
|
-
// HTML (raw HTML rendered in client)
|
|
352
|
-
await sock.sendMessage(jid, {
|
|
353
|
-
richResponse: {
|
|
354
|
-
text: 'fallback',
|
|
355
|
-
html: '<b>bold</b> <a href="https://example.com">link</a>'
|
|
356
|
-
}
|
|
357
|
-
})
|
|
358
|
-
|
|
359
|
-
// LaTeX
|
|
360
|
-
await sock.sendMessage(jid, {
|
|
361
|
-
richResponse: {
|
|
362
|
-
latex: 'E = mc^2'
|
|
363
|
-
}
|
|
364
|
-
})
|
|
365
|
-
|
|
366
|
-
// Map / location
|
|
367
|
-
await sock.sendMessage(jid, {
|
|
368
|
-
richResponse: {
|
|
369
|
-
map: {
|
|
370
|
-
latitude: -6.2,
|
|
371
|
-
longitude: 106.8,
|
|
372
|
-
zoom: 15,
|
|
373
|
-
title: 'Jakarta',
|
|
374
|
-
annotations: []
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
})
|
|
378
|
-
|
|
379
|
-
// Inline image
|
|
380
|
-
await sock.sendMessage(jid, {
|
|
381
|
-
richResponse: {
|
|
382
|
-
imageUrl: 'https://example.com/photo.jpg'
|
|
383
|
-
}
|
|
384
|
-
})
|
|
385
|
-
```
|
|
386
|
-
|
|
387
|
-
**Shortcut methods** (all accept `quoted` and `options`):
|
|
388
|
-
|
|
389
|
-
```javascript
|
|
390
|
-
await sock.sendTable(jid, 'Title', ['H1','H2'], [['A','B']], quoted)
|
|
391
|
-
await sock.sendList(jid, 'Title', ['item1','item2'], quoted)
|
|
392
|
-
await sock.sendCodeBlock(jid, 'print("hello")', quoted, { language: 'python' })
|
|
393
|
-
await sock.sendLatex(jid, quoted, { latex: 'x^2 + y^2 = z^2' })
|
|
394
|
-
await sock.sendRichMessage(jid, submessages, quoted)
|
|
395
|
-
```
|
|
396
|
-
|
|
397
|
-
---
|
|
398
|
-
|
|
399
|
-
## 🖼️ Album Message
|
|
400
|
-
|
|
401
|
-
Send multiple images/videos grouped into a single WA album:
|
|
402
|
-
|
|
403
|
-
```javascript
|
|
404
|
-
await sock.sendMessage(jid, {
|
|
405
|
-
album: [
|
|
406
|
-
{ image: { url: 'https://example.com/a.jpg' } },
|
|
407
|
-
{ image: { url: 'https://example.com/b.jpg' }, caption: 'caption foto kedua' },
|
|
408
|
-
{ video: { url: 'https://example.com/c.mp4' }, gifPlayback: false }
|
|
409
|
-
],
|
|
410
|
-
caption: 'caption ini otomatis ke item pertama'
|
|
411
|
-
})
|
|
412
|
-
```
|
|
413
|
-
|
|
414
|
-
---
|
|
415
|
-
|
|
416
|
-
## 🚫 Ban Checker
|
|
417
|
-
|
|
418
|
-
4-factor ban detection against WhatsApp's own servers — no third-party API:
|
|
419
|
-
|
|
420
|
-
```javascript
|
|
421
|
-
const result = await sock.checkBanStatus('628123456789')
|
|
422
|
-
// or: sock.checkBanStatus('628123456789@s.whatsapp.net')
|
|
423
|
-
|
|
424
|
-
console.log(result)
|
|
425
|
-
// {
|
|
426
|
-
// status: 'ACTIVE' | 'PROFILE_HIDDEN' | 'LIKELY_ACTIVE' | 'BANNED' | 'OFF_WHATSAPP' | 'UNKNOWN',
|
|
427
|
-
// emoji: '🟢' | '🟡' | '🔴' | '❓',
|
|
428
|
-
// confidence: 0..1,
|
|
429
|
-
// deviceCount: number | null,
|
|
430
|
-
// registryExists: boolean | null,
|
|
431
|
-
// pageVisible: boolean | null,
|
|
432
|
-
// profileName: string | null
|
|
433
|
-
// }
|
|
434
|
-
```
|
|
435
|
-
|
|
436
|
-
**Four factors checked:**
|
|
437
|
-
- **Factor A** — Live registry (`sock.onWhatsApp`)
|
|
438
|
-
- **Factor B** — Public send-page title/image probe (`api.whatsapp.com`)
|
|
439
|
-
- **Factor C** — Identity-key device probe via USync (strongest: banned numbers have their keys destroyed)
|
|
440
|
-
- **Factor D** — Device-count signature (2+ = ACTIVE, 1 generic = likely BANNED, 0 = BANNED/OFF_WA)
|
|
140
|
+
// 🧠 Trivia
|
|
141
|
+
const q = trivia(100);
|
|
142
|
+
// q.question, q.options, q.answer
|
|
441
143
|
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
Full WA `@username` API via WhatsApp's internal Pando/MEX GraphQL protocol, query IDs sourced from Java decompile of WA 2.26.17.2:
|
|
447
|
-
|
|
448
|
-
```javascript
|
|
449
|
-
// Check availability
|
|
450
|
-
const res = await sock.checkUsername('myusername')
|
|
451
|
-
// { available: true, username } or { available: false, suggestions: [...] }
|
|
452
|
-
|
|
453
|
-
// Set username
|
|
454
|
-
await sock.setUsername('myusername')
|
|
455
|
-
|
|
456
|
-
// Delete username
|
|
457
|
-
await sock.deleteUsername()
|
|
458
|
-
|
|
459
|
-
// Get your own username
|
|
460
|
-
const mine = await sock.getMyUsername()
|
|
461
|
-
|
|
462
|
-
// Pin/unpin username
|
|
463
|
-
await sock.setUsernamePin(true)
|
|
464
|
-
|
|
465
|
-
// Find user by username
|
|
466
|
-
const user = await sock.findUserByUsername('someuser', pin)
|
|
467
|
-
|
|
468
|
-
// Fetch usernames of your contacts in batch
|
|
469
|
-
const usernames = await sock.fetchContactUsernames('94xxxx@s.whatsapp.net', '628yyy@s.whatsapp.net')
|
|
470
|
-
|
|
471
|
-
// Get username suggestions
|
|
472
|
-
const suggestions = await sock.getUsernameRecommendations()
|
|
473
|
-
```
|
|
474
|
-
|
|
475
|
-
---
|
|
476
|
-
|
|
477
|
-
## 🏘️ Communities Socket
|
|
478
|
-
|
|
479
|
-
```javascript
|
|
480
|
-
// Create community
|
|
481
|
-
const community = await sock.communityCreate('Community Name', 'Description')
|
|
482
|
-
|
|
483
|
-
// Create group inside community
|
|
484
|
-
await sock.communityCreateGroup('Group Name', [jid1, jid2], communityJid)
|
|
485
|
-
|
|
486
|
-
// Link/unlink existing group
|
|
487
|
-
await sock.communityLinkGroup(groupJid, communityJid)
|
|
488
|
-
await sock.communityUnlinkGroup(groupJid, communityJid)
|
|
489
|
-
|
|
490
|
-
// Fetch linked groups
|
|
491
|
-
const groups = await sock.communityFetchLinkedGroups(communityJid)
|
|
492
|
-
|
|
493
|
-
// Manage participants
|
|
494
|
-
await sock.communityParticipantsUpdate(communityJid, [jid1], 'add') // 'add' | 'remove' | 'promote' | 'demote'
|
|
495
|
-
|
|
496
|
-
// Invite code
|
|
497
|
-
const code = await sock.communityInviteCode(communityJid)
|
|
498
|
-
await sock.communityRevokeInvite(communityJid)
|
|
499
|
-
await sock.communityAcceptInvite(code)
|
|
500
|
-
|
|
501
|
-
// Settings
|
|
502
|
-
await sock.communityToggleEphemeral(communityJid, 86400) // seconds
|
|
503
|
-
await sock.communityMemberAddMode(communityJid, 'admin_add')
|
|
504
|
-
await sock.communityJoinApprovalMode(communityJid, 'on')
|
|
505
|
-
await sock.communityUpdateSubject(communityJid, 'New Name')
|
|
506
|
-
await sock.communityUpdateDescription(communityJid, 'New Desc')
|
|
507
|
-
await sock.communityLeave(communityJid)
|
|
508
|
-
```
|
|
509
|
-
|
|
510
|
-
---
|
|
511
|
-
|
|
512
|
-
## 🔕 noSelfSync
|
|
513
|
-
|
|
514
|
-
Skip syncing outgoing messages to your own linked devices. Useful for high-volume bots where sync traffic is unnecessary:
|
|
515
|
-
|
|
516
|
-
```javascript
|
|
517
|
-
await sock.sendMessage(jid, { text: 'hello' }, { noSelfSync: true })
|
|
518
|
-
|
|
519
|
-
// Also supported in all shortcut methods:
|
|
520
|
-
await sock.sendTable(jid, title, headers, rows, quoted, { noSelfSync: true })
|
|
521
|
-
await sock.sendCodeBlock(jid, code, quoted, { noSelfSync: true })
|
|
522
|
-
```
|
|
523
|
-
|
|
524
|
-
> **Safe by design:** if `noSelfSync` would accidentally drop all recipients (e.g. messaging yourself), the guard kicks in and delivers normally. If the other party has zero resolved devices, it throws `Boom 421` instead of silently pretending the message was sent.
|
|
525
|
-
|
|
526
|
-
---
|
|
527
|
-
|
|
528
|
-
## 🔄 Stability & Disconnect Handling
|
|
529
|
-
|
|
530
|
-
ishumdz-bail ships `classifyDisconnect()` — maps every WA status code into an actionable result:
|
|
531
|
-
|
|
532
|
-
```javascript
|
|
533
|
-
import { classifyDisconnect } from 'ishumdz-bail'
|
|
534
|
-
|
|
535
|
-
sock.ev.on('connection.update', ({ connection, lastDisconnect }) => {
|
|
536
|
-
if (connection === 'close') {
|
|
537
|
-
const code = lastDisconnect?.error?.output?.statusCode
|
|
538
|
-
const info = classifyDisconnect(code)
|
|
539
|
-
|
|
540
|
-
console.log(info)
|
|
541
|
-
// {
|
|
542
|
-
// category: 'fatal' | 'recoverable' | 'rate-limited' | 'unknown',
|
|
543
|
-
// shouldReconnect: boolean,
|
|
544
|
-
// backoffMs: number, // ms to wait before reconnecting
|
|
545
|
-
// message: string,
|
|
546
|
-
// code: number
|
|
547
|
-
// }
|
|
548
|
-
|
|
549
|
-
if (info.shouldReconnect) {
|
|
550
|
-
setTimeout(() => reconnect(), info.backoffMs)
|
|
551
|
-
}
|
|
552
|
-
}
|
|
553
|
-
})
|
|
554
|
-
```
|
|
555
|
-
|
|
556
|
-
**Code map:**
|
|
557
|
-
|
|
558
|
-
| Code | Category | Reconnect | Backoff |
|
|
559
|
-
|---|---|---|---|
|
|
560
|
-
| 401, 440 | fatal | ❌ | — |
|
|
561
|
-
| 515 | recoverable | ✅ | 0 ms (immediate) |
|
|
562
|
-
| 405 | fatal | ❌ | — |
|
|
563
|
-
| 408 | recoverable | ✅ | 30 s |
|
|
564
|
-
| 503 | recoverable | ✅ | 5 min |
|
|
565
|
-
| 429 | rate-limited | ✅ | 60 s |
|
|
566
|
-
| 500 | recoverable | ✅ | 5 s |
|
|
567
|
-
| 503 | recoverable | ✅ | 10 s |
|
|
568
|
-
| Graceful close | recoverable | ✅ | 2 s |
|
|
569
|
-
| Unknown | unknown | ✅ | 15 s |
|
|
570
|
-
|
|
571
|
-
> **Important:** Code 515 (`restartRequired`) is WhatsApp's normal post-pairing signal. ishumdz-bail correctly treats it as recoverable with 0 ms backoff — other forks incorrectly mark it as fatal, causing bots to stop after first pair.
|
|
572
|
-
|
|
573
|
-
---
|
|
574
|
-
|
|
575
|
-
## ⏱️ Rate Limiter
|
|
576
|
-
|
|
577
|
-
Anti-ban pacing calculator — wire into your send path before each `sendMessage`:
|
|
578
|
-
|
|
579
|
-
```javascript
|
|
580
|
-
import { RateLimiter } from 'ishumdz-bail'
|
|
581
|
-
|
|
582
|
-
const limiter = new RateLimiter({
|
|
583
|
-
maxPerMinute: 8,
|
|
584
|
-
maxPerHour: 200,
|
|
585
|
-
maxPerDay: 1500,
|
|
586
|
-
minDelayMs: 1500,
|
|
587
|
-
maxDelayMs: 5000,
|
|
588
|
-
newChatDelayMs: 3000,
|
|
589
|
-
maxIdenticalMessages: 3,
|
|
590
|
-
burstAllowance: 3
|
|
591
|
-
})
|
|
592
|
-
|
|
593
|
-
async function safeSend(jid, content) {
|
|
594
|
-
const delay = await limiter.getDelay(jid, content)
|
|
595
|
-
if (delay === -1) throw new Error('Rate limit exceeded — blocked')
|
|
596
|
-
if (delay > 0) await new Promise(r => setTimeout(r, delay))
|
|
597
|
-
await sock.sendMessage(jid, content)
|
|
598
|
-
limiter.record(jid, content)
|
|
599
|
-
}
|
|
144
|
+
// 💣 Mines
|
|
145
|
+
const mines = createMines(5, 5, 5);
|
|
146
|
+
const tile = revealTile(mines, 0, 0);
|
|
147
|
+
const cashout = cashoutMines(mines, 100);
|
|
600
148
|
```
|
|
601
149
|
|
|
602
150
|
---
|
|
603
151
|
|
|
604
|
-
##
|
|
605
|
-
|
|
606
|
-
Every WhatsApp message type is covered:
|
|
607
|
-
|
|
608
|
-
- Text, image, video, audio, document, sticker, GIF/video note (PTV)
|
|
609
|
-
- Location & live location
|
|
610
|
-
- Contact / vCard
|
|
611
|
-
- Poll (create, vote, add option, poll result)
|
|
612
|
-
- Button, list, template, interactive (native flow)
|
|
613
|
-
- Album (multiple media in one message)
|
|
614
|
-
- Event & event invite
|
|
615
|
-
- Group invite, group status, group mention
|
|
616
|
-
- Spoiler (blurred) messages
|
|
617
|
-
- Reaction & edited message
|
|
618
|
-
- View-once media
|
|
619
|
-
- Status/story mention & reply
|
|
620
|
-
- Newsletter / channel messages
|
|
621
|
-
- Payment & payment invite
|
|
622
|
-
- All WhatsApp Business types: product, catalog, order, invoice, business profile
|
|
623
|
-
|
|
624
|
-
<details>
|
|
625
|
-
<summary><b>Example: Album</b></summary>
|
|
152
|
+
## 📞 VoIP Caller
|
|
626
153
|
|
|
627
154
|
```javascript
|
|
628
|
-
|
|
629
|
-
album: [
|
|
630
|
-
{ image: { url: 'https://example.com/1.jpg' } },
|
|
631
|
-
{ video: { url: 'https://example.com/2.mp4' } }
|
|
632
|
-
],
|
|
633
|
-
caption: 'Album caption'
|
|
634
|
-
})
|
|
635
|
-
```
|
|
636
|
-
</details>
|
|
637
|
-
|
|
638
|
-
<details>
|
|
639
|
-
<summary><b>Example: Poll</b></summary>
|
|
155
|
+
const { makeWASocket, enableCallAutoAnswer, getActiveVoipClient } = require('ishumdz-bail');
|
|
640
156
|
|
|
641
|
-
|
|
642
|
-
await sock.sendMessage(jid, {
|
|
643
|
-
poll: {
|
|
644
|
-
name: 'Poll Title',
|
|
645
|
-
values: ['Option A', 'Option B'],
|
|
646
|
-
selectableCount: 1
|
|
647
|
-
}
|
|
648
|
-
})
|
|
649
|
-
```
|
|
650
|
-
</details>
|
|
651
|
-
|
|
652
|
-
<details>
|
|
653
|
-
<summary><b>Example: Spoiler</b></summary>
|
|
654
|
-
|
|
655
|
-
```javascript
|
|
656
|
-
await sock.sendMessage(jid, {
|
|
657
|
-
text: 'Spoiler content',
|
|
658
|
-
spoiler: true
|
|
659
|
-
})
|
|
660
|
-
```
|
|
661
|
-
</details>
|
|
157
|
+
const sock = makeWASocket({ auth: state });
|
|
662
158
|
|
|
663
|
-
|
|
664
|
-
|
|
159
|
+
// Auto-answer calls with audio
|
|
160
|
+
sock.enableCallAutoAnswer({
|
|
161
|
+
audio: './welcome.wav',
|
|
162
|
+
autoAnswer: true,
|
|
163
|
+
answerDelayMs: 200,
|
|
164
|
+
durationMs: 60000,
|
|
165
|
+
loop: true
|
|
166
|
+
});
|
|
665
167
|
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
description: 'Weekly sync',
|
|
671
|
-
location: { degreesLatitude: -6.2, degreesLongitude: 106.8 },
|
|
672
|
-
startTime: Math.floor(Date.now() / 1000) + 3600
|
|
168
|
+
// Manual call handling
|
|
169
|
+
sock.ev.on('call', async ([call]) => {
|
|
170
|
+
if (call.status === 'offer') {
|
|
171
|
+
await sock.rejectCall(call.id, call.from);
|
|
673
172
|
}
|
|
674
|
-
})
|
|
675
|
-
```
|
|
676
|
-
</details>
|
|
677
|
-
|
|
678
|
-
---
|
|
679
|
-
|
|
680
|
-
## 🛠️ Additional Methods
|
|
681
|
-
|
|
682
|
-
```javascript
|
|
683
|
-
// Parse incoming extended/special messages
|
|
684
|
-
sock.ev.on('messages.upsert', ({ messages }) => {
|
|
685
|
-
const extended = sock.parseExtendedMessageContent(messages[0].message)
|
|
686
|
-
if (extended) console.log(extended.type, extended.data)
|
|
687
|
-
})
|
|
688
|
-
|
|
689
|
-
// Business profile
|
|
690
|
-
const profile = await sock.getBusinessProfile(jid)
|
|
691
|
-
await sock.updateBusinessProfile({ description: 'Open 9-5', email: 'hi@example.com', category: 'Retail' })
|
|
692
|
-
|
|
693
|
-
// Get newsletter/channel JID from URL
|
|
694
|
-
await sock.newsletterId('https://whatsapp.com/channel/...')
|
|
695
|
-
|
|
696
|
-
// Refresh media URL for expired messages
|
|
697
|
-
await sock.updateMediaMessage(message)
|
|
173
|
+
});
|
|
698
174
|
```
|
|
699
175
|
|
|
700
176
|
---
|
|
701
177
|
|
|
702
|
-
##
|
|
703
|
-
|
|
704
|
-
Built-in games for your WhatsApp bot! Import from `ishumdz-bail`:
|
|
705
|
-
|
|
706
|
-
```javascript
|
|
707
|
-
import {
|
|
708
|
-
blackjack, slotMachine, diceGame,
|
|
709
|
-
coinFlip, roulette, rps, trivia,
|
|
710
|
-
createMines, revealTile, cashoutMines
|
|
711
|
-
} from 'ishumdz-bail'
|
|
712
|
-
```
|
|
713
|
-
|
|
714
|
-
### 🃏 Blackjack
|
|
715
|
-
|
|
716
|
-
```javascript
|
|
717
|
-
// Start game
|
|
718
|
-
const game = blackjack('start', [], [], 1000)
|
|
719
|
-
await sock.sendMessage(jid, { text: game.message })
|
|
720
|
-
|
|
721
|
-
// Hit (after start)
|
|
722
|
-
const hit = blackjack('hit', game.playerHand, game.dealerHand, 1000)
|
|
723
|
-
|
|
724
|
-
// Stand
|
|
725
|
-
const stand = blackjack('stand', game)
|
|
726
|
-
|
|
727
|
-
// Double
|
|
728
|
-
const dbl = blackjack('double', game)
|
|
729
|
-
```
|
|
730
|
-
|
|
731
|
-
### 🎰 Slot Machine
|
|
178
|
+
## ⚡ Pro Methods
|
|
732
179
|
|
|
733
180
|
```javascript
|
|
734
|
-
const
|
|
735
|
-
await sock.sendMessage(jid, { text: slot.message })
|
|
736
|
-
// 🎰 [🍒] [🍋] [💎] - NO MATCH
|
|
737
|
-
```
|
|
738
|
-
|
|
739
|
-
### 🎲 Dice
|
|
181
|
+
const { makeWASocket, attachProMethods } = require('ishumdz-bail');
|
|
740
182
|
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
await sock.sendMessage(jid, { text: dice.message })
|
|
183
|
+
const sock = makeWASocket({ auth: state });
|
|
184
|
+
attachProMethods(sock); // Attach all 34 Pro methods
|
|
744
185
|
```
|
|
745
186
|
|
|
746
|
-
###
|
|
187
|
+
### 📊 Polls
|
|
747
188
|
|
|
748
189
|
```javascript
|
|
749
|
-
|
|
750
|
-
await sock.
|
|
190
|
+
await sock.sendPoll(jid, { name: 'Vote?', values: ['Yes', 'No'] });
|
|
191
|
+
await sock.sendPollVote(jid, pollMsg, ['Yes']);
|
|
192
|
+
const votes = sock.getAggregatePollVotes(pollMsg);
|
|
751
193
|
```
|
|
752
194
|
|
|
753
|
-
###
|
|
195
|
+
### 📢 Newsletter/Channels
|
|
754
196
|
|
|
755
197
|
```javascript
|
|
756
|
-
|
|
757
|
-
await sock.
|
|
198
|
+
await sock.channelVote('https://whatsapp.com/channel/xxx', 1);
|
|
199
|
+
await sock.newsletterReact(jid, serverId, '👍');
|
|
200
|
+
const msgs = await sock.newsletterGetMessages(jid, 50);
|
|
201
|
+
const results = await sock.newsletterSearch('tech');
|
|
202
|
+
const channels = await sock.newsletterList();
|
|
758
203
|
```
|
|
759
204
|
|
|
760
|
-
###
|
|
205
|
+
### 🟢 Status/Stories
|
|
761
206
|
|
|
762
207
|
```javascript
|
|
763
|
-
|
|
764
|
-
await sock.
|
|
208
|
+
await sock.sendStatusText('Hello!', { backgroundColor: '#25D366' });
|
|
209
|
+
await sock.sendStatusMedia('./photo.jpg', { type: 'image' });
|
|
210
|
+
await sock.reactStatus(key, '❤️');
|
|
765
211
|
```
|
|
766
212
|
|
|
767
|
-
###
|
|
213
|
+
### 💬 Chat
|
|
768
214
|
|
|
769
215
|
```javascript
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
await sock.
|
|
776
|
-
|
|
777
|
-
// Cashout
|
|
778
|
-
const cashout = cashoutMines(game, 100)
|
|
779
|
-
await sock.sendMessage(jid, { text: cashout.message })
|
|
216
|
+
await sock.editMessage(jid, key, 'Updated!');
|
|
217
|
+
await sock.deleteMessage(jid, key);
|
|
218
|
+
await sock.pinMessage(jid, key, 86400);
|
|
219
|
+
await sock.starMessage(jid, key, true);
|
|
220
|
+
await sock.reactMessage(jid, key, '😂');
|
|
221
|
+
await sock.sendPresence(jid, 'composing');
|
|
222
|
+
await sock.reply(jid, 'Reply!', quotedMsg);
|
|
780
223
|
```
|
|
781
224
|
|
|
782
|
-
###
|
|
225
|
+
### 👥 Groups
|
|
783
226
|
|
|
784
227
|
```javascript
|
|
785
|
-
const
|
|
786
|
-
await sock.
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
const
|
|
790
|
-
await sock.
|
|
228
|
+
const info = await sock.groupGetInviteInfo('https://chat.whatsapp.com/xxx');
|
|
229
|
+
await sock.groupJoinViaInvite('https://chat.whatsapp.com/xxx');
|
|
230
|
+
await sock.groupSetAnnouncement(jid, true);
|
|
231
|
+
await sock.groupSetLocked(jid, true);
|
|
232
|
+
const requests = await sock.groupRequestParticipantsList(jid);
|
|
233
|
+
await sock.groupApproveParticipants(jid, [user1]);
|
|
234
|
+
await sock.groupRejectParticipants(jid, [user2]);
|
|
791
235
|
```
|
|
792
236
|
|
|
793
|
-
###
|
|
237
|
+
### 👤 Profile
|
|
794
238
|
|
|
795
239
|
```javascript
|
|
796
|
-
sock.
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
const result = rps(choice)
|
|
803
|
-
await sock.sendMessage(msg.key.remoteJid, { text: result.message })
|
|
804
|
-
}
|
|
805
|
-
|
|
806
|
-
if (text.startsWith('.slot')) {
|
|
807
|
-
const bet = parseInt(text.split(' ')[1]) || 100
|
|
808
|
-
const result = slotMachine(bet)
|
|
809
|
-
await sock.sendMessage(msg.key.remoteJid, { text: result.message })
|
|
810
|
-
}
|
|
811
|
-
|
|
812
|
-
if (text.startsWith('.coinflip')) {
|
|
813
|
-
const choice = text.split(' ')[1] || 'heads'
|
|
814
|
-
const bet = parseInt(text.split(' ')[2]) || 100
|
|
815
|
-
const result = coinFlip(bet, choice)
|
|
816
|
-
await sock.sendMessage(msg.key.remoteJid, { text: result.message })
|
|
817
|
-
}
|
|
818
|
-
})
|
|
240
|
+
const check = await sock.checkNumber('1234567890');
|
|
241
|
+
await sock.setBio('My bot');
|
|
242
|
+
await sock.updateProfileName('Bot Name');
|
|
243
|
+
await sock.setProfilePicture(jid, './avatar.jpg');
|
|
244
|
+
await sock.removeProfilePicture(jid);
|
|
245
|
+
await sock.rejectCall(callId, callFrom);
|
|
819
246
|
```
|
|
820
247
|
|
|
821
248
|
---
|
|
822
249
|
|
|
823
|
-
##
|
|
824
|
-
|
|
825
|
-
Create polls, track votes, and display results.
|
|
826
|
-
|
|
827
|
-
### 🗳️ Create Poll
|
|
250
|
+
## 📰 Newsletter Media Paths
|
|
828
251
|
|
|
829
252
|
```javascript
|
|
830
|
-
|
|
831
|
-
poll: {
|
|
832
|
-
name: 'Best programming language?',
|
|
833
|
-
values: ['JavaScript', 'Python', 'Java', 'Go', 'Rust'],
|
|
834
|
-
selectableCount: 1
|
|
835
|
-
}
|
|
836
|
-
})
|
|
837
|
-
```
|
|
253
|
+
const { NEWSLETTER_MEDIA_PATH_MAP } = require('ishumdz-bail');
|
|
838
254
|
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
### 📢 Announcement Group Poll (Admin Only Voting)
|
|
852
|
-
|
|
853
|
-
```javascript
|
|
854
|
-
await sock.sendMessage(groupJid, {
|
|
855
|
-
poll: {
|
|
856
|
-
name: 'Admin Poll',
|
|
857
|
-
values: ['Option 1', 'Option 2'],
|
|
858
|
-
selectableCount: 1,
|
|
859
|
-
toAnnouncementGroup: true
|
|
860
|
-
}
|
|
861
|
-
})
|
|
862
|
-
```
|
|
863
|
-
|
|
864
|
-
### 🏆 Poll Result (Fake Results)
|
|
865
|
-
|
|
866
|
-
```javascript
|
|
867
|
-
await sock.sendMessage(jid, {
|
|
868
|
-
pollResult: {
|
|
869
|
-
name: 'Best framework?',
|
|
870
|
-
votes: [['React', 150], ['Vue', 120], ['Angular', 80]]
|
|
871
|
-
}
|
|
872
|
-
})
|
|
873
|
-
```
|
|
874
|
-
|
|
875
|
-
### 📈 Track Poll Votes
|
|
876
|
-
|
|
877
|
-
```javascript
|
|
878
|
-
import { getAggregateVotesInPollMessage } from 'ishumdz-bail'
|
|
879
|
-
|
|
880
|
-
// Store messages
|
|
881
|
-
const messageStore = new Map()
|
|
882
|
-
|
|
883
|
-
sock.ev.on('messages.upsert', async ({ messages }) => {
|
|
884
|
-
for (const msg of messages) {
|
|
885
|
-
const id = msg.key.remoteJid + ':' + msg.key.id
|
|
886
|
-
messageStore.set(id, msg)
|
|
887
|
-
}
|
|
888
|
-
})
|
|
889
|
-
|
|
890
|
-
// Listen for poll votes
|
|
891
|
-
sock.ev.on('messages.update', async (events) => {
|
|
892
|
-
for (const { key, update } of events) {
|
|
893
|
-
if (update.pollUpdates) {
|
|
894
|
-
const id = key.remoteJid + ':' + key.id
|
|
895
|
-
const pollCreation = messageStore.get(id)
|
|
896
|
-
|
|
897
|
-
if (pollCreation) {
|
|
898
|
-
const votes = getAggregateVotesInPollMessage({
|
|
899
|
-
message: pollCreation,
|
|
900
|
-
pollUpdates: update.pollUpdates
|
|
901
|
-
})
|
|
902
|
-
|
|
903
|
-
console.log('Poll votes:', votes)
|
|
904
|
-
// [{ name: 'Option 1', voters: ['123@s.whatsapp.net'] }, ...]
|
|
905
|
-
}
|
|
906
|
-
}
|
|
907
|
-
}
|
|
908
|
-
})
|
|
255
|
+
// All paths for channel uploads
|
|
256
|
+
console.log(NEWSLETTER_MEDIA_PATH_MAP);
|
|
257
|
+
// {
|
|
258
|
+
// image: '/newsletter/newsletter-image',
|
|
259
|
+
// video: '/newsletter/newsletter-video',
|
|
260
|
+
// document: '/newsletter/newsletter-document',
|
|
261
|
+
// audio: '/newsletter/newsletter-audio',
|
|
262
|
+
// sticker: '/newsletter/newsletter-image',
|
|
263
|
+
// gif: '/newsletter/newsletter-gif',
|
|
264
|
+
// ptt: '/newsletter/newsletter-ptt',
|
|
265
|
+
// ptv: '/newsletter/newsletter-ptv'
|
|
266
|
+
// }
|
|
909
267
|
```
|
|
910
268
|
|
|
911
|
-
|
|
269
|
+
---
|
|
912
270
|
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
271
|
+
## 📋 All Features List
|
|
272
|
+
|
|
273
|
+
```
|
|
274
|
+
┌─────────────────────────────────────────────────────────────────────────────┐
|
|
275
|
+
│ COMPLETE FEATURE LIST │
|
|
276
|
+
├─────────────────────────────────────────────────────────────────────────────┤
|
|
277
|
+
│ │
|
|
278
|
+
│ 🎮 GAMES (8 functions) │
|
|
279
|
+
│ ├── blackjack(action, playerHand, dealerHand, bet) │
|
|
280
|
+
│ ├── slotMachine(bet) │
|
|
281
|
+
│ ├── diceGame(bet, prediction) │
|
|
282
|
+
│ ├── coinFlip(bet, choice) │
|
|
283
|
+
│ ├── roulette(bet, choice) │
|
|
284
|
+
│ ├── rps(choice) │
|
|
285
|
+
│ ├── trivia(bet) │
|
|
286
|
+
│ ├── createMines(rows, cols, mineCount) │
|
|
287
|
+
│ ├── revealTile(game, row, col) │
|
|
288
|
+
│ └── cashoutMines(game, bet) │
|
|
289
|
+
│ │
|
|
290
|
+
│ 📞 VOIP (3 functions) │
|
|
291
|
+
│ ├── VoipClient │
|
|
292
|
+
│ ├── ActiveCall │
|
|
293
|
+
│ ├── AudioFeeder │
|
|
294
|
+
│ ├── VideoFeeder │
|
|
295
|
+
│ ├── enableCallAutoAnswer(sock, options) │
|
|
296
|
+
│ └── getActiveVoipClient() │
|
|
297
|
+
│ │
|
|
298
|
+
│ ⚡ PRO METHODS (34 functions) │
|
|
299
|
+
│ ├── sendPoll(jid, pollData) │
|
|
300
|
+
│ ├── sendPollVote(jid, pollKey, options) │
|
|
301
|
+
│ ├── getAggregatePollVotes(pollMsg) │
|
|
302
|
+
│ ├── channelVote(target, option) │
|
|
303
|
+
│ ├── newsletterVoteMessage(jid, serverId, option) │
|
|
304
|
+
│ ├── newsletterReact(jid, serverId, reaction) │
|
|
305
|
+
│ ├── newsletterGetMessages(jid, count) │
|
|
306
|
+
│ ├── newsletterSearch(query) │
|
|
307
|
+
│ ├── newsletterList() │
|
|
308
|
+
│ ├── sendStatusText(text, options) │
|
|
309
|
+
│ ├── sendStatusMedia(media, options) │
|
|
310
|
+
│ ├── readStatus(key) │
|
|
311
|
+
│ ├── reactStatus(key, emoji) │
|
|
312
|
+
│ ├── editMessage(jid, key, text) │
|
|
313
|
+
│ ├── deleteMessage(jid, key) │
|
|
314
|
+
│ ├── pinMessage(jid, key, duration) │
|
|
315
|
+
│ ├── unpinMessage(jid, key) │
|
|
316
|
+
│ ├── starMessage(jid, key, star) │
|
|
317
|
+
│ ├── reactMessage(jid, key, emoji) │
|
|
318
|
+
│ ├── sendPresence(jid, presence) │
|
|
319
|
+
│ ├── reply(jid, text, quoted) │
|
|
320
|
+
│ ├── checkNumber(phone) │
|
|
321
|
+
│ ├── setBio(text) │
|
|
322
|
+
│ ├── updateProfileName(name) │
|
|
323
|
+
│ ├── setProfilePicture(jid, content) │
|
|
324
|
+
│ ├── removeProfilePicture(jid) │
|
|
325
|
+
│ ├── rejectCall(callId, callFrom) │
|
|
326
|
+
│ ├── groupGetInviteInfo(code) │
|
|
327
|
+
│ ├── groupJoinViaInvite(code) │
|
|
328
|
+
│ ├── groupSetAnnouncement(jid, bool) │
|
|
329
|
+
│ ├── groupSetLocked(jid, bool) │
|
|
330
|
+
│ ├── groupRequestParticipantsList(jid) │
|
|
331
|
+
│ ├── groupApproveParticipants(jid, participants) │
|
|
332
|
+
│ ├── groupRejectParticipants(jid, participants) │
|
|
333
|
+
│ └── attachProMethods(sock) │
|
|
334
|
+
│ │
|
|
335
|
+
│ 📰 NEWSLETTER (8 functions) │
|
|
336
|
+
│ ├── NEWSLETTER_MEDIA_PATH_MAP │
|
|
337
|
+
│ ├── newsletterFetchMessages(jid, count, since, after) │
|
|
338
|
+
│ ├── newsletterMetadata(type, query) │
|
|
339
|
+
│ ├── newsletterReactMessage(jid, serverId, reaction) │
|
|
340
|
+
│ ├── newsletterUpdate(jid, settings) │
|
|
341
|
+
│ ├── newsletterCreate(name, description) │
|
|
342
|
+
│ ├── newsletterDelete(jid) │
|
|
343
|
+
│ └── newsletterFollow(jid) │
|
|
344
|
+
│ │
|
|
345
|
+
│ 📊 POLL VOTING (1 function) │
|
|
346
|
+
│ └── getAggregateVotesInPollMessage(pollMsg) │
|
|
347
|
+
│ │
|
|
348
|
+
│ 🎯 CORE (10+ functions) │
|
|
349
|
+
│ ├── makeWASocket(config) │
|
|
350
|
+
│ ├── useMultiFileAuthState(dir) │
|
|
351
|
+
│ ├── makeCacheableSignalKeyStore(state, logger) │
|
|
352
|
+
│ ├── DisconnectReason │
|
|
353
|
+
│ ├── delay(ms) │
|
|
354
|
+
│ ├── proto │
|
|
355
|
+
│ ├── encodeBinaryNode(frame) │
|
|
356
|
+
│ ├── decodeBinaryNode(buffer) │
|
|
357
|
+
│ ├── jidDecode(jid) │
|
|
358
|
+
│ └── jidEncode(user, server) │
|
|
359
|
+
│ │
|
|
360
|
+
└─────────────────────────────────────────────────────────────────────────────┘
|
|
951
361
|
```
|
|
952
362
|
|
|
953
363
|
---
|
|
954
364
|
|
|
955
|
-
##
|
|
956
|
-
|
|
957
|
-
<div align="center">
|
|
958
|
-
|
|
959
|
-
<table>
|
|
960
|
-
<tr>
|
|
961
|
-
<td align="center">
|
|
962
|
-
<a href="https://ishanx-pro.site.je">
|
|
963
|
-
🌐<br/><b>Website</b><br/>ishanx-pro.site.je
|
|
964
|
-
</a>
|
|
965
|
-
</td>
|
|
966
|
-
<td align="center">
|
|
967
|
-
<a href="https://shyracore.indevs.in">
|
|
968
|
-
💬<br/><b>WhatsApp Channel</b><br/>shyracore.indevs.in
|
|
969
|
-
</a>
|
|
970
|
-
</td>
|
|
971
|
-
</tr>
|
|
972
|
-
</table>
|
|
973
|
-
|
|
974
|
-
**Developer:** Lovely
|
|
365
|
+
## 📄 License
|
|
975
366
|
|
|
976
|
-
|
|
367
|
+
MIT License
|
|
977
368
|
|
|
978
369
|
---
|
|
979
370
|
|
|
980
371
|
<div align="center">
|
|
981
372
|
|
|
982
|
-
|
|
373
|
+
**Made with ❤️ by Lovely**
|
|
983
374
|
|
|
984
|
-
|
|
375
|
+
[](https://www.npmjs.com/package/ishumdz-bail)
|
|
376
|
+
[](https://github.com/lovelyofficial/ishumdz-bail)
|
|
985
377
|
|
|
986
378
|
</div>
|
|
987
|
-
|
|
988
|
-
---
|
|
989
|
-
|
|
990
|
-
## 📄 License
|
|
991
|
-
|
|
992
|
-
MIT
|