ishumdz-bail 1.0.9 → 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 +211 -457
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,26 +1,60 @@
|
|
|
1
1
|
<div align="center">
|
|
2
2
|
|
|
3
3
|
```
|
|
4
|
-
|
|
5
|
-
║
|
|
6
|
-
|
|
7
|
-
║
|
|
8
|
-
║
|
|
9
|
-
║
|
|
10
|
-
║
|
|
11
|
-
║
|
|
12
|
-
║
|
|
13
|
-
║
|
|
14
|
-
║
|
|
15
|
-
║
|
|
16
|
-
║
|
|
17
|
-
║
|
|
18
|
-
║
|
|
19
|
-
║
|
|
20
|
-
║
|
|
21
|
-
║
|
|
22
|
-
║
|
|
23
|
-
|
|
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
|
+
```
|
|
45
|
+
|
|
46
|
+
<br/>
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
██╗ ██╗██████╗ █████╗ ███████╗████████╗
|
|
50
|
+
██║ ██║██╔══██╗██╔══██╗██╔════╝╚══██╔══╝
|
|
51
|
+
███████║██████╔╝███████║███████╗ ██║
|
|
52
|
+
██╔══██║██╔══██╗██╔══██║╚════██║ ██║
|
|
53
|
+
██║ ██║██████╔╝██║ ██║███████║ ██║
|
|
54
|
+
╚═╝ ╚═╝╚═════╝ ╚═╝ ╚═╝╚══════╝ ╚═╝
|
|
55
|
+
|
|
56
|
+
WhatsApp Web API Fork
|
|
57
|
+
By Lovely ❤️
|
|
24
58
|
```
|
|
25
59
|
|
|
26
60
|
<img src="https://i.postimg.cc/9Q6q2Pv6/IMG-20260925-WA4965.jpg" alt="ishumdz-bail" width="700" />
|
|
@@ -40,55 +74,12 @@ Built on WebSocket for speed, stability, and full multi-device support.
|
|
|
40
74
|
|
|
41
75
|
---
|
|
42
76
|
|
|
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)
|
|
61
|
-
|
|
62
|
-
---
|
|
63
|
-
|
|
64
|
-
## ✨ What is ishumdz-bail?
|
|
65
|
-
|
|
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.
|
|
67
|
-
|
|
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
|
-
```
|
|
79
|
-
|
|
80
|
-
---
|
|
81
|
-
|
|
82
77
|
## 🚀 Installation
|
|
83
78
|
|
|
84
79
|
```bash
|
|
85
80
|
npm install ishumdz-bail
|
|
86
81
|
```
|
|
87
82
|
|
|
88
|
-
**Requirements:**
|
|
89
|
-
- Node.js ≥ 20
|
|
90
|
-
- npm or yarn
|
|
91
|
-
|
|
92
83
|
---
|
|
93
84
|
|
|
94
85
|
## ⚡ Quick Start
|
|
@@ -102,200 +93,82 @@ const sock = makeWASocket({
|
|
|
102
93
|
auth: state,
|
|
103
94
|
syncFullHistory: false,
|
|
104
95
|
aiLabel: true,
|
|
105
|
-
autoAnswer: false,
|
|
106
96
|
});
|
|
107
97
|
|
|
98
|
+
attachProMethods(sock);
|
|
99
|
+
|
|
108
100
|
sock.ev.on('creds.update', saveCreds);
|
|
109
101
|
|
|
110
102
|
sock.ev.on('connection.update', ({ connection }) => {
|
|
111
103
|
if (connection === 'open') {
|
|
112
|
-
console.log('✅ Connected
|
|
113
|
-
|
|
114
|
-
// Attach Pro methods
|
|
115
|
-
attachProMethods(sock);
|
|
104
|
+
console.log('✅ Connected!');
|
|
116
105
|
}
|
|
117
106
|
});
|
|
118
107
|
```
|
|
119
108
|
|
|
120
109
|
---
|
|
121
110
|
|
|
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
|
-
```
|
|
162
|
-
|
|
163
|
-
---
|
|
164
|
-
|
|
165
111
|
## 🎮 Games
|
|
166
112
|
|
|
167
|
-
8 built-in games for your WhatsApp bot:
|
|
168
|
-
|
|
169
113
|
```javascript
|
|
170
114
|
const { blackjack, slotMachine, diceGame, coinFlip, roulette, rps, trivia, createMines } = require('ishumdz-bail');
|
|
171
|
-
```
|
|
172
115
|
|
|
173
|
-
|
|
116
|
+
// 🃏 Blackjack
|
|
117
|
+
const bj = blackjack('start', [], [], 100);
|
|
118
|
+
// bj.playerHand, bj.dealerHand, bj.status
|
|
174
119
|
|
|
175
|
-
|
|
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'
|
|
181
|
-
|
|
182
|
-
// Hit (draw card)
|
|
183
|
-
const hit = blackjack('hit', game.playerHand, game.dealerHand, 100);
|
|
184
|
-
|
|
185
|
-
// Stand (end turn)
|
|
186
|
-
const stand = blackjack('stand', game.playerHand, game.dealerHand, 100);
|
|
187
|
-
console.log(stand.status); // 'win', 'lose', or 'push'
|
|
188
|
-
```
|
|
189
|
-
|
|
190
|
-
### 🎰 Slots
|
|
191
|
-
|
|
192
|
-
```javascript
|
|
120
|
+
// 🎰 Slots
|
|
193
121
|
const slots = slotMachine(100);
|
|
194
|
-
|
|
195
|
-
console.log(slots.payout); // 0-500 (multiplier)
|
|
196
|
-
```
|
|
197
|
-
|
|
198
|
-
### 🎲 Dice
|
|
199
|
-
|
|
200
|
-
```javascript
|
|
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
|
|
206
|
-
```
|
|
207
|
-
|
|
208
|
-
### 🪙 Coin Flip
|
|
209
|
-
|
|
210
|
-
```javascript
|
|
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
|
-
```
|
|
122
|
+
// slots.reels, slots.payout
|
|
215
123
|
|
|
216
|
-
|
|
124
|
+
// 🎲 Dice
|
|
125
|
+
const dice = diceGame(100, 'high');
|
|
126
|
+
// dice.total, dice.dice1, dice.dice2
|
|
217
127
|
|
|
218
|
-
|
|
219
|
-
const
|
|
220
|
-
|
|
221
|
-
console.log(spin.color); // 'red', 'black', or 'green'
|
|
222
|
-
console.log(spin.payout); // 0-3600
|
|
223
|
-
```
|
|
128
|
+
// 🪙 Coin Flip
|
|
129
|
+
const flip = coinFlip(100, 'heads');
|
|
130
|
+
// flip.result, flip.payout
|
|
224
131
|
|
|
225
|
-
|
|
132
|
+
// 🎡 Roulette
|
|
133
|
+
const spin = roulette(100, 'red');
|
|
134
|
+
// spin.number, spin.color
|
|
226
135
|
|
|
227
|
-
|
|
228
|
-
const game = rps('rock');
|
|
229
|
-
|
|
230
|
-
console.log(game.botChoice); // 'paper'
|
|
231
|
-
console.log(game.result); // 'win', 'lose', or 'draw'
|
|
232
|
-
```
|
|
136
|
+
// ✊ Rock Paper Scissors
|
|
137
|
+
const game = rps('rock');
|
|
138
|
+
// game.playerChoice, game.botChoice, game.result
|
|
233
139
|
|
|
234
|
-
|
|
140
|
+
// 🧠 Trivia
|
|
141
|
+
const q = trivia(100);
|
|
142
|
+
// q.question, q.options, q.answer
|
|
235
143
|
|
|
236
|
-
|
|
237
|
-
const
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
console.log(question.answer); // 'A'
|
|
241
|
-
```
|
|
242
|
-
|
|
243
|
-
### 💣 Mines
|
|
244
|
-
|
|
245
|
-
```javascript
|
|
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
|
|
144
|
+
// 💣 Mines
|
|
145
|
+
const mines = createMines(5, 5, 5);
|
|
146
|
+
const tile = revealTile(mines, 0, 0);
|
|
147
|
+
const cashout = cashoutMines(mines, 100);
|
|
258
148
|
```
|
|
259
149
|
|
|
260
150
|
---
|
|
261
151
|
|
|
262
152
|
## 📞 VoIP Caller
|
|
263
153
|
|
|
264
|
-
Answer incoming WhatsApp calls with audio playback:
|
|
265
|
-
|
|
266
154
|
```javascript
|
|
267
155
|
const { makeWASocket, enableCallAutoAnswer, getActiveVoipClient } = require('ishumdz-bail');
|
|
268
156
|
|
|
269
157
|
const sock = makeWASocket({ auth: state });
|
|
270
158
|
|
|
271
|
-
//
|
|
159
|
+
// Auto-answer calls with audio
|
|
272
160
|
sock.enableCallAutoAnswer({
|
|
273
|
-
audio: './welcome.wav',
|
|
274
|
-
autoAnswer: true,
|
|
275
|
-
answerDelayMs: 200,
|
|
276
|
-
durationMs: 60000,
|
|
277
|
-
loop: true
|
|
278
|
-
onCall: (call) => {}, // Incoming call callback
|
|
279
|
-
onAnswer: (call) => {}, // Answered callback
|
|
280
|
-
onEnd: (call, reason) => {} // Ended callback
|
|
161
|
+
audio: './welcome.wav',
|
|
162
|
+
autoAnswer: true,
|
|
163
|
+
answerDelayMs: 200,
|
|
164
|
+
durationMs: 60000,
|
|
165
|
+
loop: true
|
|
281
166
|
});
|
|
282
|
-
```
|
|
283
|
-
|
|
284
|
-
### Manual Call Handling
|
|
285
167
|
|
|
286
|
-
|
|
168
|
+
// Manual call handling
|
|
287
169
|
sock.ev.on('call', async ([call]) => {
|
|
288
170
|
if (call.status === 'offer') {
|
|
289
|
-
console.log(`📞 Incoming ${call.isVideo ? 'video' : 'voice'} call from ${call.from}`);
|
|
290
|
-
|
|
291
|
-
// Reject call
|
|
292
171
|
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');
|
|
298
|
-
}
|
|
299
172
|
}
|
|
300
173
|
});
|
|
301
174
|
```
|
|
@@ -304,160 +177,82 @@ sock.ev.on('call', async ([call]) => {
|
|
|
304
177
|
|
|
305
178
|
## ⚡ Pro Methods
|
|
306
179
|
|
|
307
|
-
34 convenience methods for easier development:
|
|
308
|
-
|
|
309
180
|
```javascript
|
|
310
181
|
const { makeWASocket, attachProMethods } = require('ishumdz-bail');
|
|
311
182
|
|
|
312
183
|
const sock = makeWASocket({ auth: state });
|
|
313
|
-
attachProMethods(sock); // Attach all Pro methods
|
|
184
|
+
attachProMethods(sock); // Attach all 34 Pro methods
|
|
314
185
|
```
|
|
315
186
|
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
## 📊 Polls
|
|
187
|
+
### 📊 Polls
|
|
319
188
|
|
|
320
189
|
```javascript
|
|
321
|
-
|
|
322
|
-
await sock.
|
|
323
|
-
|
|
324
|
-
values: ['Red', 'Blue', 'Green', 'Yellow'],
|
|
325
|
-
selectableCount: 1
|
|
326
|
-
});
|
|
327
|
-
|
|
328
|
-
// Vote on a poll
|
|
329
|
-
await sock.sendPollVote(jid, pollMessage, ['Red']);
|
|
330
|
-
|
|
331
|
-
// Get poll results
|
|
332
|
-
const votes = sock.getAggregatePollVotes(pollMessage);
|
|
190
|
+
await sock.sendPoll(jid, { name: 'Vote?', values: ['Yes', 'No'] });
|
|
191
|
+
await sock.sendPollVote(jid, pollMsg, ['Yes']);
|
|
192
|
+
const votes = sock.getAggregatePollVotes(pollMsg);
|
|
333
193
|
```
|
|
334
194
|
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
## 📢 Newsletter/Channels
|
|
195
|
+
### 📢 Newsletter/Channels
|
|
338
196
|
|
|
339
197
|
```javascript
|
|
340
|
-
|
|
341
|
-
await sock.
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
await sock.newsletterReact(channelJid, serverId, '👍');
|
|
345
|
-
|
|
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
|
|
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');
|
|
353
202
|
const channels = await sock.newsletterList();
|
|
354
203
|
```
|
|
355
204
|
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
## 🟢 Status/Stories
|
|
205
|
+
### 🟢 Status/Stories
|
|
359
206
|
|
|
360
207
|
```javascript
|
|
361
|
-
|
|
362
|
-
await sock.
|
|
363
|
-
|
|
364
|
-
font: 1
|
|
365
|
-
});
|
|
366
|
-
|
|
367
|
-
// Send media status
|
|
368
|
-
await sock.sendStatusMedia('./photo.jpg', {
|
|
369
|
-
type: 'image',
|
|
370
|
-
caption: 'My status!'
|
|
371
|
-
});
|
|
372
|
-
|
|
373
|
-
// React to status
|
|
374
|
-
await sock.reactStatus(statusKey, '❤️');
|
|
208
|
+
await sock.sendStatusText('Hello!', { backgroundColor: '#25D366' });
|
|
209
|
+
await sock.sendStatusMedia('./photo.jpg', { type: 'image' });
|
|
210
|
+
await sock.reactStatus(key, '❤️');
|
|
375
211
|
```
|
|
376
212
|
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
## 💬 Chat Actions
|
|
213
|
+
### 💬 Chat
|
|
380
214
|
|
|
381
215
|
```javascript
|
|
382
|
-
|
|
383
|
-
await sock.
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
await sock.
|
|
387
|
-
|
|
388
|
-
// Pin a message (86400 = 24h, 604800 = 7d, 2592000 = 30d)
|
|
389
|
-
await sock.pinMessage(jid, messageKey, 86400);
|
|
390
|
-
|
|
391
|
-
// Unpin a message
|
|
392
|
-
await sock.unpinMessage(jid, messageKey);
|
|
393
|
-
|
|
394
|
-
// Star/unstar a message
|
|
395
|
-
await sock.starMessage(jid, messageKey, true);
|
|
396
|
-
|
|
397
|
-
// React to a message
|
|
398
|
-
await sock.reactMessage(jid, messageKey, '😂');
|
|
399
|
-
|
|
400
|
-
// Send presence (typing indicator)
|
|
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, '😂');
|
|
401
221
|
await sock.sendPresence(jid, 'composing');
|
|
402
|
-
|
|
403
|
-
// Quick reply with quote
|
|
404
|
-
await sock.reply(jid, 'This is a reply!', quotedMessage);
|
|
222
|
+
await sock.reply(jid, 'Reply!', quotedMsg);
|
|
405
223
|
```
|
|
406
224
|
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
## 👥 Group Management
|
|
225
|
+
### 👥 Groups
|
|
410
226
|
|
|
411
227
|
```javascript
|
|
412
|
-
// Get group info from invite link
|
|
413
228
|
const info = await sock.groupGetInviteInfo('https://chat.whatsapp.com/xxx');
|
|
414
|
-
|
|
415
|
-
// Join group via invite
|
|
416
229
|
await sock.groupJoinViaInvite('https://chat.whatsapp.com/xxx');
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
await sock.
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
await sock.groupSetLocked(groupJid, true);
|
|
423
|
-
|
|
424
|
-
// Manage join requests
|
|
425
|
-
const requests = await sock.groupRequestParticipantsList(groupJid);
|
|
426
|
-
await sock.groupApproveParticipants(groupJid, [participant1, participant2]);
|
|
427
|
-
await sock.groupRejectParticipants(groupJid, [participant3]);
|
|
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]);
|
|
428
235
|
```
|
|
429
236
|
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
## 👤 Profile Management
|
|
237
|
+
### 👤 Profile
|
|
433
238
|
|
|
434
239
|
```javascript
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
// Update bio
|
|
440
|
-
await sock.setBio('Hello, I am a bot!');
|
|
441
|
-
|
|
442
|
-
// Update display name
|
|
443
|
-
await sock.updateProfileName('My Bot');
|
|
444
|
-
|
|
445
|
-
// Set profile picture
|
|
240
|
+
const check = await sock.checkNumber('1234567890');
|
|
241
|
+
await sock.setBio('My bot');
|
|
242
|
+
await sock.updateProfileName('Bot Name');
|
|
446
243
|
await sock.setProfilePicture(jid, './avatar.jpg');
|
|
447
|
-
|
|
448
|
-
// Remove profile picture
|
|
449
244
|
await sock.removeProfilePicture(jid);
|
|
245
|
+
await sock.rejectCall(callId, callFrom);
|
|
450
246
|
```
|
|
451
247
|
|
|
452
248
|
---
|
|
453
249
|
|
|
454
|
-
## 📰 Newsletter Media
|
|
455
|
-
|
|
456
|
-
Upload media to channels with correct paths:
|
|
250
|
+
## 📰 Newsletter Media Paths
|
|
457
251
|
|
|
458
252
|
```javascript
|
|
459
253
|
const { NEWSLETTER_MEDIA_PATH_MAP } = require('ishumdz-bail');
|
|
460
254
|
|
|
255
|
+
// All paths for channel uploads
|
|
461
256
|
console.log(NEWSLETTER_MEDIA_PATH_MAP);
|
|
462
257
|
// {
|
|
463
258
|
// image: '/newsletter/newsletter-image',
|
|
@@ -473,144 +268,103 @@ console.log(NEWSLETTER_MEDIA_PATH_MAP);
|
|
|
473
268
|
|
|
474
269
|
---
|
|
475
270
|
|
|
476
|
-
##
|
|
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 |
|
|
540
|
-
|
|
541
|
-
---
|
|
542
|
-
|
|
543
|
-
## 📝 Examples
|
|
544
|
-
|
|
545
|
-
### Basic Bot
|
|
271
|
+
## 📋 All Features List
|
|
546
272
|
|
|
547
|
-
```javascript
|
|
548
|
-
const { makeWASocket, useMultiFileAuthState, attachProMethods } = require('ishumdz-bail');
|
|
549
|
-
|
|
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
|
-
}
|
|
570
|
-
|
|
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);
|
|
575
|
-
}
|
|
576
|
-
}
|
|
577
|
-
});
|
|
578
|
-
}
|
|
579
|
-
|
|
580
|
-
startBot();
|
|
581
273
|
```
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
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
|
+
└─────────────────────────────────────────────────────────────────────────────┘
|
|
607
361
|
```
|
|
608
362
|
|
|
609
363
|
---
|
|
610
364
|
|
|
611
365
|
## 📄 License
|
|
612
366
|
|
|
613
|
-
MIT License
|
|
367
|
+
MIT License
|
|
614
368
|
|
|
615
369
|
---
|
|
616
370
|
|