ishumdz-bail 1.0.7 → 1.0.8
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 +220 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -91,9 +91,229 @@ sock.ev.on('creds.update', saveCreds)
|
|
|
91
91
|
| 😀 **Newsletter Reactions** | React to channel messages with emojis, track votes, and manage newsletter engagement |
|
|
92
92
|
| 📊 **Poll Voting** | Create polls, track encrypted votes, display results, and support multiple selection polls |
|
|
93
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 |
|
|
94
96
|
|
|
95
97
|
---
|
|
96
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
|
+
---
|
|
139
|
+
|
|
140
|
+
## ⚡ Pro Methods
|
|
141
|
+
|
|
142
|
+
34 convenience methods attached to socket via `attachProMethods()`:
|
|
143
|
+
|
|
144
|
+
```javascript
|
|
145
|
+
const { makeWASocket, attachProMethods } = require('ishumdz-bail');
|
|
146
|
+
|
|
147
|
+
const sock = makeWASocket({ auth: state });
|
|
148
|
+
attachProMethods(sock); // Attach all Pro methods
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### 📊 Polls Pro
|
|
152
|
+
|
|
153
|
+
```javascript
|
|
154
|
+
// Create a poll
|
|
155
|
+
await sock.sendPoll(jid, {
|
|
156
|
+
name: 'What is your favorite color?',
|
|
157
|
+
values: ['Red', 'Blue', 'Green', 'Yellow'],
|
|
158
|
+
selectableCount: 1
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
// Vote on a poll
|
|
162
|
+
await sock.sendPollVote(jid, pollMessage, ['Red']);
|
|
163
|
+
|
|
164
|
+
// Get poll results
|
|
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
|
+
});
|
|
195
|
+
|
|
196
|
+
// Send media status
|
|
197
|
+
await sock.sendStatusMedia('./photo.jpg', {
|
|
198
|
+
type: 'image',
|
|
199
|
+
caption: 'My status!'
|
|
200
|
+
});
|
|
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
|
+
```
|
|
271
|
+
|
|
272
|
+
---
|
|
273
|
+
|
|
274
|
+
## 🎮 Built-in Games
|
|
275
|
+
|
|
276
|
+
8 fun games for your WhatsApp bot:
|
|
277
|
+
|
|
278
|
+
```javascript
|
|
279
|
+
const { blackjack, slotMachine, diceGame, coinFlip, roulette, rps, trivia, createMines } = require('ishumdz-bail');
|
|
280
|
+
|
|
281
|
+
// Blackjack
|
|
282
|
+
const game = blackjack('start', [], [], 100); // Start with 100 bet
|
|
283
|
+
// game.playerHand, game.dealerHand, game.status
|
|
284
|
+
|
|
285
|
+
// Slots
|
|
286
|
+
const slots = slotMachine(100);
|
|
287
|
+
// slots.reels, slots.payout
|
|
288
|
+
|
|
289
|
+
// Dice
|
|
290
|
+
const dice = diceGame(100, 'high'); // Bet on high (7-12)
|
|
291
|
+
// dice.total, dice.dice1, dice.dice2
|
|
292
|
+
|
|
293
|
+
// Coin Flip
|
|
294
|
+
const flip = coinFlip(100, 'heads');
|
|
295
|
+
// flip.result, flip.payout
|
|
296
|
+
|
|
297
|
+
// Roulette
|
|
298
|
+
const spin = roulette(100, 'red');
|
|
299
|
+
// spin.number, spin.color, spin.payout
|
|
300
|
+
|
|
301
|
+
// Rock Paper Scissors
|
|
302
|
+
const game = rps('rock');
|
|
303
|
+
// game.playerChoice, game.botChoice, game.result
|
|
304
|
+
|
|
305
|
+
// Trivia
|
|
306
|
+
const question = trivia(100);
|
|
307
|
+
// question.question, question.options, question.answer
|
|
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
|
+
|
|
97
317
|
## 💬 Rich Response (GenAI Bubble)
|
|
98
318
|
|
|
99
319
|
Send messages that render as Meta AI-style bubbles inside WhatsApp. Supports multiple primitives in a single message:
|