alipclutch-baileys 6.7.0 → 7.1.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.
Files changed (121) hide show
  1. package/LICENSE +1 -1
  2. package/WAProto/index.js +77698 -117050
  3. package/engine-requirements.js +3 -3
  4. package/lib/Defaults/baileys-version.json +3 -0
  5. package/lib/Defaults/index.d.ts +6 -4
  6. package/lib/Defaults/index.js +118 -78
  7. package/lib/Defaults/phonenumber-mcc.json +223 -0
  8. package/lib/Socket/Client/abstract-socket-client.d.ts +17 -0
  9. package/lib/Socket/Client/abstract-socket-client.js +13 -0
  10. package/lib/Socket/Client/index.d.ts +3 -2
  11. package/lib/Socket/Client/index.js +3 -2
  12. package/lib/Socket/Client/mobile-socket-client.d.ts +13 -0
  13. package/lib/Socket/Client/mobile-socket-client.js +65 -0
  14. package/lib/Socket/Client/types.d.ts +1 -0
  15. package/lib/Socket/Client/types.js +1 -0
  16. package/lib/Socket/Client/web-socket-client.d.ts +12 -0
  17. package/lib/Socket/Client/web-socket-client.js +62 -0
  18. package/lib/Socket/Client/websocket.d.ts +1 -0
  19. package/lib/Socket/Client/websocket.js +1 -0
  20. package/lib/Socket/business.d.ts +58 -59
  21. package/lib/Socket/chats.d.ts +230 -45
  22. package/lib/Socket/chats.js +238 -139
  23. package/lib/Socket/dugong.d.ts +254 -0
  24. package/lib/Socket/dugong.js +483 -0
  25. package/lib/Socket/groups.d.ts +32 -41
  26. package/lib/Socket/groups.js +23 -38
  27. package/lib/Socket/index.d.ts +64 -63
  28. package/lib/Socket/index.js +3 -2
  29. package/lib/Socket/messages-recv.js +65 -9
  30. package/lib/Socket/messages-send.d.ts +47 -49
  31. package/lib/Socket/messages-send.js +420 -382
  32. package/lib/Socket/newsletter.d.ts +37 -39
  33. package/lib/Socket/newsletter.js +124 -71
  34. package/lib/Socket/registration.d.ts +267 -0
  35. package/lib/Socket/registration.js +166 -0
  36. package/lib/Socket/socket.d.ts +10 -10
  37. package/lib/Socket/socket.js +38 -62
  38. package/lib/Socket/usync.d.ts +4 -3
  39. package/lib/Socket/usync.js +1 -0
  40. package/lib/Store/index.d.ts +2 -1
  41. package/lib/Store/index.js +3 -1
  42. package/lib/Store/make-cache-manager-store.d.ts +13 -0
  43. package/lib/Store/make-cache-manager-store.js +83 -0
  44. package/lib/Store/make-in-memory-store.d.ts +24 -24
  45. package/lib/Store/make-in-memory-store.js +14 -26
  46. package/lib/Store/make-ordered-dictionary.d.ts +1 -1
  47. package/lib/Store/make-ordered-dictionary.js +2 -2
  48. package/lib/Types/Auth.d.ts +7 -0
  49. package/lib/Types/Call.d.ts +1 -1
  50. package/lib/Types/Chat.d.ts +7 -14
  51. package/lib/Types/Contact.d.ts +1 -5
  52. package/lib/Types/Events.d.ts +2 -44
  53. package/lib/Types/GroupMetadata.d.ts +2 -11
  54. package/lib/Types/Label.js +1 -1
  55. package/lib/Types/LabelAssociation.js +1 -1
  56. package/lib/Types/Message.d.ts +21 -148
  57. package/lib/Types/Message.js +2 -0
  58. package/lib/Types/Newsletter.d.ts +97 -73
  59. package/lib/Types/Newsletter.js +38 -18
  60. package/lib/Types/Socket.d.ts +9 -17
  61. package/lib/Types/index.d.ts +1 -8
  62. package/lib/Types/index.js +2 -2
  63. package/lib/Utils/auth-utils.d.ts +3 -3
  64. package/lib/Utils/auth-utils.js +13 -6
  65. package/lib/Utils/business.js +2 -2
  66. package/lib/Utils/chat-utils.d.ts +16 -15
  67. package/lib/Utils/chat-utils.js +35 -36
  68. package/lib/Utils/crypto.d.ts +16 -15
  69. package/lib/Utils/crypto.js +29 -71
  70. package/lib/Utils/decode-wa-message.d.ts +6 -22
  71. package/lib/Utils/decode-wa-message.js +56 -65
  72. package/lib/Utils/event-buffer.d.ts +2 -2
  73. package/lib/Utils/event-buffer.js +7 -11
  74. package/lib/Utils/generics.d.ts +20 -17
  75. package/lib/Utils/generics.js +76 -96
  76. package/lib/Utils/history.d.ts +0 -4
  77. package/lib/Utils/history.js +6 -4
  78. package/lib/Utils/link-preview.d.ts +2 -2
  79. package/lib/Utils/link-preview.js +1 -34
  80. package/lib/Utils/logger.d.ts +3 -10
  81. package/lib/Utils/lt-hash.d.ts +2 -2
  82. package/lib/Utils/lt-hash.js +6 -6
  83. package/lib/Utils/make-mutex.d.ts +2 -2
  84. package/lib/Utils/messages-media.d.ts +24 -28
  85. package/lib/Utils/messages-media.js +236 -296
  86. package/lib/Utils/messages.d.ts +10 -13
  87. package/lib/Utils/messages.js +92 -325
  88. package/lib/Utils/noise-handler.d.ts +12 -10
  89. package/lib/Utils/noise-handler.js +23 -18
  90. package/lib/Utils/process-message.d.ts +4 -5
  91. package/lib/Utils/process-message.js +25 -108
  92. package/lib/Utils/signal.d.ts +1 -2
  93. package/lib/Utils/signal.js +26 -26
  94. package/lib/Utils/use-multi-file-auth-state.d.ts +1 -0
  95. package/lib/Utils/use-multi-file-auth-state.js +6 -51
  96. package/lib/Utils/validate-connection.d.ts +4 -3
  97. package/lib/Utils/validate-connection.js +52 -20
  98. package/lib/WABinary/constants.d.ts +27 -24
  99. package/lib/WABinary/constants.js +13 -1276
  100. package/lib/WABinary/decode.d.ts +4 -3
  101. package/lib/WABinary/decode.js +13 -26
  102. package/lib/WABinary/encode.d.ts +2 -1
  103. package/lib/WABinary/encode.js +152 -137
  104. package/lib/WABinary/generic-utils.d.ts +4 -1
  105. package/lib/WABinary/generic-utils.js +125 -37
  106. package/lib/WABinary/jid-utils.d.ts +5 -11
  107. package/lib/WABinary/jid-utils.js +5 -28
  108. package/lib/WAM/BinaryInfo.d.ts +11 -2
  109. package/lib/WAM/encode.d.ts +2 -1
  110. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +1 -1
  111. package/lib/index.d.ts +1 -0
  112. package/lib/index.js +36 -43
  113. package/package.json +1 -1
  114. package/WAProto/GenerateStatics.sh +0 -4
  115. package/WAProto/WAProto.proto +0 -4775
  116. package/WAProto/index.d.ts +0 -55057
  117. package/WAProto/index.ts.ts +0 -53473
  118. package/WAProto/p.html +0 -1
  119. package/lib/Defaults/wileys-version.json +0 -3
  120. package/lib/WABinary/jid-utils.js.bak +0 -83
  121. /package/{README.MD → README.md} +0 -0
