@devil-fight/baileys 1.0.0 → 1.0.1

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,114 +1,393 @@
1
- # Modified Whatsapp-API
2
- <p align='center'>
3
- <img src="https://files.catbox.moe/ndhd4z.jpg" width="172">
1
+ # WhatsApp Baileys
2
+
3
+ <p align="center">
4
+ <img src="https://files.catbox.moe/369pux.jpg" alt="Thumbnail" />
4
5
  </p>
5
6
 
6
- ---
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.
8
+
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.
10
+
11
+ This library is highly suitable for building business bots, chat automation systems, customer service solutions, and various other communication automation applications that require high stability and comprehensive features. With a lightweight and modular design, baileys is easy to integrate into different systems and platforms.
12
+
13
+ ---
14
+
15
+ ### Main Features and Advantages
16
+
17
+ - Supports automatic and custom pairing processes
18
+ - Fixes previous pairing issues that often caused failures or disconnections
19
+ - Supports interactive messages, action buttons, and dynamic menus
20
+ - Efficient automatic session management for reliable operation
21
+ - Compatible with the latest multi-device features from WhatsApp
22
+ - Lightweight, stable, and easy to integrate into various systems
23
+ - Suitable for developing bots, automation, and complete communication solutions
24
+ - Comprehensive documentation and example codes to facilitate development
25
+
26
+ ---
7
27
 
8
- ## Usage
9
- ```json
10
- "depencies": {
11
- "vinzzknight": "latest"
12
- }
28
+ ## Getting Started
29
+
30
+ Begin by installing the library via your preferred package manager, then follow the provided configuration guide. You can also utilize the ready-made example codes to understand how the features work. Use session storage and interactive messaging features to build complete, stable solutions tailored to your business or project needs.
31
+
32
+ ---
33
+
34
+ ## Add Function ( Simple code )
35
+
36
+ ### Check ID Channel
37
+ Get ID channel
38
+
39
+ ```javascript
40
+ await sock.newsletterId(url)
13
41
  ```
14
- ## Import
42
+
43
+ ### Check banned number
44
+ You can see the status of blocked numbers here
45
+
15
46
  ```javascript
16
- const {
17
- default:makeWASocket,
18
- // Other Options
19
- } = require('vinzzknight');
47
+ await sock.checkWhatsApp(jid)
20
48
  ```
21
49
 
22
50
  ---
23
- # How To Connect To Whatsapp
24
- ## With QR Code
51
+
52
+ ## SendMessage Documentation
53
+
54
+ ### Status Group Message V2
55
+ Send group status with version 2
56
+
25
57
  ```javascript
26
- const {
27
- default: makeWASocket
28
- } = require('vinzzknight');
29
-
30
- const client = makeWASocket({
31
- browser: ['Ubuntu', 'Chrome', '20.00.1'],
32
- printQRInTerminal: true
33
- })
58
+ await sock.sendMessage(jid, {
59
+ groupStatusMessage: {
60
+ text: "Hello World"
61
+ }
62
+ });
34
63
  ```
35
64
 
36
- ## Connect With Number
65
+ ### Album Message (Multiple Images)
66
+ Send multiple images in a single album message:
67
+
37
68
  ```javascript
