ishumdz-bail 1.0.7 → 1.0.9
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 +444 -592
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,772 +1,624 @@
|
|
|
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
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
3
|
+
```
|
|
4
|
+
╔═══════════════════════════════════════════════════════════════════╗
|
|
5
|
+
║ ║
|
|
6
|
+
║ ██╗ ██╗██████╗ █████╗ ███████╗████████╗ ║
|
|
7
|
+
║ ██║ ██║██╔══██╗██╔══██╗██╔════╝╚══██╔══╝ ║
|
|
8
|
+
║ ███████║██████╔╝███████║███████╗ ██║ ║
|
|
9
|
+
║ ██╔══██║██╔══██╗██╔══██║╚════██║ ██║ ║
|
|
10
|
+
║ ██║ ██║██████╔╝██║ ██║███████║ ██║ ║
|
|
11
|
+
║ ╚═╝ ╚═╝╚═════╝ ╚═╝ ╚═╝╚══════╝ ╚═╝ ║
|
|
12
|
+
║ ║
|
|
13
|
+
║ ██████╗ ██╗ ██╗██╗███████╗ ║
|
|
14
|
+
║ ██╔══██╗██║ ██║██║╚══███╔╝ ║
|
|
15
|
+
║ ██║ ██║██║ ██║██║ ███╔╝ ║
|
|
16
|
+
║ ██║ ██║██║ ██║██║ ███╔╝ ║
|
|
17
|
+
║ ██████╔╝╚██████╔╝██║███████╗ ║
|
|
18
|
+
║ ╚═════╝ ╚═════╝ ╚═╝╚══════╝ ║
|
|
19
|
+
║ ║
|
|
20
|
+
║ WhatsApp Web API Fork for Bots ║
|
|
21
|
+
║ By Lovely ❤️ ║
|
|
22
|
+
║ ║
|
|
23
|
+
╚═══════════════════════════════════════════════════════════════════╝
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
<img src="https://i.postimg.cc/9Q6q2Pv6/IMG-20260925-WA4965.jpg" alt="ishumdz-bail" width="700" />
|
|
17
27
|
|
|
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>
|
|
28
|
+
<br/>
|
|
25
29
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
+
[](https://www.npmjs.com/package/ishumdz-bail)
|
|
31
|
+
[](https://github.com/lovelyofficial/ishumdz-bail)
|
|
32
|
+
[](https://nodejs.org)
|
|
33
|
+
[](LICENSE)
|
|
34
|
+
[](https://whatsapp.com)
|
|
30
35
|
|
|
31
36
|
**Open-source WhatsApp automation library — no browser required.**
|
|
32
37
|
Built on WebSocket for speed, stability, and full multi-device support.
|
|
33
38
|
|
|
34
|
-
|
|
39
|
+
</div>
|
|
35
40
|
|
|
36
|
-
|
|
41
|
+
---
|
|
37
42
|
|
|
38
|
-
|
|
43
|
+
## 📋 Table of Contents
|
|
44
|
+
|
|
45
|
+
- [✨ What is ishumdz-bail?](#-what-is-ishumdz-bail)
|
|
46
|
+
- [🚀 Installation](#-installation)
|
|
47
|
+
- [⚡ Quick Start](#-quick-start)
|
|
48
|
+
- [🎯 Features Overview](#-features-overview)
|
|
49
|
+
- [🎮 Games](#-games)
|
|
50
|
+
- [📞 VoIP Caller](#-voip-caller)
|
|
51
|
+
- [⚡ Pro Methods](#-pro-methods)
|
|
52
|
+
- [📊 Polls](#-polls)
|
|
53
|
+
- [📢 Newsletter/Channels](#-newsletterchannels)
|
|
54
|
+
- [🟢 Status/Stories](#-statusstories)
|
|
55
|
+
- [💬 Chat Actions](#-chat-actions)
|
|
56
|
+
- [👥 Group Management](#-group-management)
|
|
57
|
+
- [👤 Profile Management](#-profile-management)
|
|
58
|
+
- [📰 Newsletter Media](#-newsletter-media)
|
|
59
|
+
- [🔌 API Reference](#-api-reference)
|
|
60
|
+
- [📝 Examples](#-examples)
|
|
39
61
|
|
|
40
62
|
---
|
|
41
63
|
|
|
42
64
|
## ✨ What is ishumdz-bail?
|
|
43
65
|
|
|
44
|
-
**ishumdz-bail**
|
|
66
|
+
**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.
|
|
45
67
|
|
|
46
|
-
|
|
68
|
+
**Why choose ishumdz-bail?**
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
┌─────────────────────────────────────────────────────────────────┐
|
|
72
|
+
│ ✅ No Browser Required │ ✅ Multi-Device Support │
|
|
73
|
+
│ ✅ WebSocket Based │ ✅ Full API Coverage │
|
|
74
|
+
│ ✅ Built-in Games (8) │ ✅ VoIP Call Answer │
|
|
75
|
+
│ ✅ Pro Methods (34) │ ✅ Newsletter/Channel Support │
|
|
76
|
+
│ ✅ Active Maintenance │ ✅ MIT Licensed │
|
|
77
|
+
└─────────────────────────────────────────────────────────────────┘
|
|
78
|
+
```
|
|
47
79
|
|
|
48
80
|
---
|
|
49
81
|
|
|
50
|
-
## 🚀
|
|
82
|
+
## 🚀 Installation
|
|
51
83
|
|
|
52
84
|
```bash
|
|
53
85
|
npm install ishumdz-bail
|
|
54
86
|
```
|
|
55
87
|
|
|
88
|
+
**Requirements:**
|
|
89
|
+
- Node.js ≥ 20
|
|
90
|
+
- npm or yarn
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## ⚡ Quick Start
|
|
95
|
+
|
|
56
96
|
```javascript
|
|
57
|
-
|
|
97
|
+
const { makeWASocket, useMultiFileAuthState, attachProMethods } = require('ishumdz-bail');
|
|
98
|
+
|
|
99
|
+
const { state, saveCreds } = await useMultiFileAuthState('auth_info');
|
|
58
100
|
|
|
59
|
-
const { state, saveCreds } = await useMultiFileAuthState('auth_info')
|
|
60
101
|
const sock = makeWASocket({
|
|
61
102
|
auth: state,
|
|
62
|
-
syncFullHistory: false,
|
|
63
|
-
aiLabel: true,
|
|
64
|
-
|
|
103
|
+
syncFullHistory: false,
|
|
104
|
+
aiLabel: true,
|
|
105
|
+
autoAnswer: false,
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
sock.ev.on('creds.update', saveCreds);
|
|
65
109
|
|
|
66
|
-
sock.ev.on('
|
|
110
|
+
sock.ev.on('connection.update', ({ connection }) => {
|
|
111
|
+
if (connection === 'open') {
|
|
112
|
+
console.log('✅ Connected to WhatsApp!');
|
|
113
|
+
|
|
114
|
+
// Attach Pro methods
|
|
115
|
+
attachProMethods(sock);
|
|
116
|
+
}
|
|
117
|
+
});
|
|
67
118
|
```
|
|
68
119
|
|
|
69
120
|
---
|
|
70
121
|
|
|
71
|
-
##
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
122
|
+
## 🎯 Features Overview
|
|
123
|
+
|
|
124
|
+
```
|
|
125
|
+
┌─────────────────────────────────────────────────────────────────────────┐
|
|
126
|
+
│ ISHUMDZ-BAIL FEATURES │
|
|
127
|
+
├─────────────────────────────────────────────────────────────────────────┤
|
|
128
|
+
│ │
|
|
129
|
+
│ 🎮 GAMES (8) │ 📞 VOIP (3) │ ⚡ PRO METHODS (34) │
|
|
130
|
+
│ ├─ Blackjack │ ├─ VoipClient │ ├─ sendPoll │
|
|
131
|
+
│ ├─ Slots │ ├─ ActiveCall │ ├─ sendPollVote │
|
|
132
|
+
│ ├─ Dice │ └─ AudioFeeder │ ├─ editMessage │
|
|
133
|
+
│ ├─ Coin Flip │ │ ├─ deleteMessage │
|
|
134
|
+
│ ├─ Roulette │ 📊 POLLS (3) │ ├─ pinMessage │
|
|
135
|
+
│ ├─ Mines │ ├─ sendPoll │ ├─ reactMessage │
|
|
136
|
+
│ ├─ Trivia │ ├─ sendPollVote │ ├─ sendStatusText │
|
|
137
|
+
│ └─ Rock Paper │ └─ getAggregate │ ├─ checkNumber │
|
|
138
|
+
│ Scissors │ Votes │ └─ ... and more! │
|
|
139
|
+
│ │
|
|
140
|
+
│ 📢 NEWSLETTER (6) │ 🟢 STATUS (4) │ 💬 CHAT (8) │
|
|
141
|
+
│ ├─ channelVote │ ├─ sendStatusText │ ├─ editMessage │
|
|
142
|
+
│ ├─ newsletterReact │ ├─ sendStatusMedia │ ├─ deleteMessage │
|
|
143
|
+
│ ├─ newsletterGet │ ├─ readStatus │ ├─ pinMessage │
|
|
144
|
+
│ │ Messages │ └─ reactStatus │ ├─ unpinMessage │
|
|
145
|
+
│ ├─ newsletterSearch │ │ ├─ starMessage │
|
|
146
|
+
│ └─ newsletterList │ 👥 GROUPS (7) │ ├─ sendPresence │
|
|
147
|
+
│ │ ├─ groupGetInvite │ └─ reply │
|
|
148
|
+
│ 👤 PROFILE (6) │ ├─ groupJoinVia │ │
|
|
149
|
+
│ ├─ checkNumber │ │ Invite │ │
|
|
150
|
+
│ ├─ setBio │ ├─ groupSet │ │
|
|
151
|
+
│ ├─ updateProfileName │ │ Announcement │ │
|
|
152
|
+
│ ├─ setProfilePicture │ ├─ groupSetLocked │ │
|
|
153
|
+
│ ├─ removeProfile │ ├─ groupRequest │ │
|
|
154
|
+
│ │ Picture │ │ Participants │ │
|
|
155
|
+
│ └─ rejectCall │ ├─ groupApprove │ │
|
|
156
|
+
│ │ │ Participants │ │
|
|
157
|
+
│ │ └─ groupReject │ │
|
|
158
|
+
│ │ Participants │ │
|
|
159
|
+
│ │
|
|
160
|
+
└─────────────────────────────────────────────────────────────────────────┘
|
|
161
|
+
```
|
|
94
162
|
|
|
95
163
|
---
|
|
96
164
|
|
|
97
|
-
##
|
|
165
|
+
## 🎮 Games
|
|
98
166
|
|
|
99
|
-
|
|
167
|
+
8 built-in games for your WhatsApp bot:
|
|
100
168
|
|
|
101
169
|
```javascript
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
richResponse: {
|
|
105
|
-
text: '**Hello** from *ishumdz-bail*',
|
|
106
|
-
responseId: 'optional-uuid'
|
|
107
|
-
}
|
|
108
|
-
})
|
|
170
|
+
const { blackjack, slotMachine, diceGame, coinFlip, roulette, rps, trivia, createMines } = require('ishumdz-bail');
|
|
171
|
+
```
|
|
109
172
|
|
|
110
|
-
|
|
111
|
-
await sock.sendMessage(jid, {
|
|
112
|
-
richResponse: {
|
|
113
|
-
code: 'console.log("hello")',
|
|
114
|
-
language: 'javascript'
|
|
115
|
-
}
|
|
116
|
-
})
|
|
117
|
-
|
|
118
|
-
// Table
|
|
119
|
-
await sock.sendMessage(jid, {
|
|
120
|
-
richResponse: {
|
|
121
|
-
table: {
|
|
122
|
-
rows: [
|
|
123
|
-
['Name', 'Age'],
|
|
124
|
-
['Alice', '25'],
|
|
125
|
-
['Bob', '30']
|
|
126
|
-
]
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
})
|
|
173
|
+
### 🃏 Blackjack
|
|
130
174
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
})
|
|
175
|
+
```javascript
|
|
176
|
+
// Start a game
|
|
177
|
+
const game = blackjack('start', [], [], 100);
|
|
178
|
+
console.log(game.playerHand); // [{suit:'♠️',value:'A'}, {suit:'♥️',value:'K'}]
|
|
179
|
+
console.log(game.dealerHand); // [{suit:'♦️',value:'5'}, {suit:'♣️',value:'?'}]
|
|
180
|
+
console.log(game.status); // 'playing'
|
|
138
181
|
|
|
139
|
-
//
|
|
140
|
-
|
|
141
|
-
richResponse: {
|
|
142
|
-
latex: 'E = mc^2'
|
|
143
|
-
}
|
|
144
|
-
})
|
|
145
|
-
|
|
146
|
-
// Map / location
|
|
147
|
-
await sock.sendMessage(jid, {
|
|
148
|
-
richResponse: {
|
|
149
|
-
map: {
|
|
150
|
-
latitude: -6.2,
|
|
151
|
-
longitude: 106.8,
|
|
152
|
-
zoom: 15,
|
|
153
|
-
title: 'Jakarta',
|
|
154
|
-
annotations: []
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
})
|
|
182
|
+
// Hit (draw card)
|
|
183
|
+
const hit = blackjack('hit', game.playerHand, game.dealerHand, 100);
|
|
158
184
|
|
|
159
|
-
//
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
imageUrl: 'https://example.com/photo.jpg'
|
|
163
|
-
}
|
|
164
|
-
})
|
|
185
|
+
// Stand (end turn)
|
|
186
|
+
const stand = blackjack('stand', game.playerHand, game.dealerHand, 100);
|
|
187
|
+
console.log(stand.status); // 'win', 'lose', or 'push'
|
|
165
188
|
```
|
|
166
189
|
|
|
167
|
-
|
|
190
|
+
### 🎰 Slots
|
|
168
191
|
|
|
169
192
|
```javascript
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
await sock.sendLatex(jid, quoted, { latex: 'x^2 + y^2 = z^2' })
|
|
174
|
-
await sock.sendRichMessage(jid, submessages, quoted)
|
|
193
|
+
const slots = slotMachine(100);
|
|
194
|
+
console.log(slots.reels); // ['🍒', '🍋', '🍊']
|
|
195
|
+
console.log(slots.payout); // 0-500 (multiplier)
|
|
175
196
|
```
|
|
176
197
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
## 🖼️ Album Message
|
|
180
|
-
|
|
181
|
-
Send multiple images/videos grouped into a single WA album:
|
|
198
|
+
### 🎲 Dice
|
|
182
199
|
|
|
183
200
|
```javascript
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
],
|
|
190
|
-
caption: 'caption ini otomatis ke item pertama'
|
|
191
|
-
})
|
|
201
|
+
const dice = diceGame(100, 'high'); // 'high', 'low', or specific number
|
|
202
|
+
console.log(dice.dice1); // 1-6
|
|
203
|
+
console.log(dice.dice2); // 1-6
|
|
204
|
+
console.log(dice.total); // 2-12
|
|
205
|
+
console.log(dice.win); // true/false
|
|
192
206
|
```
|
|
193
207
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
## 🚫 Ban Checker
|
|
197
|
-
|
|
198
|
-
4-factor ban detection against WhatsApp's own servers — no third-party API:
|
|
208
|
+
### 🪙 Coin Flip
|
|
199
209
|
|
|
200
210
|
```javascript
|
|
201
|
-
const
|
|
202
|
-
// or
|
|
203
|
-
|
|
204
|
-
console.log(result)
|
|
205
|
-
// {
|
|
206
|
-
// status: 'ACTIVE' | 'PROFILE_HIDDEN' | 'LIKELY_ACTIVE' | 'BANNED' | 'OFF_WHATSAPP' | 'UNKNOWN',
|
|
207
|
-
// emoji: '🟢' | '🟡' | '🔴' | '❓',
|
|
208
|
-
// confidence: 0..1,
|
|
209
|
-
// deviceCount: number | null,
|
|
210
|
-
// registryExists: boolean | null,
|
|
211
|
-
// pageVisible: boolean | null,
|
|
212
|
-
// profileName: string | null
|
|
213
|
-
// }
|
|
211
|
+
const flip = coinFlip(100, 'heads'); // 'heads' or 'tails'
|
|
212
|
+
console.log(flip.result); // 'heads' or 'tails'
|
|
213
|
+
console.log(flip.payout); // 0 or 200
|
|
214
214
|
```
|
|
215
215
|
|
|
216
|
-
|
|
217
|
-
- **Factor A** — Live registry (`sock.onWhatsApp`)
|
|
218
|
-
- **Factor B** — Public send-page title/image probe (`api.whatsapp.com`)
|
|
219
|
-
- **Factor C** — Identity-key device probe via USync (strongest: banned numbers have their keys destroyed)
|
|
220
|
-
- **Factor D** — Device-count signature (2+ = ACTIVE, 1 generic = likely BANNED, 0 = BANNED/OFF_WA)
|
|
221
|
-
|
|
222
|
-
---
|
|
223
|
-
|
|
224
|
-
## 🆔 Username Socket (w:mex)
|
|
225
|
-
|
|
226
|
-
Full WA `@username` API via WhatsApp's internal Pando/MEX GraphQL protocol, query IDs sourced from Java decompile of WA 2.26.17.2:
|
|
216
|
+
### 🎡 Roulette
|
|
227
217
|
|
|
228
218
|
```javascript
|
|
229
|
-
//
|
|
230
|
-
|
|
231
|
-
//
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
await sock.setUsername('myusername')
|
|
235
|
-
|
|
236
|
-
// Delete username
|
|
237
|
-
await sock.deleteUsername()
|
|
238
|
-
|
|
239
|
-
// Get your own username
|
|
240
|
-
const mine = await sock.getMyUsername()
|
|
219
|
+
const spin = roulette(100, 'red'); // 'red', 'black', 'green', or number
|
|
220
|
+
console.log(spin.number); // 0-36
|
|
221
|
+
console.log(spin.color); // 'red', 'black', or 'green'
|
|
222
|
+
console.log(spin.payout); // 0-3600
|
|
223
|
+
```
|
|
241
224
|
|
|
242
|
-
|
|
243
|
-
await sock.setUsernamePin(true)
|
|
225
|
+
### ✊ Rock Paper Scissors
|
|
244
226
|
|
|
245
|
-
|
|
246
|
-
const
|
|
227
|
+
```javascript
|
|
228
|
+
const game = rps('rock'); // 'rock', 'paper', or 'scissors'
|
|
229
|
+
console.log(game.playerChoice); // 'rock'
|
|
230
|
+
console.log(game.botChoice); // 'paper'
|
|
231
|
+
console.log(game.result); // 'win', 'lose', or 'draw'
|
|
232
|
+
```
|
|
247
233
|
|
|
248
|
-
|
|
249
|
-
const usernames = await sock.fetchContactUsernames('94xxxx@s.whatsapp.net', '628yyy@s.whatsapp.net')
|
|
234
|
+
### 🧠 Trivia
|
|
250
235
|
|
|
251
|
-
|
|
252
|
-
const
|
|
236
|
+
```javascript
|
|
237
|
+
const question = trivia(100);
|
|
238
|
+
console.log(question.question); // 'What is the capital of France?'
|
|
239
|
+
console.log(question.options); // ['A) Paris', 'B) London', ...]
|
|
240
|
+
console.log(question.answer); // 'A'
|
|
253
241
|
```
|
|
254
242
|
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
## 🏘️ Communities Socket
|
|
243
|
+
### 💣 Mines
|
|
258
244
|
|
|
259
245
|
```javascript
|
|
260
|
-
// Create
|
|
261
|
-
const
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
//
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
// Manage participants
|
|
274
|
-
await sock.communityParticipantsUpdate(communityJid, [jid1], 'add') // 'add' | 'remove' | 'promote' | 'demote'
|
|
275
|
-
|
|
276
|
-
// Invite code
|
|
277
|
-
const code = await sock.communityInviteCode(communityJid)
|
|
278
|
-
await sock.communityRevokeInvite(communityJid)
|
|
279
|
-
await sock.communityAcceptInvite(code)
|
|
280
|
-
|
|
281
|
-
// Settings
|
|
282
|
-
await sock.communityToggleEphemeral(communityJid, 86400) // seconds
|
|
283
|
-
await sock.communityMemberAddMode(communityJid, 'admin_add')
|
|
284
|
-
await sock.communityJoinApprovalMode(communityJid, 'on')
|
|
285
|
-
await sock.communityUpdateSubject(communityJid, 'New Name')
|
|
286
|
-
await sock.communityUpdateDescription(communityJid, 'New Desc')
|
|
287
|
-
await sock.communityLeave(communityJid)
|
|
246
|
+
// Create a 5x5 grid with 5 mines
|
|
247
|
+
const game = createMines(5, 5, 5);
|
|
248
|
+
console.log(game.totalSafe); // 20
|
|
249
|
+
|
|
250
|
+
// Reveal a tile
|
|
251
|
+
const tile = revealTile(game, 0, 0);
|
|
252
|
+
console.log(tile.safe); // true (diamond) or false (mine)
|
|
253
|
+
console.log(tile.mine); // true or false
|
|
254
|
+
|
|
255
|
+
// Cash out
|
|
256
|
+
const cashout = cashoutMines(game, 100);
|
|
257
|
+
console.log(cashout.payout); // based on revealed tiles
|
|
288
258
|
```
|
|
289
259
|
|
|
290
260
|
---
|
|
291
261
|
|
|
292
|
-
##
|
|
262
|
+
## 📞 VoIP Caller
|
|
293
263
|
|
|
294
|
-
|
|
264
|
+
Answer incoming WhatsApp calls with audio playback:
|
|
295
265
|
|
|
296
266
|
```javascript
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
// Also supported in all shortcut methods:
|
|
300
|
-
await sock.sendTable(jid, title, headers, rows, quoted, { noSelfSync: true })
|
|
301
|
-
await sock.sendCodeBlock(jid, code, quoted, { noSelfSync: true })
|
|
302
|
-
```
|
|
267
|
+
const { makeWASocket, enableCallAutoAnswer, getActiveVoipClient } = require('ishumdz-bail');
|
|
303
268
|
|
|
304
|
-
|
|
269
|
+
const sock = makeWASocket({ auth: state });
|
|
305
270
|
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
271
|
+
// Enable auto-answer
|
|
272
|
+
sock.enableCallAutoAnswer({
|
|
273
|
+
audio: './welcome.wav', // Audio file (MP3/WAV)
|
|
274
|
+
autoAnswer: true, // Auto-answer calls
|
|
275
|
+
answerDelayMs: 200, // Delay before answer
|
|
276
|
+
durationMs: 60000, // Max duration (60s)
|
|
277
|
+
loop: true, // Loop audio
|
|
278
|
+
onCall: (call) => {}, // Incoming call callback
|
|
279
|
+
onAnswer: (call) => {}, // Answered callback
|
|
280
|
+
onEnd: (call, reason) => {} // Ended callback
|
|
281
|
+
});
|
|
282
|
+
```
|
|
309
283
|
|
|
310
|
-
|
|
284
|
+
### Manual Call Handling
|
|
311
285
|
|
|
312
286
|
```javascript
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
// backoffMs: number, // ms to wait before reconnecting
|
|
325
|
-
// message: string,
|
|
326
|
-
// code: number
|
|
327
|
-
// }
|
|
328
|
-
|
|
329
|
-
if (info.shouldReconnect) {
|
|
330
|
-
setTimeout(() => reconnect(), info.backoffMs)
|
|
287
|
+
sock.ev.on('call', async ([call]) => {
|
|
288
|
+
if (call.status === 'offer') {
|
|
289
|
+
console.log(`📞 Incoming ${call.isVideo ? 'video' : 'voice'} call from ${call.from}`);
|
|
290
|
+
|
|
291
|
+
// Reject call
|
|
292
|
+
await sock.rejectCall(call.id, call.from);
|
|
293
|
+
|
|
294
|
+
// Or accept with VoIP client
|
|
295
|
+
const voipClient = getActiveVoipClient();
|
|
296
|
+
if (voipClient?.activeCall) {
|
|
297
|
+
voipClient.activeCall.accept('./audio.wav');
|
|
331
298
|
}
|
|
332
299
|
}
|
|
333
|
-
})
|
|
300
|
+
});
|
|
334
301
|
```
|
|
335
302
|
|
|
336
|
-
**Code map:**
|
|
337
|
-
|
|
338
|
-
| Code | Category | Reconnect | Backoff |
|
|
339
|
-
|---|---|---|---|
|
|
340
|
-
| 401, 440 | fatal | ❌ | — |
|
|
341
|
-
| 515 | recoverable | ✅ | 0 ms (immediate) |
|
|
342
|
-
| 405 | fatal | ❌ | — |
|
|
343
|
-
| 408 | recoverable | ✅ | 30 s |
|
|
344
|
-
| 503 | recoverable | ✅ | 5 min |
|
|
345
|
-
| 429 | rate-limited | ✅ | 60 s |
|
|
346
|
-
| 500 | recoverable | ✅ | 5 s |
|
|
347
|
-
| 503 | recoverable | ✅ | 10 s |
|
|
348
|
-
| Graceful close | recoverable | ✅ | 2 s |
|
|
349
|
-
| Unknown | unknown | ✅ | 15 s |
|
|
350
|
-
|
|
351
|
-
> **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.
|
|
352
|
-
|
|
353
303
|
---
|
|
354
304
|
|
|
355
|
-
##
|
|
305
|
+
## ⚡ Pro Methods
|
|
356
306
|
|
|
357
|
-
|
|
307
|
+
34 convenience methods for easier development:
|
|
358
308
|
|
|
359
309
|
```javascript
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
const
|
|
363
|
-
|
|
364
|
-
maxPerHour: 200,
|
|
365
|
-
maxPerDay: 1500,
|
|
366
|
-
minDelayMs: 1500,
|
|
367
|
-
maxDelayMs: 5000,
|
|
368
|
-
newChatDelayMs: 3000,
|
|
369
|
-
maxIdenticalMessages: 3,
|
|
370
|
-
burstAllowance: 3
|
|
371
|
-
})
|
|
372
|
-
|
|
373
|
-
async function safeSend(jid, content) {
|
|
374
|
-
const delay = await limiter.getDelay(jid, content)
|
|
375
|
-
if (delay === -1) throw new Error('Rate limit exceeded — blocked')
|
|
376
|
-
if (delay > 0) await new Promise(r => setTimeout(r, delay))
|
|
377
|
-
await sock.sendMessage(jid, content)
|
|
378
|
-
limiter.record(jid, content)
|
|
379
|
-
}
|
|
310
|
+
const { makeWASocket, attachProMethods } = require('ishumdz-bail');
|
|
311
|
+
|
|
312
|
+
const sock = makeWASocket({ auth: state });
|
|
313
|
+
attachProMethods(sock); // Attach all Pro methods
|
|
380
314
|
```
|
|
381
315
|
|
|
382
316
|
---
|
|
383
317
|
|
|
384
|
-
##
|
|
385
|
-
|
|
386
|
-
Every WhatsApp message type is covered:
|
|
387
|
-
|
|
388
|
-
- Text, image, video, audio, document, sticker, GIF/video note (PTV)
|
|
389
|
-
- Location & live location
|
|
390
|
-
- Contact / vCard
|
|
391
|
-
- Poll (create, vote, add option, poll result)
|
|
392
|
-
- Button, list, template, interactive (native flow)
|
|
393
|
-
- Album (multiple media in one message)
|
|
394
|
-
- Event & event invite
|
|
395
|
-
- Group invite, group status, group mention
|
|
396
|
-
- Spoiler (blurred) messages
|
|
397
|
-
- Reaction & edited message
|
|
398
|
-
- View-once media
|
|
399
|
-
- Status/story mention & reply
|
|
400
|
-
- Newsletter / channel messages
|
|
401
|
-
- Payment & payment invite
|
|
402
|
-
- All WhatsApp Business types: product, catalog, order, invoice, business profile
|
|
403
|
-
|
|
404
|
-
<details>
|
|
405
|
-
<summary><b>Example: Album</b></summary>
|
|
318
|
+
## 📊 Polls
|
|
406
319
|
|
|
407
320
|
```javascript
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
})
|
|
415
|
-
```
|
|
416
|
-
</details>
|
|
321
|
+
// Create a poll
|
|
322
|
+
await sock.sendPoll(jid, {
|
|
323
|
+
name: 'What is your favorite color?',
|
|
324
|
+
values: ['Red', 'Blue', 'Green', 'Yellow'],
|
|
325
|
+
selectableCount: 1
|
|
326
|
+
});
|
|
417
327
|
|
|
418
|
-
|
|
419
|
-
|
|
328
|
+
// Vote on a poll
|
|
329
|
+
await sock.sendPollVote(jid, pollMessage, ['Red']);
|
|
420
330
|
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
poll: {
|
|
424
|
-
name: 'Poll Title',
|
|
425
|
-
values: ['Option A', 'Option B'],
|
|
426
|
-
selectableCount: 1
|
|
427
|
-
}
|
|
428
|
-
})
|
|
331
|
+
// Get poll results
|
|
332
|
+
const votes = sock.getAggregatePollVotes(pollMessage);
|
|
429
333
|
```
|
|
430
|
-
</details>
|
|
431
334
|
|
|
432
|
-
|
|
433
|
-
|
|
335
|
+
---
|
|
336
|
+
|
|
337
|
+
## 📢 Newsletter/Channels
|
|
434
338
|
|
|
435
339
|
```javascript
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
spoiler: true
|
|
439
|
-
})
|
|
440
|
-
```
|
|
441
|
-
</details>
|
|
340
|
+
// Smart channel poll vote (auto-resolves links)
|
|
341
|
+
await sock.channelVote('https://whatsapp.com/channel/xxx/123', 1);
|
|
442
342
|
|
|
443
|
-
|
|
444
|
-
|
|
343
|
+
// React to channel post
|
|
344
|
+
await sock.newsletterReact(channelJid, serverId, '👍');
|
|
445
345
|
|
|
446
|
-
|
|
447
|
-
await sock.
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
})
|
|
346
|
+
// Get channel messages (decoded)
|
|
347
|
+
const messages = await sock.newsletterGetMessages(channelJid, 50);
|
|
348
|
+
|
|
349
|
+
// Search channels
|
|
350
|
+
const results = await sock.newsletterSearch('technology');
|
|
351
|
+
|
|
352
|
+
// List followed channels
|
|
353
|
+
const channels = await sock.newsletterList();
|
|
455
354
|
```
|
|
456
|
-
</details>
|
|
457
355
|
|
|
458
356
|
---
|
|
459
357
|
|
|
460
|
-
##
|
|
358
|
+
## 🟢 Status/Stories
|
|
461
359
|
|
|
462
360
|
```javascript
|
|
463
|
-
//
|
|
464
|
-
sock.
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
})
|
|
468
|
-
|
|
469
|
-
// Business profile
|
|
470
|
-
const profile = await sock.getBusinessProfile(jid)
|
|
471
|
-
await sock.updateBusinessProfile({ description: 'Open 9-5', email: 'hi@example.com', category: 'Retail' })
|
|
361
|
+
// Send text status
|
|
362
|
+
await sock.sendStatusText('Hello World!', {
|
|
363
|
+
backgroundColor: '#25D366',
|
|
364
|
+
font: 1
|
|
365
|
+
});
|
|
472
366
|
|
|
473
|
-
//
|
|
474
|
-
await sock.
|
|
367
|
+
// Send media status
|
|
368
|
+
await sock.sendStatusMedia('./photo.jpg', {
|
|
369
|
+
type: 'image',
|
|
370
|
+
caption: 'My status!'
|
|
371
|
+
});
|
|
475
372
|
|
|
476
|
-
//
|
|
477
|
-
await sock.
|
|
373
|
+
// React to status
|
|
374
|
+
await sock.reactStatus(statusKey, '❤️');
|
|
478
375
|
```
|
|
479
376
|
|
|
480
377
|
---
|
|
481
378
|
|
|
482
|
-
##
|
|
483
|
-
|
|
484
|
-
Built-in games for your WhatsApp bot! Import from `ishumdz-bail`:
|
|
379
|
+
## 💬 Chat Actions
|
|
485
380
|
|
|
486
381
|
```javascript
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
coinFlip, roulette, rps, trivia,
|
|
490
|
-
createMines, revealTile, cashoutMines
|
|
491
|
-
} from 'ishumdz-bail'
|
|
492
|
-
```
|
|
382
|
+
// Edit a message
|
|
383
|
+
await sock.editMessage(jid, messageKey, 'Updated text!');
|
|
493
384
|
|
|
494
|
-
|
|
385
|
+
// Delete a message
|
|
386
|
+
await sock.deleteMessage(jid, messageKey);
|
|
495
387
|
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
const game = blackjack('start', [], [], 1000)
|
|
499
|
-
await sock.sendMessage(jid, { text: game.message })
|
|
388
|
+
// Pin a message (86400 = 24h, 604800 = 7d, 2592000 = 30d)
|
|
389
|
+
await sock.pinMessage(jid, messageKey, 86400);
|
|
500
390
|
|
|
501
|
-
//
|
|
502
|
-
|
|
391
|
+
// Unpin a message
|
|
392
|
+
await sock.unpinMessage(jid, messageKey);
|
|
503
393
|
|
|
504
|
-
//
|
|
505
|
-
|
|
394
|
+
// Star/unstar a message
|
|
395
|
+
await sock.starMessage(jid, messageKey, true);
|
|
506
396
|
|
|
507
|
-
//
|
|
508
|
-
|
|
509
|
-
```
|
|
397
|
+
// React to a message
|
|
398
|
+
await sock.reactMessage(jid, messageKey, '😂');
|
|
510
399
|
|
|
511
|
-
|
|
400
|
+
// Send presence (typing indicator)
|
|
401
|
+
await sock.sendPresence(jid, 'composing');
|
|
512
402
|
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
await sock.sendMessage(jid, { text: slot.message })
|
|
516
|
-
// 🎰 [🍒] [🍋] [💎] - NO MATCH
|
|
403
|
+
// Quick reply with quote
|
|
404
|
+
await sock.reply(jid, 'This is a reply!', quotedMessage);
|
|
517
405
|
```
|
|
518
406
|
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
```javascript
|
|
522
|
-
const dice = diceGame(100, 'high') // high, low, or seven
|
|
523
|
-
await sock.sendMessage(jid, { text: dice.message })
|
|
524
|
-
```
|
|
407
|
+
---
|
|
525
408
|
|
|
526
|
-
|
|
409
|
+
## 👥 Group Management
|
|
527
410
|
|
|
528
411
|
```javascript
|
|
529
|
-
|
|
530
|
-
await sock.
|
|
531
|
-
```
|
|
412
|
+
// Get group info from invite link
|
|
413
|
+
const info = await sock.groupGetInviteInfo('https://chat.whatsapp.com/xxx');
|
|
532
414
|
|
|
533
|
-
|
|
415
|
+
// Join group via invite
|
|
416
|
+
await sock.groupJoinViaInvite('https://chat.whatsapp.com/xxx');
|
|
534
417
|
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
await sock.sendMessage(jid, { text: rou.message })
|
|
538
|
-
```
|
|
418
|
+
// Set announcement mode (admin only)
|
|
419
|
+
await sock.groupSetAnnouncement(groupJid, true);
|
|
539
420
|
|
|
540
|
-
|
|
421
|
+
// Set locked mode (admin only)
|
|
422
|
+
await sock.groupSetLocked(groupJid, true);
|
|
541
423
|
|
|
542
|
-
|
|
543
|
-
const
|
|
544
|
-
await sock.
|
|
424
|
+
// Manage join requests
|
|
425
|
+
const requests = await sock.groupRequestParticipantsList(groupJid);
|
|
426
|
+
await sock.groupApproveParticipants(groupJid, [participant1, participant2]);
|
|
427
|
+
await sock.groupRejectParticipants(groupJid, [participant3]);
|
|
545
428
|
```
|
|
546
429
|
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
```javascript
|
|
550
|
-
// Create game
|
|
551
|
-
const game = createMines(5, 5, 5) // rows, cols, mines
|
|
552
|
-
|
|
553
|
-
// Reveal tile
|
|
554
|
-
const result = revealTile(game, 0, 0) // row, col
|
|
555
|
-
await sock.sendMessage(jid, { text: result.message })
|
|
430
|
+
---
|
|
556
431
|
|
|
557
|
-
|
|
558
|
-
const cashout = cashoutMines(game, 100)
|
|
559
|
-
await sock.sendMessage(jid, { text: cashout.message })
|
|
560
|
-
```
|
|
561
|
-
|
|
562
|
-
### 🧠 Trivia
|
|
432
|
+
## 👤 Profile Management
|
|
563
433
|
|
|
564
434
|
```javascript
|
|
565
|
-
|
|
566
|
-
await sock.
|
|
435
|
+
// Check if number exists on WhatsApp
|
|
436
|
+
const result = await sock.checkNumber('1234567890');
|
|
437
|
+
console.log(result.exists); // true/false
|
|
567
438
|
|
|
568
|
-
//
|
|
569
|
-
|
|
570
|
-
await sock.sendMessage(jid, { text: answer.message })
|
|
571
|
-
```
|
|
439
|
+
// Update bio
|
|
440
|
+
await sock.setBio('Hello, I am a bot!');
|
|
572
441
|
|
|
573
|
-
|
|
442
|
+
// Update display name
|
|
443
|
+
await sock.updateProfileName('My Bot');
|
|
574
444
|
|
|
575
|
-
|
|
576
|
-
sock.
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
if (text === '.rps rock' || text === '.rps paper' || text === '.rps scissors') {
|
|
581
|
-
const choice = text.split(' ')[1]
|
|
582
|
-
const result = rps(choice)
|
|
583
|
-
await sock.sendMessage(msg.key.remoteJid, { text: result.message })
|
|
584
|
-
}
|
|
585
|
-
|
|
586
|
-
if (text.startsWith('.slot')) {
|
|
587
|
-
const bet = parseInt(text.split(' ')[1]) || 100
|
|
588
|
-
const result = slotMachine(bet)
|
|
589
|
-
await sock.sendMessage(msg.key.remoteJid, { text: result.message })
|
|
590
|
-
}
|
|
591
|
-
|
|
592
|
-
if (text.startsWith('.coinflip')) {
|
|
593
|
-
const choice = text.split(' ')[1] || 'heads'
|
|
594
|
-
const bet = parseInt(text.split(' ')[2]) || 100
|
|
595
|
-
const result = coinFlip(bet, choice)
|
|
596
|
-
await sock.sendMessage(msg.key.remoteJid, { text: result.message })
|
|
597
|
-
}
|
|
598
|
-
})
|
|
445
|
+
// Set profile picture
|
|
446
|
+
await sock.setProfilePicture(jid, './avatar.jpg');
|
|
447
|
+
|
|
448
|
+
// Remove profile picture
|
|
449
|
+
await sock.removeProfilePicture(jid);
|
|
599
450
|
```
|
|
600
451
|
|
|
601
452
|
---
|
|
602
453
|
|
|
603
|
-
##
|
|
454
|
+
## 📰 Newsletter Media
|
|
604
455
|
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
### 🗳️ Create Poll
|
|
456
|
+
Upload media to channels with correct paths:
|
|
608
457
|
|
|
609
458
|
```javascript
|
|
610
|
-
|
|
611
|
-
poll: {
|
|
612
|
-
name: 'Best programming language?',
|
|
613
|
-
values: ['JavaScript', 'Python', 'Java', 'Go', 'Rust'],
|
|
614
|
-
selectableCount: 1
|
|
615
|
-
}
|
|
616
|
-
})
|
|
617
|
-
```
|
|
459
|
+
const { NEWSLETTER_MEDIA_PATH_MAP } = require('ishumdz-bail');
|
|
618
460
|
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
461
|
+
console.log(NEWSLETTER_MEDIA_PATH_MAP);
|
|
462
|
+
// {
|
|
463
|
+
// image: '/newsletter/newsletter-image',
|
|
464
|
+
// video: '/newsletter/newsletter-video',
|
|
465
|
+
// document: '/newsletter/newsletter-document',
|
|
466
|
+
// audio: '/newsletter/newsletter-audio',
|
|
467
|
+
// sticker: '/newsletter/newsletter-image',
|
|
468
|
+
// gif: '/newsletter/newsletter-gif',
|
|
469
|
+
// ptt: '/newsletter/newsletter-ptt',
|
|
470
|
+
// ptv: '/newsletter/newsletter-ptv'
|
|
471
|
+
// }
|
|
629
472
|
```
|
|
630
473
|
|
|
631
|
-
|
|
474
|
+
---
|
|
632
475
|
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
476
|
+
## 🔌 API Reference
|
|
477
|
+
|
|
478
|
+
### Core Functions
|
|
479
|
+
|
|
480
|
+
| Function | Description |
|
|
481
|
+
|----------|-------------|
|
|
482
|
+
| `makeWASocket(config)` | Create WhatsApp socket |
|
|
483
|
+
| `useMultiFileAuthState(dir)` | Multi-file auth state |
|
|
484
|
+
| `attachProMethods(sock)` | Attach Pro methods |
|
|
485
|
+
| `enableCallAutoAnswer(sock, opts)` | Enable VoIP auto-answer |
|
|
486
|
+
| `getActiveVoipClient()` | Get active VoIP client |
|
|
487
|
+
| `delay(ms)` | Delay execution |
|
|
488
|
+
|
|
489
|
+
### Games
|
|
490
|
+
|
|
491
|
+
| Function | Description |
|
|
492
|
+
|----------|-------------|
|
|
493
|
+
| `blackjack(action, player, dealer, bet)` | Play blackjack |
|
|
494
|
+
| `slotMachine(bet)` | Play slots |
|
|
495
|
+
| `diceGame(bet, prediction)` | Play dice |
|
|
496
|
+
| `coinFlip(bet, choice)` | Flip coin |
|
|
497
|
+
| `roulette(bet, choice)` | Play roulette |
|
|
498
|
+
| `rps(choice)` | Rock Paper Scissors |
|
|
499
|
+
| `trivia(bet)` | Play trivia |
|
|
500
|
+
| `createMines(rows, cols, mines)` | Create mines game |
|
|
501
|
+
| `revealTile(game, row, col)` | Reveal tile |
|
|
502
|
+
| `cashoutMines(game, bet)` | Cash out |
|
|
503
|
+
|
|
504
|
+
### Pro Methods
|
|
505
|
+
|
|
506
|
+
| Function | Description |
|
|
507
|
+
|----------|-------------|
|
|
508
|
+
| `sendPoll(jid, data)` | Create poll |
|
|
509
|
+
| `sendPollVote(jid, key, options)` | Vote on poll |
|
|
510
|
+
| `editMessage(jid, key, text)` | Edit message |
|
|
511
|
+
| `deleteMessage(jid, key)` | Delete message |
|
|
512
|
+
| `pinMessage(jid, key, duration)` | Pin message |
|
|
513
|
+
| `unpinMessage(jid, key)` | Unpin message |
|
|
514
|
+
| `starMessage(jid, key, star)` | Star message |
|
|
515
|
+
| `reactMessage(jid, key, emoji)` | React to message |
|
|
516
|
+
| `sendPresence(jid, presence)` | Send presence |
|
|
517
|
+
| `reply(jid, text, quoted)` | Reply with quote |
|
|
518
|
+
| `checkNumber(phone)` | Check WhatsApp number |
|
|
519
|
+
| `setBio(text)` | Update bio |
|
|
520
|
+
| `updateProfileName(name)` | Update name |
|
|
521
|
+
| `setProfilePicture(jid, content)` | Set profile pic |
|
|
522
|
+
| `removeProfilePicture(jid)` | Remove profile pic |
|
|
523
|
+
| `sendStatusText(text, options)` | Send text status |
|
|
524
|
+
| `sendStatusMedia(media, options)` | Send media status |
|
|
525
|
+
| `readStatus(key)` | Mark status as read |
|
|
526
|
+
| `reactStatus(key, emoji)` | React to status |
|
|
527
|
+
| `channelVote(target, option)` | Smart channel vote |
|
|
528
|
+
| `newsletterReact(jid, id, reaction)` | React to channel |
|
|
529
|
+
| `newsletterGetMessages(jid, count)` | Get channel messages |
|
|
530
|
+
| `newsletterSearch(query)` | Search channels |
|
|
531
|
+
| `newsletterList()` | List followed channels |
|
|
532
|
+
| `groupGetInviteInfo(code)` | Get group info |
|
|
533
|
+
| `groupJoinViaInvite(code)` | Join via invite |
|
|
534
|
+
| `groupSetAnnouncement(jid, bool)` | Admin-only messages |
|
|
535
|
+
| `groupSetLocked(jid, bool)` | Admin-only edit |
|
|
536
|
+
| `groupRequestParticipantsList(jid)` | Pending requests |
|
|
537
|
+
| `groupApproveParticipants(jid, list)` | Approve requests |
|
|
538
|
+
| `groupRejectParticipants(jid, list)` | Reject requests |
|
|
539
|
+
| `rejectCall(callId, from)` | Reject call |
|
|
643
540
|
|
|
644
|
-
|
|
541
|
+
---
|
|
645
542
|
|
|
646
|
-
|
|
647
|
-
await sock.sendMessage(jid, {
|
|
648
|
-
pollResult: {
|
|
649
|
-
name: 'Best framework?',
|
|
650
|
-
votes: [['React', 150], ['Vue', 120], ['Angular', 80]]
|
|
651
|
-
}
|
|
652
|
-
})
|
|
653
|
-
```
|
|
543
|
+
## 📝 Examples
|
|
654
544
|
|
|
655
|
-
###
|
|
545
|
+
### Basic Bot
|
|
656
546
|
|
|
657
547
|
```javascript
|
|
658
|
-
|
|
548
|
+
const { makeWASocket, useMultiFileAuthState, attachProMethods } = require('ishumdz-bail');
|
|
659
549
|
|
|
660
|
-
|
|
661
|
-
const
|
|
662
|
-
|
|
663
|
-
sock
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
const
|
|
550
|
+
async function startBot() {
|
|
551
|
+
const { state, saveCreds } = await useMultiFileAuthState('auth');
|
|
552
|
+
|
|
553
|
+
const sock = makeWASocket({
|
|
554
|
+
auth: state,
|
|
555
|
+
printQRInTerminal: true
|
|
556
|
+
});
|
|
557
|
+
|
|
558
|
+
attachProMethods(sock);
|
|
559
|
+
|
|
560
|
+
sock.ev.on('creds.update', saveCreds);
|
|
561
|
+
|
|
562
|
+
sock.ev.on('messages.upsert', async ({ messages }) => {
|
|
563
|
+
const msg = messages[0];
|
|
564
|
+
if (!msg.key.fromMe && msg.message?.conversation) {
|
|
565
|
+
const text = msg.message.conversation.toLowerCase();
|
|
566
|
+
|
|
567
|
+
if (text === '!ping') {
|
|
568
|
+
await sock.reply(msg.key.remoteJid, 'Pong! 🏓', msg);
|
|
569
|
+
}
|
|
676
570
|
|
|
677
|
-
if (
|
|
678
|
-
const
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
})
|
|
682
|
-
|
|
683
|
-
console.log('Poll votes:', votes)
|
|
684
|
-
// [{ name: 'Option 1', voters: ['123@s.whatsapp.net'] }, ...]
|
|
571
|
+
if (text === '!slots') {
|
|
572
|
+
const slots = slotMachine(100);
|
|
573
|
+
await sock.reply(msg.key.remoteJid,
|
|
574
|
+
`🎰 Slots: ${slots.reels.join(' | ')}\nPayout: ${slots.payout}`, msg);
|
|
685
575
|
}
|
|
686
576
|
}
|
|
687
|
-
}
|
|
688
|
-
}
|
|
577
|
+
});
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
startBot();
|
|
689
581
|
```
|
|
690
582
|
|
|
691
|
-
###
|
|
583
|
+
### Call Auto-Answer Bot
|
|
692
584
|
|
|
693
585
|
```javascript
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
586
|
+
const { makeWASocket, useMultiFileAuthState, enableCallAutoAnswer } = require('ishumdz-bail');
|
|
587
|
+
|
|
588
|
+
async function startCallBot() {
|
|
589
|
+
const { state, saveCreds } = await useMultiFileAuthState('auth');
|
|
697
590
|
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
const question = args[0]
|
|
702
|
-
const options = args.slice(1)
|
|
703
|
-
|
|
704
|
-
if (question && options.length >= 2) {
|
|
705
|
-
await sock.sendMessage(msg.key.remoteJid, {
|
|
706
|
-
poll: {
|
|
707
|
-
name: question,
|
|
708
|
-
values: options,
|
|
709
|
-
selectableCount: 1
|
|
710
|
-
}
|
|
711
|
-
})
|
|
712
|
-
}
|
|
713
|
-
}
|
|
591
|
+
const sock = makeWASocket({ auth: state });
|
|
592
|
+
|
|
593
|
+
sock.ev.on('creds.update', saveCreds);
|
|
714
594
|
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
595
|
+
sock.ev.on('connection.update', ({ connection }) => {
|
|
596
|
+
if (connection === 'open') {
|
|
597
|
+
sock.enableCallAutoAnswer({
|
|
598
|
+
audio: './welcome.wav',
|
|
599
|
+
autoAnswer: true
|
|
600
|
+
});
|
|
601
|
+
console.log('📞 Call bot ready!');
|
|
721
602
|
}
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
votes
|
|
727
|
-
}
|
|
728
|
-
})
|
|
729
|
-
}
|
|
730
|
-
})
|
|
603
|
+
});
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
startCallBot();
|
|
731
607
|
```
|
|
732
608
|
|
|
733
609
|
---
|
|
734
610
|
|
|
735
|
-
##
|
|
736
|
-
|
|
737
|
-
<div align="center">
|
|
738
|
-
|
|
739
|
-
<table>
|
|
740
|
-
<tr>
|
|
741
|
-
<td align="center">
|
|
742
|
-
<a href="https://ishanx-pro.site.je">
|
|
743
|
-
🌐<br/><b>Website</b><br/>ishanx-pro.site.je
|
|
744
|
-
</a>
|
|
745
|
-
</td>
|
|
746
|
-
<td align="center">
|
|
747
|
-
<a href="https://shyracore.indevs.in">
|
|
748
|
-
💬<br/><b>WhatsApp Channel</b><br/>shyracore.indevs.in
|
|
749
|
-
</a>
|
|
750
|
-
</td>
|
|
751
|
-
</tr>
|
|
752
|
-
</table>
|
|
753
|
-
|
|
754
|
-
**Developer:** Lovely
|
|
611
|
+
## 📄 License
|
|
755
612
|
|
|
756
|
-
|
|
613
|
+
MIT License - See [LICENSE](LICENSE) for details.
|
|
757
614
|
|
|
758
615
|
---
|
|
759
616
|
|
|
760
617
|
<div align="center">
|
|
761
618
|
|
|
762
|
-
|
|
619
|
+
**Made with ❤️ by Lovely**
|
|
763
620
|
|
|
764
|
-
|
|
621
|
+
[](https://www.npmjs.com/package/ishumdz-bail)
|
|
622
|
+
[](https://github.com/lovelyofficial/ishumdz-bail)
|
|
765
623
|
|
|
766
624
|
</div>
|
|
767
|
-
|
|
768
|
-
---
|
|
769
|
-
|
|
770
|
-
## 📄 License
|
|
771
|
-
|
|
772
|
-
MIT
|