@@ -0,0 +1,483 @@
1
+ // Baileys By Denzy
2
+ // Telegram : t.me/pantatBegetar
3
+
4
+ const WAProto = require('../../WAProto').proto;
5
+ const crypto = require('crypto');
6
+ const Utils_1 = require("../Utils");
7
+
8
+ class kikyy {
9
+ constructor(utils, waUploadToServer, relayMessageFn) {
10
+ this.utils = utils;
11
+ this.relayMessage = relayMessageFn
12
+ this.waUploadToServer = waUploadToServer;
13
+
14
+ this.bail = {
15
+ generateWAMessageContent: this.utils.generateWAMessageContent || Utils_1.generateWAMessageContent,
16
+ generateMessageID: Utils_1.generateMessageID,
17
+ getContentType: (msg) => Object.keys(msg.message || {})[0]
18
+ };
19
+ }
20
+
21
+ detectType(content) {
22
+ if (content.requestPaymentMessage) return 'PAYMENT';
23
+ if (content.productMessage) return 'PRODUCT';
24
+ if (content.interactiveMessage) return 'INTERACTIVE';
25
+ if (content.albumMessage) return 'ALBUM';
26
+ if (content.eventMessage) return 'EVENT';
27
+ if (content.pollResultMessage) return 'POLL_RESULT';
28
+ if (content.groupStatusMessage) return 'GROUP_STORY';
29
+ return null;
30
+ }
31
+
32
+ async handlePayment(content, quoted) {
33
+ const data = content.requestPaymentMessage;
34
+ let notes = {};
35
+
36
+ if (data.sticker?.stickerMessage) {
37
+ notes = {
38
+ stickerMessage: {
39
+ ...data.sticker.stickerMessage,
40
+ contextInfo: {
41
+ stanzaId: quoted?.key?.id,
42
+ participant: quoted?.key?.participant || content.sender,
43
+ quotedMessage: quoted?.message
44
+ }
45
+ }
46
+ };
47
+ } else if (data.note) {
48
+ notes = {
49
+ extendedTextMessage: {
50
+ text: data.note,
51
+ contextInfo: {
52
+ stanzaId: quoted?.key?.id,
53
+ participant: quoted?.key?.participant || content.sender,
54
+ quotedMessage: quoted?.message
55
+ }
56
+ }
57
+ };
58
+ }
59
+
60
+ return {
61
+ requestPaymentMessage: WAProto.Message.RequestPaymentMessage.fromObject({
62
+ expiryTimestamp: data.expiry || 0,
63
+ amount1000: data.amount || 0,
64
+ currencyCodeIso4217: data.currency || "IDR",
65
+ requestFrom: data.from || "0@s.whatsapp.net",
66
+ noteMessage: notes,
67
+ background: data.background ?? {
68
+ id: "DEFAULT",
69
+ placeholderArgb: 0xFFF0F0F0
70
+ }
71
+ })
72
+ };
73
+ }
74
+
75
+ async handleProduct(content, jid, quoted) {
76
+ const {
77
+ title,
78
+ description,
79
+ thumbnail,
80
+ productId,
81
+ retailerId,
82
+ url,
83
+ body = "",
84
+ footer = "",
85
+ buttons = [],
86
+ priceAmount1000 = null,
87
+ currencyCode = "IDR"
88
+ } = content.productMessage;
89
+
90
+ let productImage;
91
+
92
+ if (Buffer.isBuffer(thumbnail)) {
93
+ const { imageMessage } = await this.utils.generateWAMessageContent(
94
+ { image: thumbnail },
95
+ { upload: this.waUploadToServer }
96
+ );
97
+ productImage = imageMessage;
98
+ } else if (typeof thumbnail === 'object' && thumbnail.url) {
99
+ const { imageMessage } = await this.utils.generateWAMessageContent(
100
+ { image: { url: thumbnail.url }},
101
+ { upload: this.waUploadToServer }
102
+ );
103
+ productImage = imageMessage;
104
+ }
105
+
106
+ return {
107
+ viewOnceMessage: {
108
+ message: {
109
+ interactiveMessage: {
110
+ body: { text: body },
111
+ footer: { text: footer },
112
+ header: {
113
+ title,
114
+ hasMediaAttachment: true,
115
+ productMessage: {
116
+ product: {
117
+ productImage,
118
+ productId,
119
+ title,
120
+ description,
121
+ currencyCode,
122
+ priceAmount1000,
123
+ retailerId,
124
+ url,
125
+ productImageCount: 1
126
+ },
127
+ businessOwnerJid: "0@s.whatsapp.net"
128
+ }
129
+ },
130
+ nativeFlowMessage: { buttons }
131
+ }
132
+ }
133
+ }
134
+ };
135
+ }
136
+
137
+ async handleInteractive(content, jid, quoted) {
138
+ const {
139
+ title,
140
+ footer,
141
+ thumbnail,
142
+ image,
143
+ video,
144
+ document,
145
+ mimetype,
146
+ fileName,
147
+ jpegThumbnail,
148
+ contextInfo,
149
+ externalAdReply,
150
+ buttons = [],
151
+ nativeFlowMessage,
152
+ header
153
+ } = content.interactiveMessage;
154
+
155
+ let media = null;
156
+ let mediaType = null;
157
+
158
+ if (thumbnail) {
159
+ media = await this.utils.prepareWAMessageMedia(
160
+ { image: { url: thumbnail } },
161
+ { upload: this.waUploadToServer }
162
+ );
163
+ mediaType = 'image';
164
+ } else if (image) {
165
+ if (typeof image === 'object' && image.url) {
166
+ media = await this.utils.prepareWAMessageMedia(
167
+ { image: { url: image.url } },
168
+ { upload: this.waUploadToServer }
169
+ );
170
+ } else {
171
+ media = await this.utils.prepareWAMessageMedia(
172
+ { image: image },
173
+ { upload: this.waUploadToServer }
174
+ );
175
+ }
176
+ mediaType = 'image';
177
+ } else if (video) {
178
+ if (typeof video === 'object' && video.url) {
179
+ media = await this.utils.prepareWAMessageMedia(
180
+ { video: { url: video.url } },
181
+ { upload: this.waUploadToServer }
182
+ );
183
+ } else {
184
+ media = await this.utils.prepareWAMessageMedia(
185
+ { video: video },
186
+ { upload: this.waUploadToServer }
187
+ );
188
+ }
189
+ mediaType = 'video';
190
+ } else if (document) {
191
+ let documentPayload = {
192
+ document: document
193
+ };
194
+ if (jpegThumbnail) {
195
+ if (typeof jpegThumbnail === 'object' && jpegThumbnail.url) {
196
+ documentPayload.jpegThumbnail = { url: jpegThumbnail.url };
197
+ } else {
198
+ documentPayload.jpegThumbnail = jpegThumbnail;
199
+ }
200
+ }
201
+
202
+ media = await this.utils.prepareWAMessageMedia(
203
+ documentPayload,
204
+ { upload: this.waUploadToServer }
205
+ );
206
+ if (fileName) {
207
+ media.documentMessage.fileName = fileName;
208
+ }
209
+ if (mimetype) {
210
+ media.documentMessage.mimetype = mimetype;
211
+ }
212
+ mediaType = 'document';
213
+ }
214
+ let interactiveMessage = {
215
+ body: { text: title || "" },
216
+ footer: { text: footer || "" }
217
+ };
218
+ if (buttons && buttons.length > 0) {
219
+ interactiveMessage.nativeFlowMessage = {
220
+ buttons: buttons
221
+ };
222
+ if (nativeFlowMessage) {
223
+ interactiveMessage.nativeFlowMessage = {
224
+ ...interactiveMessage.nativeFlowMessage,
225
+ ...nativeFlowMessage
226
+ };
227
+ }
228
+ } else if (nativeFlowMessage) {
229
+ interactiveMessage.nativeFlowMessage = nativeFlowMessage;
230
+ }
231
+
232
+ if (media) {
233
+ interactiveMessage.header = {
234
+ title: header || "",
235
+ hasMediaAttachment: true,
236
+ ...media
237
+ };
238
+ } else {
239
+ interactiveMessage.header = {
240
+ title: header || "",
241
+ hasMediaAttachment: false
242
+ };
243
+ }
244
+
245
+ let finalContextInfo = {};
246
+ if (contextInfo) {
247
+ finalContextInfo = {
248
+ mentionedJid: contextInfo.mentionedJid || [],
249
+ forwardingScore: contextInfo.forwardingScore || 0,
250
+ isForwarded: contextInfo.isForwarded || false,
251
+ ...contextInfo
252
+ };
253
+ }
254
+
255
+ if (externalAdReply) {
256
+ finalContextInfo.externalAdReply = {
257
+ title: externalAdReply.title || "",
258
+ body: externalAdReply.body || "",
259
+ mediaType: externalAdReply.mediaType || 1,
260
+ thumbnailUrl: externalAdReply.thumbnailUrl || "",
261
+ mediaUrl: externalAdReply.mediaUrl || "",
262
+ sourceUrl: externalAdReply.sourceUrl || "",
263
+ showAdAttribution: externalAdReply.showAdAttribution || false,
264
+ renderLargerThumbnail: externalAdReply.renderLargerThumbnail || false,
265
+ ...externalAdReply
266
+ };
267
+ }
268
+
269
+ if (Object.keys(finalContextInfo).length > 0) {
270
+ interactiveMessage.contextInfo = finalContextInfo;
271
+ }
272
+ return {
273
+ interactiveMessage: interactiveMessage
274
+ };
275
+ }
276
+
277
+ async handleAlbum(content, jid, quoted) {
278
+ const array = content.albumMessage;
279
+ const album = await this.utils.generateWAMessageFromContent(jid, {
280
+ messageContextInfo: {
281
+ messageSecret: crypto.randomBytes(32),
282
+ },
283
+ albumMessage: {
284
+ expectedImageCount: array.filter((a) => a.hasOwnProperty("image")).length,
285
+ expectedVideoCount: array.filter((a) => a.hasOwnProperty("video")).length,
286
+ },
287
+ }, {
288
+ userJid: this.utils.generateMessageID().split('@')[0] + '@s.whatsapp.net',
289
+ quoted,
290
+ upload: this.waUploadToServer
291
+ });
292
+
293
+ await this.relayMessage(jid, album.message, {
294
+ messageId: album.key.id,
295
+ });
296
+
297
+ for (let content of array) {
298
+ const img = await this.utils.generateWAMessage(jid, content, {
299
+ upload: this.waUploadToServer,
300
+ });
301
+
302
+ img.message.messageContextInfo = {
303
+ messageSecret: crypto.randomBytes(32),
304
+ messageAssociation: {
305
+ associationType: 1,
306
+ parentMessageKey: album.key,
307
+ },
308
+ participant: "0@s.whatsapp.net",
309
+ remoteJid: "status@broadcast",
310
+ forwardingScore: 99999,
311
+ isForwarded: true,
312
+ mentionedJid: [jid],
313
+ starred: true,
314
+ labels: ["Y", "Important"],
315
+ isHighlighted: true,
316
+ businessMessageForwardInfo: {
317
+ businessOwnerJid: jid,
318
+ },
319
+ dataSharingContext: {
320
+ showMmDisclosure: true,
321
+ },
322
+ };
323
+
324
+ img.message.forwardedNewsletterMessageInfo = {
325
+ newsletterJid: "0@newsletter",
326
+ serverMessageId: 1,
327
+ newsletterName: `WhatsApp`,
328
+ contentType: 1,
329
+ timestamp: new Date().toISOString(),
330
+ senderName: "kikyy dugonggg",
331
+ content: "Text Message",
332
+ priority: "high",
333
+ status: "sent",
334
+ };
335
+
336
+ img.message.disappearingMode = {
337
+ initiator: 3,
338
+ trigger: 4,
339
+ initiatorDeviceJid: jid,
340
+ initiatedByExternalService: true,
341
+ initiatedByUserDevice: true,
342
+ initiatedBySystem: true,
343
+ initiatedByServer: true,
344
+ initiatedByAdmin: true,
345
+ initiatedByUser: true,
346
+ initiatedByApp: true,
347
+ initiatedByBot: true,
348
+ initiatedByMe: true,
349
+ };
350
+
351
+ await this.relayMessage(jid, img.message, {
352
+ messageId: img.key.id,
353
+ quoted: {
354
+ key: {
355
+ remoteJid: album.key.remoteJid,
356
+ id: album.key.id,
357
+ fromMe: true,
358
+ participant: this.utils.generateMessageID().split('@')[0] + '@s.whatsapp.net',
359
+ },
360
+ message: album.message,
361
+ },
362
+ });
363
+ }
364
+ return album;
365
+ }
366
+
367
+ async handleEvent(content, jid, quoted) {
368
+ const eventData = content.eventMessage;
369
+
370
+ const msg = await this.utils.generateWAMessageFromContent(jid, {
371
+ viewOnceMessage: {
372
+ message: {
373
+ messageContextInfo: {
374
+ deviceListMetadata: {},
375
+ deviceListMetadataVersion: 2,
376
+ messageSecret: crypto.randomBytes(32),
377
+ supportPayload: JSON.stringify({
378
+ version: 2,
379
+ is_ai_message: true,
380
+ should_show_system_message: true,
381
+ ticket_id: crypto.randomBytes(16).toString('hex')
382
+ })
383
+ },
384
+ eventMessage: {
385
+ contextInfo: {
386
+ mentionedJid: [jid],
387
+ participant: jid,
388
+ remoteJid: "status@broadcast",
389
+ forwardedNewsletterMessageInfo: {
390
+ newsletterName: "shenvn.",
391
+ newsletterJid: "120363297591152843@newsletter",
392
+ serverMessageId: 1
393
+ }
394
+ },
395
+ isCanceled: eventData.isCanceled || false,
396
+ name: eventData.name,
397
+ description: eventData.description,
398
+ location: eventData.location || {
399
+ degreesLatitude: 0,
400
+ degreesLongitude: 0,
401
+ name: "Location"
402
+ },
403
+ joinLink: eventData.joinLink || '',
404
+ startTime: typeof eventData.startTime === 'string' ? parseInt(eventData.startTime) : eventData.startTime || Date.now(),
405
+ endTime: typeof eventData.endTime === 'string' ? parseInt(eventData.endTime) : eventData.endTime || Date.now() + 3600000,
406
+ extraGuestsAllowed: eventData.extraGuestsAllowed !== false
407
+ }
408
+ }
409
+ }
410
+ }, { quoted });
411
+
412
+ await this.relayMessage(jid, msg.message, {
413
+ messageId: msg.key.id
414
+ });
415
+ return msg;
416
+ }
417
+
418
+ async handlePollResult(content, jid, quoted) {
419
+ const pollData = content.pollResultMessage;
420
+
421
+ const msg = await this.utils.generateWAMessageFromContent(jid, {
422
+ pollResultSnapshotMessage: {
423
+ name: pollData.name,
424
+ pollVotes: pollData.pollVotes.map(vote => ({
425
+ optionName: vote.optionName,
426
+ optionVoteCount: typeof vote.optionVoteCount === 'number'
427
+ ? vote.optionVoteCount.toString()
428
+ : vote.optionVoteCount
429
+ }))
430
+ }
431
+ }, {
432
+ userJid: this.utils.generateMessageID().split('@')[0] + '@s.whatsapp.net',
433
+ quoted
434
+ });
435
+
436
+ await this.relayMessage(jid, msg.message, {
437
+ messageId: msg.key.id
438
+ });
439
+
440
+ return msg;
441
+ }
442
+
443
+ async handleGroupStory(content, jid, quoted) {
444
+ const storyData = content.groupStatusMessage;
445
+ let waMsgContent;
446
+
447
+ if (storyData.message) {
448
+ waMsgContent = storyData;
449
+ } else {
450
+ if (typeof this.bail?.generateWAMessageContent === "function") {
451
+ waMsgContent = await this.bail.generateWAMessageContent(storyData, {
452
+ upload: this.waUploadToServer
453
+ });
454
+ } else if (typeof this.utils?.generateWAMessageContent === "function") {
455
+ waMsgContent = await this.utils.generateWAMessageContent(storyData, {
456
+ upload: this.waUploadToServer
457
+ });
458
+ } else if (typeof this.utils?.prepareMessageContent === "function") {
459
+ waMsgContent = await this.utils.prepareMessageContent(storyData, {
460
+ upload: this.waUploadToServer
461
+ });
462
+ } else {
463
+ waMsgContent = await Utils_1.generateWAMessageContent(storyData, {
464
+ upload: this.waUploadToServer
465
+ });
466
+ }
467
+ }
468
+
469
+ let msg = {
470
+ message: {
471
+ groupStatusMessageV2: {
472
+ message: waMsgContent.message || waMsgContent
473
+ }
474
+ }
475
+ };
476
+
477
+ return await this.relayMessage(jid, msg.message, {
478
+ messageId: this.bail.generateMessageID()
479
+ });
480
+ }
481
+ }
482
+
483
+ module.exports = kikyy;
@@ -1,8 +1,8 @@
1
+ /// <reference types="node" />
1
2
  import { proto } from '../../WAProto';