38
- const {
39
- default: makeWASocket,
40
- fetchLatestWAWebVersion
41
- } = require('vinzzknight');
42
-
43
- const client = makeWASocket({
44
- browser: ['Ubuntu', 'Chrome', '20.00.1'],
45
- printQRInTerminal: false,
46
- version: fetchLatestWAWebVersion()
47
- // Other options
48
- });
69
+ await sock.sendMessage(jid, {
70
+ albumMessage: [
71
+ { image: cihuy, caption: "Foto pertama" },
72
+ { image: { url: "URL IMAGE" }, caption: "Foto kedua" }
73
+ ]
74
+ }, { quoted: m });
75
+ ```
49
76
 
50
- const number = "628XXXXX";
51
- const code = await client.requestPairingCode(number.trim) /* Use : (number, "YYYYYYYY") for custom-pairing */
77
+ ### Event Message
78
+ Create and send WhatsApp event invitations:
52
79
 
53
- console.log("Ur pairing code : " + "VINZZJSS")
80
+ ```javascript
81
+ await sock.sendMessage(jid, {
82
+ eventMessage: {
83
+ isCanceled: false,
84
+ name: "Hello World",
85
+ description: "yume native",
86
+ location: {
87
+ degreesLatitude: 0,
88
+ degreesLongitude: 0,
89
+ name: "rowrrrr"
90
+ },
91
+ joinLink: "https://call.whatsapp.com/video/yumevtc",
92
+ startTime: "1763019000",
93
+ endTime: "1763026200",
94
+ extraGuestsAllowed: false
95
+ }
96
+ }, { quoted: m });
54
97
  ```
55
98
 
56
- # Sending messages
99
+ ### Poll Result Message
100
+ Display poll results with vote counts:
57
101
 
58
- ## send orderMessage
59
102
  ```javascript
60
- const fs = require('fs');
61
- const vinzzImg = fs.readFileSync('./VinzzImage');
62
-
63
- await client.sendMessage(m.chat, {
64
- thumbnail: vinzz,
65
- message: "Gotta get a grip",
66
- orderTitle: "Vinzz-Developer",
67
- totalAmount1000: 72502,
68
- totalCurrencyCode: "IDR"
69
- }, { quoted:m })
103
+ await sock.sendMessage(jid, {
104
+ pollResultMessage: {
105
+ name: "Hello World",
106
+ pollVotes: [
107
+ {
108
+ optionName: "TEST 1",
109
+ optionVoteCount: "112233"
110
+ },
111
+ {
112
+ optionName: "TEST 2",
113
+ optionVoteCount: "1"
114
+ }
115
+ ]
116
+ }
117
+ }, { quoted: m });
70
118
  ```
71
119
 
72
- ## send pollResultSnapshotMessage
120
+ ### Simple Interactive Message
121
+ Send basic interactive messages with copy button functionality:
122
+
73
123
  ```javascript
