@ranstech/bails 1.1.2 → 1.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,21 +1,9 @@
1
- # <div align='center'>Baileys - Typescript/Javascript WhatsApp Web API</div>
1
+ # WhatsApp Baileys Badzz
2
2
 
3
3
  <p align="center">
4
4
  <img src="https://img2.pixhost.to/images/8783/741643401_papaqueen.jpg" alt="Thumbnail" />
5
5
  </p>
6
6
 
7
- <div align='center'>
8
-
9
- ![GitHub Downloads (all assets, all releases)](https://img.shields.io/github/downloads/whiskeysockets/baileys/total)
10
- ![NPM Downloads](https://img.shields.io/npm/dw/%40whiskeysockets%2Fbaileys?label=npm&color=%23CB3837)
11
- ![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/whiskeysockets/baileys)
12
- ![GitHub License](https://img.shields.io/github/license/whiskeysockets/baileys)
13
- ![Discord](https://img.shields.io/discord/725839806084546610?label=discord&color=%235865F2)
14
- ![GitHub Repo stars](https://img.shields.io/github/stars/whiskeysockets/baileys)
15
- ![GitHub forks](https://img.shields.io/github/forks/whiskeysockets/baileys)
16
-
17
- </div>
18
-
19
7
  WhatsApp Baileys is an open-source library designed to help developers build automation solutions and integrations with WhatsApp efficiently and directly. Using websocket technology without the need for a browser, this library supports a wide range of features such as message management, chat handling, group administration, as well as interactive messages and action buttons for a more dynamic user experience.
20
8
 
21
9
  Actively developed and maintained, baileys continuously receives updates to enhance stability and performance. One of the main focuses is to improve the pairing and authentication processes to be more stable and secure. Pairing features can be customized with your own codes, making the process more reliable and less prone to interruptions.
@@ -45,419 +33,339 @@ Begin by installing the library via your preferred package manager, then follow
45
33
 
46
34
  ## Add Function ( Simple code )
47
35
 
48
- # RansK2 Baileys
49
-
50
- Simple WhatsApp Web API Library Based On Baileys.
51
-
52
- ---
53
-
54
- # Installation
55
-
56
- ### Install Package
57
-
58
- Install package using npm.
59
-
60
- ```bash
61
- npm install @ranstech/bails
62
- ```
63
-
64
- ---
65
-
66
- # Import
67
-
68
- ### CommonJS
69
-
70
- Import package using require.
36
+ ### Check ID Channel
37
+ Get ID channel
71
38
 
72
39
  ```javascript
73
- const {
74
- default: makeWASocket
75
- } = require("@ranstech/bails");
40
+ await sock.newsletterId(url)
76
41
  ```
77
42
 
78
- ---
79
-
80
- ### ES Module
81
-
82
- Import package using ES Module.
43
+ ### Check banned number
44
+ You can see the status of blocked numbers here
83
45
 
84
46
  ```javascript
85
- import makeWASocket from "@ranstech/bails";
47
+ await sock.checkWhatsApp(target)
86
48
  ```
87
49
 
88
50
  ---
89
51
 
90
- # Connection Documentation
91
-
92
- ### Connect With QR Code
52
+ ## SendMessage Documentation
93
53
 
94
- Connect WhatsApp using QR authentication.
54
+ ### Status Group Message V2
55
+ Send group status with version 2
95
56
 
96
57
  ```javascript
97
- const {
98
- default: makeWASocket,
99
- Browsers
100
- } = require("@ranstech/bails");
101
-
102
- const client = makeWASocket({
103
- browser: Browsers.ubuntu("Chrome"),
104
- printQRInTerminal: true
58
+ await sock.sendMessage(target, {
59
+ groupStatusMessage: {
60
+ text: "#rizzkezik"
61
+ }
105
62
  });
106
63
  ```
107
64
 
108
- ---
109
-
110
- ### Connect With Pairing Code
111
-
112
- Connect WhatsApp using phone number.
65
+ ### Album Message (Multiple Images)
66
+ Send multiple images in a single album message:
113
67
 
114
68
  ```javascript
115
- const {
116
- default: makeWASocket,
117
- Browsers,
118
- fetchLatestWAWebVersion
119
- } = require("@ranstech/bails");
120
-
121
- const client = makeWASocket({
122
- browser: Browsers.ubuntu("Chrome"),
123
- printQRInTerminal: false,
124
- version: fetchLatestWAWebVersion(),
125
- aiLabel: false
126
- });
127
-
128
- const code = await client.requestPairingCode("628xxxxxxxxxx");
129
-
130
- console.log(code);
69
+ await sock.sendMessage(target, {
70
+ albumMessage: [
71
+ { image: cihuy, caption: "#rizzkezik" },
72
+ { image: { url: "URL IMAGE" }, caption: "#rizzkezik" }
73
+ ]
74
+ }, { quoted: m });
131
75
  ```
132
76
 
133
- ---
134
-
135
- # Store Documentation
136
-
137
- ### In Memory Store
138
-
139
- Store contacts, chats and messages in memory.
77
+ ### Event Message
78
+ Create and send WhatsApp event invitations:
140
79
 
141
80
  ```javascript
142
- const {
143
- default: makeWASocket,
144
- makeInMemoryStore
145
- } = require("@ranstech/bails");
146
-
147
- const pino = require("pino");
148
-
149
- const store = makeInMemoryStore({
150
- logger: pino().child({
151
- level: "silent",
152
- stream: "store"
153
- })
154
- });
155
-
156
- store.bind(client.ev);
81
+ await sock.sendMessage(target, {
82
+ eventMessage: {
83
+ isCanceled: false,
84
+ name: "#rizzkezik",
85
+ description: "#rizzkezik",
86
+ location: {
87
+ degreesLatitude: 0,
88
+ degreesLongitude: 0,
89
+ name: "#rizzkezik"
90
+ },
91
+ joinLink: "https://call.whatsapp.com/video/badzzne2",
92
+ startTime: "1763019000",
93
+ endTime: "1763026200",
94
+ extraGuestsAllowed: false
95
+ }
96
+ }, { quoted: m });
157
97
  ```
158
98
 
159
- ---
160
-
161
- # Group Documentation
162
-
163
- ### Member Label
164
-
165
- Send member label inside group.
99
+ ### Poll Result Message
100
+ Display poll results with vote counts:
166
101
 
167
102
  ```javascript
168
- await client.sendMessage(jid, {
169
- groupLabel: {
170
- labelText: "Premium Member"
171
- }
172
- });
173
- ```
174
-
175
- ---
176
-
177
- ### Message Members
178
-
179
- Send message to all group members.
180
-
181
- ```javascript
182
- await client.sendMessageMembers(
183
- jid,
184
- {
185
- extendedTextMessage: {
186
- text: "Hello Members"
187
- }
188
- },
189
- {}
190
- );
191
- ```
192
-
193
- ---
194
-
195
- # Utility Documentation
196
-
197
- ### Check Channel Information
198
-
199
- Get newsletter information from URL.
200
-
201
- ```javascript
202
- client.newsletterFromUrl(url);
203
- ```
204
-
205
- Result:
206
-
207
- ```json
208
- {
209
- "name": "Channel Name",
210
- "id": "123456789",
211
- "state": "ACTIVE",
212
- "subscribers": "1000",
213
- "verification": "UNVERIFIED",
214
- "creation_time": 1728547155,
215
- "description": "Channel Description"
216
- }
217
- ```
218
-
219
- ---
220
-
221
- ### Check WhatsApp Number
222
-
223
- Check whether number exists on WhatsApp.
224
-
225
- ```javascript
226
- client.checkWhatsApp(jid);
227
- ```
228
-
229
- ---
230
-
231
- # SendMessage Documentation
232
-
233
- ### Send Text
234
-
235
- Send text message.
236
-
237
- ```javascript
238
- await client.sendText(
239
- jid,
240
- "Hello World"
241
- );
242
- ```
243
-
244
- ---
245
-
246
- ### Send Image
247
-
248
- Send image message.
249
-
250
- ```javascript
251
- await client.sendImage(
252
- jid,
253
- {
254
- url: "./image.jpg"
255
- },
256
- "Caption Here"
257
- );
258
- ```
259
-
260
- ---
261
-
262
- ### Send Video
263
-
264
- Send video message.
265
-
266
- ```javascript
267
- await client.sendVideo(
268
- jid,
269
- {
270
- url: "./video.mp4"
271
- },
272
- "Caption Here"
273
- );
103
+ await sock.sendMessage(target, {
104
+ pollResultMessage: {
105
+ name: "#rizzkezik",
106
+ pollVotes: [
107
+ {
108
+ optionName: "#rizzkezik",
109
+ optionVoteCount: "112233"
110
+ },
111
+ {
112
+ optionName: "#rizzkezik",
113
+ optionVoteCount: "1"
114
+ }
115
+ ]
116
+ }
117
+ }, { quoted: m });
274
118
  ```
275
119
 
276
- ---
277
-
278
- ### Send Audio
279
-
280
- Send audio message.
120
+ ### Simple Interactive Message
121
+ Send basic interactive messages with copy button functionality:
281
122
 
282
123
  ```javascript
283
- await client.sendAudio(
284
- jid,
285
- {
286
- url: "./audio.mp3"
124
+ await sock.sendMessage(target, {
125
+ interactiveMessage: {
126
+ header: "#rizzkezik",
127
+ title: "#rizzkezik",
128
+ footer: "telegram: @badzzne2 ",
129
+ buttons: [
130
+ {
131
+ name: "cta_copy",
132
+ buttonParamsJson: JSON.stringify({
133
+ display_text: "#rizzkezik",
134
+ id: "123456789",
135
+ copy_code: "ABC123XYZ"
136
+ })
137
+ }
138
+ ]
287
139
  }
288
- );
140
+ }, { quoted: m });
289
141
  ```
290
142
 
291
- ---
292
-
293
- ### Send Location
294
-
295
- Send location message.
143
+ ### Interactive Message with Native Flow
144
+ Send interactive messages with buttons, copy actions, and native flow features:
296
145
 
297
146
  ```javascript
298
- await client.sendLocation(
299
- jid,
300
- "RansK2",
301
- -6.2,
302
- 106.8,
303
- "https://example.com",
304
- "123456789"
305
- );
147
+ await sock.sendMessage(target, {
148
+ interactiveMessage: {
149
+ header: "#rizzkezik",
150
+ title: "#rizzkezik",
151
+ footer: "telegram: @badzzne2",
152
+ image: { url: "https://example.com/image.jpg" },
153
+ nativeFlowMessage: {
154
+ messageParamsJson: JSON.stringify({
155
+ limited_time_offer: {
156
+ text: "idk hummmm?",
157
+ url: "https://t.me/badzzne2",
158
+ copy_code: "#rizzkezik",
159
+ expiration_time: Date.now() * 999
160
+ },
161
+ bottom_sheet: {
162
+ in_thread_buttons_limit: 2,
163
+ divider_indices: [1, 2, 3, 4, 5, 999],
164
+ list_title: "#rizzkezik",
165
+ button_title: "#rizzkezik"
166
+ },
167
+ tap_target_configuration: {
168
+ title: " X ",
169
+ description: "bomboclard",
170
+ canonical_url: "https://t.me/badzzne2",
171
+ domain: "shop.example.com",
172
+ button_index: 0
173
+ }
174
+ }),
175
+ buttons: [
176
+ {
177
+ name: "single_select",
178
+ buttonParamsJson: JSON.stringify({
179
+ has_multiple_buttons: true
180
+ })
181
+ },
182
+ {
183
+ name: "call_permission_request",
184
+ buttonParamsJson: JSON.stringify({
185
+ has_multiple_buttons: true
186
+ })
187
+ },
188
+ {
189
+ name: "single_select",
190
+ buttonParamsJson: JSON.stringify({
191
+ title: "#rizzkezik",
192
+ sections: [
193
+ {
194
+ title: "title",
195
+ highlight_label: "label",
196
+ rows: [
197
+ {
198
+ title: "@badzzne2",
199
+ description: "love you",
200
+ id: "row_2"
201
+ }
202
+ ]
203
+ }
204
+ ],
205
+ has_multiple_buttons: true
206
+ })
207
+ },
208
+ {
209
+ name: "cta_copy",
210
+ buttonParamsJson: JSON.stringify({
211
+ display_text: "copy code",
212
+ id: "123456789",
213
+ copy_code: "ABC123XYZ"
214
+ })
215
+ }
216
+ ]
217
+ }
218
+ }
219
+ }, { quoted: m });
306
220
  ```
307
221
 
308
- ---
309
-
310
- ### Send Poll
311
-
312
- Create poll message.
222
+ ### Interactive Message with Thumbnail
223
+ Send interactive messages with thumbnail image and copy button:
313
224
 
314
225
  ```javascript
315
- await client.sendPoll(
316
- jid,
317
- "Choose One",
318
- [
319
- "Option 1",
320
- "Option 2",
321
- "Option 3"
322
- ],
323
- true
324
- );
325
- ```
326
-
327
- ---
328
-
329
- ### Send Quiz
330
-
331
- Create quiz poll message.
332
-
333
- ```javascript
334
- await client.sendQuiz(
335
- jid,
336
- "Question Here",
337
- [
338
- "A",
339
- "B",
340
- "C"
341
- ],
342
- "B"
343
- );
344
- ```
345
-
346
- ---
347
-
348
- ### Status Mention
349
-
350
- Mention users through status.
351
-
352
- ```javascript
353
- await client.statusMention(
354
- jid,
355
- {
356
- extendedTextMessage: {
357
- text: "Hello World"
358
- }
226
+ await sock.sendMessage(target, {
227
+ interactiveMessage: {
228
+ header: "#rizzkezik",
229
+ title: "#rizzkezik",
230
+ footer: "telegram: @badzzne2",
231
+ image: { url: "https://example.com/image.jpg" },
232
+ buttons: [
233
+ {
234
+ name: "cta_copy",
235
+ buttonParamsJson: JSON.stringify({
236
+ display_text: "copy code",
237
+ id: "123456789",
238
+ copy_code: "ABC123XYZ"
239
+ })
240
+ }
241
+ ]
359
242
  }
360
- );
243
+ }, { quoted: m });
361
244
  ```
362
245
 
363
- ---
364
-
365
- ### Interactive Message
366
-
367
- Send interactive message.
246
+ ### Product Message
247
+ Send product catalog messages with buttons and merchant information:
368
248
 
369
249
  ```javascript
370
- await client.sendMessage(
371
- jid,
372
- {
373
- image: {
374
- url: "./image.jpg"
375
- },
376
- text: "Body Message",
377
- title: "Hello World",
378
- footer: "RansK2",
379
- interactiveButtons: [
250
+ await sock.sendMessage(target, {
251
+ productMessage: {
252
+ title: "Produk Contoh",
253
+ description: "Ini adalah deskripsi produk",
254
+ thumbnail: { url: "https://example.com/image.jpg" },
255
+ productId: "PROD001",
256
+ retailerId: "RETAIL001",
257
+ url: "https://example.com/product",
258
+ body: "Detail produk",
259
+ footer: "Harga spesial",
260
+ priceAmount1000: 50000,
261
+ currencyCode: "USD",
262
+ buttons: [
380
263
  {
381
- name: "single_select",
264
+ name: "cta_url",
382
265
  buttonParamsJson: JSON.stringify({
383
- title: "Menu"
266
+ display_text: "Beli Sekarang",
267
+ url: "https://example.com/buy"
384
268
  })
385
269
  }
386
270
  ]
387
271
  }
388
- );
272
+ }, { quoted: m });
389
273
  ```
390
274
 
391
- ---
392
-
393
- ### Product Message
394
-
395
- Send product catalog message.
275
+ ### Interactive Message with Document Buffer
276
+ Send interactive messages with document from buffer (file system) - **Note: Documents only support buffer**:
396
277
 
397
278
  ```javascript
398
- await client.sendMessage(
399
- jid,
400
- {
401
- productMessage: {
402
- title: "RansK2 Product",
403
- description: "Product Description",
404
- thumbnail: {
405
- url: "./thumbnail.jpg"
406
- },
407
- productId: "PRODUCT_ID",
408
- retailerId: "RETAILER_ID",
409
- url: "https://example.com",
410
- body: "Product Body",
411
- footer: "Footer Product",
412
- priceAmount1000: 50000,
413
- currencyCode: "IDR"
414
- }
279
+ await sock.sendMessage(target, {
280
+ interactiveMessage: {
281
+ header: "#rizzkezik",
282
+ title: "#rizzkezik",
283
+ footer: "telegram: @badzzne2",
284
+ document: fs.readFileSync("./package.json"),
285
+ mimetype: "application/pdf",
286
+ fileName: "badzzne2.pdf",
287
+ jpegThumbnail: fs.readFileSync("./document.jpeg"),
288
+ contextInfo: {
289
+ mentionedJid: [target],
290
+ forwardingScore: 777,
291
+ isForwarded: false
292
+ },
293
+ externalAdReply: {
294
+ title: "#rizzkezik",
295
+ body: "#rizzkezik",
296
+ mediaType: 3,
297
+ thumbnailUrl: "https://example.com/image.jpg",
298
+ mediaUrl: " X ",
299
+ sourceUrl: "https://t.me/badzzne2",
300
+ showAdAttribution: true,
301
+ renderLargerThumbnail: false
302
+ },
303
+ buttons: [
304
+ {
305
+ name: "cta_url",
306
+ buttonParamsJson: JSON.stringify({
307
+ display_text: "Telegram",
308
+ url: "https://t.me/badzzne2",
309
+ merchant_url: "https://t.me/badzzne2"
310
+ })
311
+ }
312
+ ]
415
313
  }
416
- );
314
+ }, { quoted: m });
417
315
  ```
418
316
 
419
- ---
420
-
421
- ### Order Message
422
-
423
- Send order message.
317
+ ### Interactive Message with Document Buffer (Simple)
318
+ Send interactive messages with document from buffer (file system) without contextInfo and externalAdReply - **Note: Documents only support buffer**:
424
319
 
425
320
  ```javascript
426
- await client.sendMessage(
427
- jid,
428
- {
429
- thumbnail: thumbnailBuffer,
430
- message: "Order Example",
431
- orderTitle: "RansK2 Store",
432
- totalAmount1000: 50000,
433
- totalCurrencyCode: "IDR"
321
+ await sock.sendMessage(target, {
322
+ interactiveMessage: {
323
+ header: "#rizzkezik",
324
+ title: "#rizzkezik",
325
+ footer: "telegram: @badzzne2",
326
+ document: fs.readFileSync("./package.json"),
327
+ mimetype: "application/pdf",
328
+ fileName: "badzzne2.pdf",
329
+ jpegThumbnail: fs.readFileSync("./document.jpeg"),
330
+ buttons: [
331
+ {
332
+ name: "cta_url",
333
+ buttonParamsJson: JSON.stringify({
334
+ display_text: "Telegram",
335
+ url: "https://t.me/badzzne2",
336
+ merchant_url: "https://t.me/badzzne2"
337
+ })
338
+ }
339
+ ]
434
340
  }
435
- );
341
+ }, { quoted: m });
436
342
  ```
437
343
 
438
- ---
439
-
440
- ### Poll Result Snapshot
441
-
442
- Display poll result snapshot.
344
+ ### Request Payment Message
345
+ Send payment request messages with custom background and sticker:
443
346
 
444
347
  ```javascript
445
- await client.sendMessage(
446
- jid,
447
- {
448
- pollResultMessage: {
449
- name: "Example Poll",
450
- options: [
451
- {
452
- optionName: "Option 1"
453
- },
454
- {
455
- optionName: "Option 2"
456
- }
457
- ]
348
+ let quotedType = m.quoted?.mtype || '';
349
+ let quotedContent = JSON.stringify({ [quotedType]: m.quoted }, null, 2);
350
+
351
+ await sock.sendMessage(target, {
352
+ requestPaymentMessage: {
353
+ currency: "IDR",
354
+ amount: 10000000,
355
+ from: m.sender,
356
+ sticker: JSON.parse(quotedContent),
357
+ background: {
358
+ id: "100",
359
+ fileLength: "0",
360
+ width: 1000,
361
+ height: 1000,
362
+ mimetype: "image/webp",
363
+ placeholderArgb: 0xFF00FFFF,
364
+ textArgb: 0xFFFFFFFF,
365
+ subtextArgb: 0xFFAA00FF
458
366
  }
459
367
  }
460
- );
368
+ }, { quoted: m });
461
369
  ```
462
370
 
463
371
  ---
@@ -509,6 +417,12 @@ Thanks to the following awesome contributors who help improve this project 💖
509
417
  <sub><b>RansK2</b></sub>
510
418
  </a>
511
419
  </td>
420
+ <td align="center">
421
+ <a href="https://github.com/alannzxd">
422
+ <img src="https://github.com/alannzxd.png" width="80px;" style="border-radius:50%;" alt="Developer"/>
423
+ <br />
424
+ <sub><b>AlanXd</b></sub>
425
+ </a>
426
+ </td>
512
427
  </tr>
513
- </table>
514
-
428
+ </table>