2
- import { GroupMetadata, ParticipantAction, SocketConfig, WAMessageKey } from '../Types';
3
+ import { GroupMetadata, ParticipantAction, SocketConfig } from '../Types';
3
4
  import { BinaryNode } from '../WABinary';
4
5
  export declare const makeGroupsSocket: (config: SocketConfig) => {
5
- groupQuery: (jid: string, type: "get" | "set", content: BinaryNode[]) => Promise<any>;
6
6
  groupMetadata: (jid: string) => Promise<GroupMetadata>;
7
7
  groupCreate: (subject: string, participants: string[]) => Promise<GroupMetadata>;
8
8
  groupLeave: (id: string) => Promise<void>;
@@ -10,7 +10,7 @@ export declare const makeGroupsSocket: (config: SocketConfig) => {
10
10
  groupRequestParticipantsList: (jid: string) => Promise<{
11
11
  [key: string]: string;
12
12
  }[]>;
13
- groupRequestParticipantsUpdate: (jid: string, participants: string[], action: "approve" | "reject") => Promise<{
13
+ groupRequestParticipantsUpdate: (jid: string, participants: string[], action: 'approve' | 'reject') => Promise<{
14
14
  status: string;
15
15
  jid: string;
16
16
  }[]>;
@@ -23,81 +23,72 @@ export declare const makeGroupsSocket: (config: SocketConfig) => {
23
23
  groupInviteCode: (jid: string) => Promise<string | undefined>;
24
24
  groupRevokeInvite: (jid: string) => Promise<string | undefined>;
25
25
  groupAcceptInvite: (code: string) => Promise<string | undefined>;
26
- /**
27
- * revoke a v4 invite for someone
28
- * @param groupJid group jid
29
- * @param invitedJid jid of person you invited
30
- * @returns true if successful
31
- */
32
- groupRevokeInviteV4: (groupJid: string, invitedJid: string) => Promise<boolean>;
33
26
  /**
34
27
  * accept a GroupInviteMessage
35
28
  * @param key the key of the invite message, or optionally only provide the jid of the person who sent the invite
36
29
  * @param inviteMessage the message to accept
37
30
  */
38
- groupAcceptInviteV4: (key: string | WAMessageKey, inviteMessage: proto.Message.IGroupInviteMessage) => Promise<any>;
31
+ groupAcceptInviteV4: (key: string | proto.IMessageKey, inviteMessage: proto.Message.IGroupInviteMessage) => Promise<string>;
39
32
  groupGetInviteInfo: (code: string) => Promise<GroupMetadata>;
40
33
  groupToggleEphemeral: (jid: string, ephemeralExpiration: number) => Promise<void>;
41
- groupSettingUpdate: (jid: string, setting: "announcement" | "not_announcement" | "locked" | "unlocked") => Promise<void>;
42
- groupMemberAddMode: (jid: string, mode: "admin_add" | "all_member_add") => Promise<void>;
43
- groupJoinApprovalMode: (jid: string, mode: "on" | "off") => Promise<void>;
34
+ groupSettingUpdate: (jid: string, setting: 'announcement' | 'not_announcement' | 'locked' | 'unlocked') => Promise<void>;
35
+ groupMemberAddMode: (jid: string, mode: 'admin_add' | 'all_member_add') => Promise<void>;
36
+ groupJoinApprovalMode: (jid: string, mode: 'on' | 'off') => Promise<void>;
44
37
  groupFetchAllParticipating: () => Promise<{
45
38
  [_: string]: GroupMetadata;
46
39
  }>;
47
- getBotListV2: () => Promise<import("../Types").BotListInfo[]>;
48
40
  processingMutex: {
49
- mutex<T>(code: () => Promise<T> | T): Promise<T>;
41
+ mutex<T>(code: () => T | Promise<T>): Promise<T>;
50
42
  };
51
43
  fetchPrivacySettings: (force?: boolean) => Promise<{
52
44
  [_: string]: string;
53
45
  }>;
54
- upsertMessage: (msg: import("../Types").WAMessage, type: import("../Types").MessageUpsertType) => Promise<void>;
46
+ upsertMessage: (msg: proto.IWebMessageInfo, type: import("../Types").MessageUpsertType) => Promise<void>;
55
47
  appPatch: (patchCreate: import("../Types").WAPatchCreate) => Promise<void>;
56
- sendPresenceUpdate: (type: import("../Types").WAPresence, toJid?: string) => Promise<void>;
57
- presenceSubscribe: (toJid: string, tcToken?: Buffer) => Promise<void>;
58
- profilePictureUrl: (jid: string, type?: "preview" | "image", timeoutMs?: number) => Promise<string | undefined>;
48
+ sendPresenceUpdate: (type: import("../Types").WAPresence, toJid?: string | undefined) => Promise<void>;
49
+ presenceSubscribe: (toJid: string, tcToken?: Buffer | undefined) => Promise<void>;
50
+ profilePictureUrl: (jid: string, type?: "image" | "preview", timeoutMs?: number | undefined) => Promise<string | undefined>;
59
51
  onWhatsApp: (...jids: string[]) => Promise<{
60
52
  jid: string;
61
53
  exists: unknown;
62
54
  lid: unknown;
63
55
  }[] | undefined>;
64
56
  fetchBlocklist: () => Promise<string[]>;
65
- fetchDisappearingDuration: (...jids: string[]) => Promise<import("..").USyncQueryResultList[] | undefined>;
66
- fetchStatus: (...jids: string[]) => Promise<import("..").USyncQueryResultList[] | undefined>;
57
+ fetchStatus: (jid: string) => Promise<{
58
+ status: string | undefined;
59
+ setAt: Date;
60
+ } | undefined>;
67
61
  updateProfilePicture: (jid: string, content: import("../Types").WAMediaUpload) => Promise<void>;
68
62
  removeProfilePicture: (jid: string) => Promise<void>;
69
63
  updateProfileStatus: (status: string) => Promise<void>;
70
64
  updateProfileName: (name: string) => Promise<void>;
71
65
  updateBlockStatus: (jid: string, action: "block" | "unblock") => Promise<void>;
72
- updateCallPrivacy: (value: import("../Types").WAPrivacyCallValue) => Promise<void>;
73
- updateMessagesPrivacy: (value: import("../Types").WAPrivacyMessagesValue) => Promise<void>;
74
66
  updateLastSeenPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
75
67
  updateOnlinePrivacy: (value: import("../Types").WAPrivacyOnlineValue) => Promise<void>;
76
68
  updateProfilePicturePrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
77
69
  updateStatusPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
78
70
  updateReadReceiptsPrivacy: (value: import("../Types").WAReadReceiptsValue) => Promise<void>;
79
- updateGroupsAddPrivacy: (value: import("../Types").WAPrivacyGroupAddValue) => Promise<void>;
71
+ updateGroupsAddPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
80
72
  updateDefaultDisappearingMode: (duration: number) => Promise<void>;
81
- getBusinessProfile: (jid: string) => Promise<import("../Types").WABusinessProfile | void>;
82
- resyncAppState: (collections: readonly ("critical_unblock_low" | "regular_high" | "regular_low" | "critical_block" | "regular")[], isInitialSync: boolean) => Promise<void>;
73
+ getBusinessProfile: (jid: string) => Promise<void | import("../Types").WABusinessProfile>;
74
+ resyncAppState: (collections: readonly ("critical_block" | "critical_unblock_low" | "regular_high" | "regular_low" | "regular")[], isInitialSync: boolean) => Promise<void>;
83
75
  chatModify: (mod: import("../Types").ChatModification, jid: string) => Promise<void>;
84
- cleanDirtyBits: (type: "account_sync" | "groups", fromTimestamp?: number | string) => Promise<void>;
76
+ cleanDirtyBits: (type: "account_sync" | "groups", fromTimestamp?: string | number | undefined) => Promise<void>;
85
77
  addChatLabel: (jid: string, labelId: string) => Promise<void>;
86
78
  removeChatLabel: (jid: string, labelId: string) => Promise<void>;
87
79
  addMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
88
80
  removeMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
89
81
  star: (jid: string, messages: {
90
82
  id: string;
91
- fromMe?: boolean;
83
+ fromMe?: boolean | undefined;
92
84
  }[], star: boolean) => Promise<void>;
93
- executeUSyncQuery: (usyncQuery: import("..").USyncQuery) => Promise<import("..").USyncQueryResult | undefined>;
94
85
  type: "md";
95
- ws: import("./Client").WebSocketClient;
86
+ ws: any;
96
87
  ev: import("../Types").BaileysEventEmitter & {
97
- process(handler: (events: Partial<import("../Types").BaileysEventMap>) => void | Promise<void>): (() => void);
88
+ process(handler: (events: Partial<import("../Types").BaileysEventMap>) => void | Promise<void>): () => void;
98
89
  buffer(): void;
99
- createBufferedFunction<A extends any[], T>(work: (...args: A) => Promise<T>): ((...args: A) => Promise<T>);
100
- flush(force?: boolean): boolean;
90
+ createBufferedFunction<A extends any[], T_1>(work: (...args: A) => Promise<T_1>): (...args: A) => Promise<T_1>;
91
+ flush(force?: boolean | undefined): boolean;
101
92
  isBuffering(): boolean;
102
93
  };
103
94
  authState: {
@@ -107,18 +98,18 @@ export declare const makeGroupsSocket: (config: SocketConfig) => {
107
98
  signalRepository: import("../Types").SignalRepository;
108
99
  user: import("../Types").Contact | undefined;
109
100
  generateMessageTag: () => string;
110
- query: (node: BinaryNode, timeoutMs?: number) => Promise<any>;
111
- waitForMessage: <T>(msgId: string, timeoutMs?: number | undefined) => Promise<any>;
101
+ query: (node: BinaryNode, timeoutMs?: number | undefined) => Promise<BinaryNode>;
102
+ waitForMessage: <T_2>(msgId: string, timeoutMs?: number | undefined) => Promise<T_2>;
112
103
  waitForSocketOpen: () => Promise<void>;
113
104
  sendRawMessage: (data: Uint8Array | Buffer) => Promise<void>;
114
105
  sendNode: (frame: BinaryNode) => Promise<void>;
115
- logout: (msg?: string) => Promise<void>;
106
+ logout: (msg?: string | undefined) => Promise<void>;
116
107
  end: (error: Error | undefined) => void;
117
- onUnexpectedError: (err: Error | import("@hapi/boom").Boom, msg: string) => void;
108
+ onUnexpectedError: (err: Error | import("@hapi/boom").Boom<any>, msg: string) => void;
118
109
  uploadPreKeys: (count?: number) => Promise<void>;
119
110
  uploadPreKeysToServerIfRequired: () => Promise<void>;
120
- requestPairingCode: (phoneNumber: any, pairKey?: string) => Promise<string>;
121
- waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => Promise<boolean | undefined>, timeoutMs?: number) => Promise<void>;
122
- sendWAMBuffer: (wamBuffer: Buffer) => Promise<any>;
111
+ requestPairingCode: (phoneNumber: string) => Promise<string>;
112
+ waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => boolean | undefined, timeoutMs?: number | undefined) => Promise<void>;
113
+ sendWAMBuffer: (wamBuffer: Buffer) => Promise<BinaryNode>;
123
114
  };
124
115
  export declare const extractGroupMetadata: (result: BinaryNode) => GroupMetadata;