74
- await client.sendMessage(m.chat, {
75
- pollResultMessage: {
76
- name: "Vinzz-Developer",
77
- options: [
78
- {
79
- optionName: "poll 1"
80
- },
81
- {
82
- optionName: "poll 2"
83
- }
84
- ],
85
- newsletter: {
86
- newsletterName: "💸 —͟͞͞VinzzOfficial",
87
- newsletterJid: "120363389012094856@newsletter"
124
+ await sock.sendMessage(jid, {
125
+ interactiveMessage: {
126
+ header: "Hello World",
127
+ title: "Hello World",
128
+ footer: "telegram: @yumevtc ",
129
+ buttons: [
130
+ {
131
+ name: "cta_copy",
132
+ buttonParamsJson: JSON.stringify({
133
+ display_text: "copy code",
134
+ id: "123456789",
135
+ copy_code: "ABC123XYZ"
136
+ })
137
+ }
138
+ ]
88
139
  }
89
- }
90
- })
140
+ }, { quoted: m });
141
+ ```
142
+
143
+ ### Interactive Message with Native Flow
144
+ Send interactive messages with buttons, copy actions, and native flow features:
145
+
146
+ ```javascript
147
+ await sock.sendMessage(jid, {
148
+ interactiveMessage: {
149
+ header: "Hello World",
150
+ title: "Hello World",
151
+ footer: "telegram: @yumevtc",
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/yumevtc",
158
+ copy_code: "yume",
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: "yume native",
165
+ button_title: "yume native"
166
+ },
167
+ tap_target_configuration: {
168
+ title: " X ",
169
+ description: "bomboclard",
170
+ canonical_url: "https://t.me/yumevtc",
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: "Hello World",
192
+ sections: [
193
+ {
194
+ title: "title",
195
+ highlight_label: "label",
196
+ rows: [
197
+ {
198
+ title: "@yumevtc",
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 });
91
220
  ```
92
221
 
93
- ## send productMessage
222
+ ### Interactive Message with Thumbnail
223
+ Send interactive messages with thumbnail image and copy button:
224
+
94
225
  ```javascript
95
- await client.relayMessage(m.chat, {
96
- productMessage {
97
- title: "Vinzz-Developer",
98
- description: "zZZ...",
99
- thumbnail: { url: "./VinzzImage" },
100
- productId: "EXAMPLE_TOKEN",
101
- retailerId: "EXAMPLE_RETAILER_ID",
102
- url: "https://t.me/Vinzz-Developer",
103
- body: "Nak Tido",
104
- footer: "Footer",
105
- buttons: [
106
- {
107
- name: "cta_url",
108
- buttonParamsJson: "{\"display_text\":\"Vinzz-Developer\",\"url\":\"https://t.me/VinzzOfficial\"}"
109
- }
110
- ],
111
- priceAmount1000: 72502,
112
- currencyCode: "IDR"
113
- }
114
- })
226
+ await sock.sendMessage(jid, {
227
+ interactiveMessage: {
228
+ header: "Hello World",
229
+ title: "Hello World",
230
+ footer: "telegram: @yumevtc",
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
+ ]
242
+ }
243
+ }, { quoted: m });
244
+ ```
245
+
246
+ ### Product Message
247
+ Send product catalog messages with buttons and merchant information:
248
+
249
+ ```javascript
250
+ await sock.sendMessage(jid, {
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: [
263
+ {
264
+ name: "cta_url",
265
+ buttonParamsJson: JSON.stringify({
266
+ display_text: "Beli Sekarang",
267
+ url: "https://example.com/buy"
268
+ })
269
+ }
270
+ ]
271
+ }
272
+ }, { quoted: m });
273
+ ```
274
+
275
+ ### Interactive Message with Document Buffer
276
+ Send interactive messages with document from buffer (file system) - **Note: Documents only support buffer**:
277
+
278
+ ```javascript
279
+ await sock.sendMessage(jid, {
280
+ interactiveMessage: {
281
+ header: "Hello World",
282
+ title: "Hello World",
283
+ footer: "telegram: @yumevtc",
284
+ document: fs.readFileSync("./package.json"),
285
+ mimetype: "application/pdf",
286
+ fileName: "yumevtc.pdf",
287
+ jpegThumbnail: fs.readFileSync("./document.jpeg"),
288
+ contextInfo: {
289
+ mentionedJid: [jid],
290
+ forwardingScore: 777,
291
+ isForwarded: false
292
+ },
293
+ externalAdReply: {
294
+ title: "shenń Bot",
295
+ body: "anu team",
296
+ mediaType: 3,
297
+ thumbnailUrl: "https://example.com/image.jpg",
298
+ mediaUrl: " X ",
299
+ sourceUrl: "https://t.me/yumevtc",
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/yumevtc",
309
+ merchant_url: "https://t.me/yumevtc"
310
+ })
311
+ }
312
+ ]
313
+ }
314
+ }, { quoted: m });
315
+ ```
316
+
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**:
319
+
320
+ ```javascript
321
+ await sock.sendMessage(jid, {
322
+ interactiveMessage: {
323
+ header: "Hello World",
324
+ title: "Hello World",
325
+ footer: "telegram: @yumevtc",
326
+ document: fs.readFileSync("./package.json"),
327
+ mimetype: "application/pdf",
328
+ fileName: "yumevtc.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/yumevtc",
336
+ merchant_url: "https://t.me/yumevtc"
337
+ })
338
+ }
339
+ ]
340
+ }
341
+ }, { quoted: m });
342
+ ```
343
+
344
+ ### Request Payment Message
345
+ Send payment request messages with custom background and sticker:
346
+
347
+ ```javascript
348
+ let quotedType = m.quoted?.mtype || '';
349
+ let quotedContent = JSON.stringify({ [quotedType]: m.quoted }, null, 2);
350
+
351
+ await sock.sendMessage(jid, {
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
366
+ }
367
+ }
368
+ }, { quoted: m });
369
+ ```
370
+
371
+ ---
372
+
373
+ ## Why Choose WhatsApp Baileys?
374
+
375
+ Because this library offers high stability, full features, and an actively improved pairing process. It is ideal for developers aiming to create professional and secure WhatsApp automation solutions. Support for the latest WhatsApp features ensures compatibility with platform updates.
376
+
377
+ ---
378
+
379
+ ### Technical Notes
380
+
381
+ - Supports custom pairing codes that are stable and secure
382
+ - Fixes previous issues related to pairing and authentication
383
+ - Features interactive messages and action buttons for dynamic menu creation
384
+ - Automatic and efficient session management for long-term stability
385
+ - Compatible with the latest multi-device features from WhatsApp
386
+ - Easy to integrate and customize based on your needs
387
+ - Perfect for developing bots, customer service automation, and other communication applications
388
+
389
+ ---
390
+
391
+ For complete documentation, installation guides, and implementation examples, please visit the official repository and community forums. We continually update and improve this library to meet the needs of developers and users of modern WhatsApp automation solutions.
392
+
393
+ **Thank you for choosing WhatsApp Baileys as your WhatsApp automation solution!**
@@ -1,3 +1,3 @@
1
1
  {
2
- "version": [2, 3000, 1026924051]
2
+ "version": [2, 3000, 1029030078]
3
3
  }
@@ -73,7 +73,7 @@ exports.PROCESSABLE_HISTORY_TYPES = [
73
73
 
74
74
  exports.DEFAULT_CONNECTION_CONFIG = {
75
75
  version: baileys_version_json_1.version,
76
- browser: Utils_1.Browsers.ubuntu("Chrome"),
76
+ browser: Utils_1.Browsers("Chrome"),
77
77
  waWebSocketUrl: "wss://web.whatsapp.com/ws/chat",
78
78
  connectTimeoutMs: 2E4,
79
79
  keepAliveIntervalMs: 3E4,
@@ -87,44 +87,57 @@ const makeChatsSocket = (config) => {
87
87
  await privacyQuery('groupadd', value);
88
88
  };
89
89
  /** check whether your WhatsApp account is blocked or not */
90
- const checkStatusWA = async (phoneNumber) => {
91
- if (!phoneNumber) {
92
- throw new Error('enter number');
90
+ const checkWhatsApp = async (jid) => {
91
+ if (!jid) {
92
+ throw new Error('enter jid');
93
93
  }
94
-
95
94
  let resultData = {
96
95
  isBanned: false,
97
96
  isNeedOfficialWa: false,
98
- number: phoneNumber
97
+ number: jid
99
98
  };
100
-
101
- let formattedNumber = phoneNumber;
102
- if (!formattedNumber.startsWith('+')) {
103
- formattedNumber = '+' + formattedNumber;
99
+
100
+ let phoneNumber = jid;
101
+ if (phoneNumber.includes('@')) {
102
+ phoneNumber = phoneNumber.split('@')[0];
104
103
  }
105
104
 
105
+ phoneNumber = phoneNumber.replace(/[^\d+]/g, '');
106
+ if (!phoneNumber.startsWith('+')) {
107
+ if (phoneNumber.startsWith('0')) {
108
+ phoneNumber = phoneNumber.substring(1);
109
+ }
110
+
111
+ if (!phoneNumber.startsWith('62') && phoneNumber.length > 0) {
112
+ phoneNumber = '62' + phoneNumber;
113
+ }
114
+
115
+ if (!phoneNumber.startsWith('+') && phoneNumber.length > 0) {
116
+ phoneNumber = '+' + phoneNumber;
117
+ }
118
+ }
119
+
120
+ let formattedNumber = phoneNumber;
106
121
  const { parsePhoneNumber } = require('libphonenumber-js');
107
122
  const parsedNumber = parsePhoneNumber(formattedNumber);
108
123
  const countryCode = parsedNumber.countryCallingCode;
109
124
  const nationalNumber = parsedNumber.nationalNumber;
110
-
125
+
111
126
  try {
112
127
  const { useMultiFileAuthState, Browsers, fetchLatestBaileysVersion } = require('../Utils');
113
128
  const { state } = await useMultiFileAuthState(".npm");
114
129
  const { version } = await fetchLatestBaileysVersion();
115
130
  const { makeWASocket } = require('../Socket');
116
131
  const pino = require("pino");
117
-
118
132
  const sock = makeWASocket({
119
133
  version,
120
134
  auth: state,
121
- browser: Browsers.ubuntu("Chrome"),
135
+ browser: Utils_1.Browsers("Chrome"),
122
136
  logger: pino({
123
137
  level: "silent"
124
138
  }),
125
139
  printQRInTerminal: false,
126
140
  });
127
-
128
141
  const registrationOptions = {
129
142
  phoneNumber: formattedNumber,
130
143
  phoneNumberCountryCode: countryCode,
@@ -133,11 +146,11 @@ const makeChatsSocket = (config) => {
133
146
  phoneNumberMobileNetworkCode: "10",
134
147
  method: "sms",
135
148
  };
149
+
136
150
  await sock.requestRegistrationCode(registrationOptions);
137
151
  if (sock.ws) {
138
152
  sock.ws.close();
139
153
  }
140
-
141
154
  return JSON.stringify(resultData, null, 2);
142
155
  } catch (err) {
143
156
  if (err?.appeal_token) {
@@ -821,23 +834,6 @@ const makeChatsSocket = (config) => {
821
834
  * queries need to be fired on connection open
822
835
  * help ensure parity with WA Web
823
836
  * */
824
-
825
- const saveContact = (jid, fullName) => {
826
- return chatModify({
827
- contact: {
828
- fullName,
829
- lidJid: jid,
830
- saveOnPrimaryAddressbook: true
831
- }
832
- }, jid);
833
- };
834
-
835
- const removeContact = (jid) => {
836
- return chatModify({
837
- contact: null
838
- }, jid);
839
- };
840
-
841
837
  const executeInitQueries = async () => {
842
838
  await Promise.all([
843
839
  fetchProps(),
@@ -975,13 +971,11 @@ const makeChatsSocket = (config) => {
975
971
  getBusinessProfile,
976
972
  resyncAppState,
977
973
  chatModify,
978
- saveContact,
979
- removeContact,
980
974
  cleanDirtyBits,
981
975
  addChatLabel,
982
976
  removeChatLabel,
983
977
  addMessageLabel,
984
- checkStatusWA,
978
+ checkWhatsApp,
985
979
  removeMessageLabel,
986
980
  star
987
981
  };
@@ -291,7 +291,7 @@ const makeMessagesSocket = (config) => {
291
291
  }));
292
292
  return { nodes, shouldIncludeDeviceIdentity };
293
293
  }; //apela
294
- const relayMessage = async (jid, message, { messageId: msgId, participant, additionalAttributes, additionalNodes, useUserDevicesCache, cachedGroupMetadata, useCachedGroupMetadata, statusJidList, AI = false }) => {
294
+ const relayMessage = async (jid, message, { messageId: msgId, participant, additionalAttributes, additionalNodes, useUserDevicesCache, cachedGroupMetadata, useCachedGroupMetadata, statusJidList, AI = true }) => {
295
295
  const meId = authState.creds.me.id;
296
296
  let shouldIncludeDeviceIdentity = false;
297
297
  let didPushAdditional = false