cuki-bailx 1.1.2 → 1.2.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.
Files changed (116) hide show
  1. package/WAProto/index.js +79296 -118676
  2. package/engine-requirements.js +1 -1
  3. package/lib/Defaults/baileys-version.json +1 -1
  4. package/lib/Defaults/index.d.ts +6 -4
  5. package/lib/Defaults/index.js +102 -78
  6. package/lib/Defaults/phonenumber-mcc.json +223 -0
  7. package/lib/Socket/Client/{types.d.ts → abstract-socket-client.d.ts} +2 -1
  8. package/lib/Socket/Client/index.d.ts +3 -2
  9. package/lib/Socket/Client/index.js +3 -2
  10. package/lib/Socket/Client/mobile-socket-client.d.ts +13 -0
  11. package/lib/Socket/Client/mobile-socket-client.js +65 -0
  12. package/lib/Socket/Client/{websocket.d.ts → web-socket-client.d.ts} +1 -2
  13. package/lib/Socket/Client/{websocket.js → web-socket-client.js} +2 -12
  14. package/lib/Socket/business.d.ts +58 -59
  15. package/lib/Socket/chats.d.ts +27 -29
  16. package/lib/Socket/chats.js +90 -97
  17. package/lib/Socket/dugong.d.ts +219 -0
  18. package/lib/Socket/dugong.js +441 -0
  19. package/lib/Socket/groups.d.ts +32 -41
  20. package/lib/Socket/groups.js +5 -20
  21. package/lib/Socket/index.d.ts +64 -63
  22. package/lib/Socket/index.js +2 -2
  23. package/lib/Socket/messages-recv.js +65 -9
  24. package/lib/Socket/messages-send.d.ts +47 -49
  25. package/lib/Socket/messages-send.js +312 -379
  26. package/lib/Socket/newsletter.d.ts +37 -39
  27. package/lib/Socket/newsletter.js +40 -54
  28. package/lib/Socket/registration.d.ts +267 -0
  29. package/lib/Socket/registration.js +166 -0
  30. package/lib/Socket/socket.d.ts +10 -10
  31. package/lib/Socket/socket.js +32 -39
  32. package/lib/Socket/socket.js.bak +630 -0
  33. package/lib/Socket/usync.d.ts +3 -3
  34. package/lib/Store/index.d.ts +2 -1
  35. package/lib/Store/index.js +3 -1
  36. package/lib/Store/make-cache-manager-store.d.ts +13 -0
  37. package/lib/Store/make-cache-manager-store.js +83 -0
  38. package/lib/Store/make-in-memory-store.d.ts +24 -24
  39. package/lib/Store/make-in-memory-store.js +11 -13
  40. package/lib/Store/make-ordered-dictionary.d.ts +1 -1
  41. package/lib/Store/make-ordered-dictionary.js +2 -2
  42. package/lib/Types/Auth.d.ts +7 -0
  43. package/lib/Types/Call.d.ts +1 -1
  44. package/lib/Types/Chat.d.ts +7 -14
  45. package/lib/Types/Contact.d.ts +1 -5
  46. package/lib/Types/Events.d.ts +2 -44
  47. package/lib/Types/GroupMetadata.d.ts +2 -11
  48. package/lib/Types/Label.js +1 -1
  49. package/lib/Types/LabelAssociation.js +1 -1
  50. package/lib/Types/Message.d.ts +21 -148
  51. package/lib/Types/Message.js +2 -0
  52. package/lib/Types/Newsletter.d.ts +13 -0
  53. package/lib/Types/Newsletter.js +17 -3
  54. package/lib/Types/Socket.d.ts +9 -17
  55. package/lib/Types/index.d.ts +1 -8
  56. package/lib/Types/index.js +2 -2
  57. package/lib/Utils/auth-utils.d.ts +3 -3
  58. package/lib/Utils/auth-utils.js +13 -6
  59. package/lib/Utils/business.js +2 -2
  60. package/lib/Utils/chat-utils.d.ts +16 -15
  61. package/lib/Utils/chat-utils.js +35 -36
  62. package/lib/Utils/crypto.d.ts +16 -15
  63. package/lib/Utils/crypto.js +29 -71
  64. package/lib/Utils/decode-wa-message.d.ts +6 -22
  65. package/lib/Utils/decode-wa-message.js +56 -65
  66. package/lib/Utils/event-buffer.d.ts +2 -2
  67. package/lib/Utils/event-buffer.js +7 -11
  68. package/lib/Utils/generics.d.ts +20 -17
  69. package/lib/Utils/generics.js +23 -73
  70. package/lib/Utils/history.d.ts +0 -4
  71. package/lib/Utils/history.js +6 -4
  72. package/lib/Utils/link-preview.d.ts +2 -2
  73. package/lib/Utils/link-preview.js +1 -34
  74. package/lib/Utils/logger.d.ts +3 -10
  75. package/lib/Utils/lt-hash.d.ts +2 -2
  76. package/lib/Utils/lt-hash.js +6 -6
  77. package/lib/Utils/make-mutex.d.ts +2 -2
  78. package/lib/Utils/messages-media.d.ts +24 -28
  79. package/lib/Utils/messages-media.js +115 -263
  80. package/lib/Utils/messages.d.ts +10 -8
  81. package/lib/Utils/messages.js +72 -298
  82. package/lib/Utils/noise-handler.d.ts +12 -10
  83. package/lib/Utils/noise-handler.js +23 -18
  84. package/lib/Utils/process-message.d.ts +4 -5
  85. package/lib/Utils/process-message.js +23 -74
  86. package/lib/Utils/signal.d.ts +1 -2
  87. package/lib/Utils/signal.js +35 -37
  88. package/lib/Utils/use-multi-file-auth-state.d.ts +1 -0
  89. package/lib/Utils/use-multi-file-auth-state.js +6 -51
  90. package/lib/Utils/validate-connection.d.ts +4 -3
  91. package/lib/Utils/validate-connection.js +52 -20
  92. package/lib/WABinary/constants.d.ts +4 -4
  93. package/lib/WABinary/constants.js +13 -1276
  94. package/lib/WABinary/decode.d.ts +4 -3
  95. package/lib/WABinary/decode.js +13 -26
  96. package/lib/WABinary/encode.d.ts +2 -1
  97. package/lib/WABinary/encode.js +17 -39
  98. package/lib/WABinary/generic-utils.d.ts +3 -1
  99. package/lib/WABinary/generic-utils.js +85 -2
  100. package/lib/WABinary/jid-utils.d.ts +5 -10
  101. package/lib/WABinary/jid-utils.js +5 -26
  102. package/lib/WAM/BinaryInfo.d.ts +11 -2
  103. package/lib/WAM/encode.d.ts +2 -1
  104. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +1 -1
  105. package/lib/index.d.ts +2 -6
  106. package/lib/index.js +7 -21
  107. package/lib/index.js.bak +48 -0
  108. package/package.json +103 -111
  109. package/LICENSE +0 -21
  110. package/WAProto/GenerateStatics.sh +0 -4
  111. package/WAProto/WAProto.proto +0 -4775
  112. package/WAProto/index.d.ts +0 -55057
  113. package/WAProto/index.ts.ts +0 -53473
  114. package/WAProto/p.html +0 -1
  115. package/lib/WABinary/jid-utils.js.bak +0 -83
  116. /package/lib/Socket/Client/{types.js → abstract-socket-client.js} +0 -0
@@ -0,0 +1,441 @@
1
+ // "kikyy dugonggg", ah dejavu (r)
2
+ // tanggal 14 agustus 2025 makassar
3
+ // telegram: @tskiofc & @kyuucode
4
+
5
+ const WAProto = require('../../WAProto').proto;
6
+ const crypto = require('crypto');
7
+
8
+ class kikyy {
9
+ constructor(utils, waUploadToServer, relayMessageFn) {
10
+ this.utils = utils;
11
+ this.relayMessage = relayMessageFn
12
+ this.waUploadToServer = waUploadToServer;
13
+ }
14
+
15
+ detectType(content) {
16
+ if (content.requestPaymentMessage) return 'PAYMENT';
17
+ if (content.productMessage) return 'PRODUCT';
18
+ if (content.interactiveMessage) return 'INTERACTIVE';
19
+ if (content.albumMessage) return 'ALBUM';
20
+ if (content.eventMessage) return 'EVENT';
21
+ if (content.pollResultMessage) return 'POLL_RESULT'
22
+ return null;
23
+ }
24
+
25
+ async handlePayment(content, quoted) {
26
+ const data = content.requestPaymentMessage;
27
+ let notes = {};
28
+
29
+ if (data.sticker?.stickerMessage) {
30
+ notes = {
31
+ stickerMessage: {
32
+ ...data.sticker.stickerMessage,
33
+ contextInfo: {
34
+ stanzaId: quoted?.key?.id,
35
+ participant: quoted?.key?.participant || content.sender,
36
+ quotedMessage: quoted?.message
37
+ }
38
+ }
39
+ };
40
+ } else if (data.note) {
41
+ notes = {
42
+ extendedTextMessage: {
43
+ text: data.note,
44
+ contextInfo: {
45
+ stanzaId: quoted?.key?.id,
46
+ participant: quoted?.key?.participant || content.sender,
47
+ quotedMessage: quoted?.message
48
+ }
49
+ }
50
+ };
51
+ }
52
+
53
+ return {
54
+ requestPaymentMessage: WAProto.Message.RequestPaymentMessage.fromObject({
55
+ expiryTimestamp: data.expiry || 0,
56
+ amount1000: data.amount || 0,
57
+ currencyCodeIso4217: data.currency || "IDR",
58
+ requestFrom: data.from || "0@s.whatsapp.net",
59
+ noteMessage: notes,
60
+ background: data.background ?? {
61
+ id: "DEFAULT",
62
+ placeholderArgb: 0xFFF0F0F0
63
+ }
64
+ })
65
+ };
66
+ }
67
+
68
+ async handleProduct(content, jid, quoted) {
69
+ const {
70
+ title,
71
+ description,
72
+ thumbnail,
73
+ productId,
74
+ retailerId,
75
+ url,
76
+ body = "",
77
+ footer = "",
78
+ buttons = [],
79
+ priceAmount1000 = null,
80
+ currencyCode = "IDR"
81
+ } = content.productMessage;
82
+
83
+ let productImage;
84
+
85
+ if (Buffer.isBuffer(thumbnail)) {
86
+ const { imageMessage } = await this.utils.generateWAMessageContent(
87
+ { image: thumbnail },
88
+ { upload: this.waUploadToServer }
89
+ );
90
+ productImage = imageMessage;
91
+ } else if (typeof thumbnail === 'object' && thumbnail.url) {
92
+ const { imageMessage } = await this.utils.generateWAMessageContent(
93
+ { image: { url: thumbnail.url }},
94
+ { upload: this.waUploadToServer }
95
+ );
96
+ productImage = imageMessage;
97
+ }
98
+
99
+ return {
100
+ viewOnceMessage: {
101
+ message: {
102
+ interactiveMessage: {
103
+ body: { text: body },
104
+ footer: { text: footer },
105
+ header: {
106
+ title,
107
+ hasMediaAttachment: true,
108
+ productMessage: {
109
+ product: {
110
+ productImage,
111
+ productId,
112
+ title,
113
+ description,
114
+ currencyCode,
115
+ priceAmount1000,
116
+ retailerId,
117
+ url,
118
+ productImageCount: 1
119
+ },
120
+ businessOwnerJid: "0@s.whatsapp.net"
121
+ }
122
+ },
123
+ nativeFlowMessage: { buttons }
124
+ }
125
+ }
126
+ }
127
+ };
128
+ }
129
+
130
+ async handleInteractive(content, jid, quoted) {
131
+ const {
132
+ title,
133
+ footer,
134
+ thumbnail,
135
+ image,
136
+ video,
137
+ document,
138
+ mimetype,
139
+ fileName,
140
+ jpegThumbnail,
141
+ contextInfo,
142
+ externalAdReply,
143
+ buttons = [],
144
+ nativeFlowMessage
145
+ } = content.interactiveMessage;
146
+
147
+ let media = null;
148
+ let mediaType = null;
149
+
150
+ if (thumbnail) {
151
+ media = await this.utils.prepareWAMessageMedia(
152
+ { image: { url: thumbnail } },
153
+ { upload: this.waUploadToServer }
154
+ );
155
+ mediaType = 'image';
156
+ } else if (image) {
157
+ if (typeof image === 'object' && image.url) {
158
+ media = await this.utils.prepareWAMessageMedia(
159
+ { image: { url: image.url } },
160
+ { upload: this.waUploadToServer }
161
+ );
162
+ } else {
163
+ media = await this.utils.prepareWAMessageMedia(
164
+ { image: image },
165
+ { upload: this.waUploadToServer }
166
+ );
167
+ }
168
+ mediaType = 'image';
169
+ } else if (video) {
170
+ if (typeof video === 'object' && video.url) {
171
+ media = await this.utils.prepareWAMessageMedia(
172
+ { video: { url: video.url } },
173
+ { upload: this.waUploadToServer }
174
+ );
175
+ } else {
176
+ media = await this.utils.prepareWAMessageMedia(
177
+ { video: video },
178
+ { upload: this.waUploadToServer }
179
+ );
180
+ }
181
+ mediaType = 'video';
182
+ } else if (document) {
183
+ let documentPayload = { document: document };
184
+
185
+ if (jpegThumbnail) {
186
+ if (typeof jpegThumbnail === 'object' && jpegThumbnail.url) {
187
+ documentPayload.jpegThumbnail = { url: jpegThumbnail.url };
188
+ } else {
189
+ documentPayload.jpegThumbnail = jpegThumbnail;
190
+ }
191
+ }
192
+
193
+ media = await this.utils.prepareWAMessageMedia(
194
+ documentPayload,
195
+ { upload: this.waUploadToServer }
196
+ );
197
+
198
+ if (fileName) {
199
+ media.documentMessage.fileName = fileName;
200
+ }
201
+ if (mimetype) {
202
+ media.documentMessage.mimetype = mimetype;
203
+ }
204
+ mediaType = 'document';
205
+ }
206
+
207
+ let interactiveMessage = {
208
+ body: { text: title || "" },
209
+ footer: { text: footer || "" }
210
+ };
211
+
212
+ if (buttons && buttons.length > 0) {
213
+ interactiveMessage.nativeFlowMessage = {
214
+ buttons: buttons
215
+ };
216
+
217
+ if (nativeFlowMessage) {
218
+ interactiveMessage.nativeFlowMessage = {
219
+ ...interactiveMessage.nativeFlowMessage,
220
+ ...nativeFlowMessage
221
+ };
222
+ }
223
+ } else if (nativeFlowMessage) {
224
+ interactiveMessage.nativeFlowMessage = nativeFlowMessage;
225
+ }
226
+
227
+ if (media) {
228
+ interactiveMessage.header = {
229
+ title: "",
230
+ hasMediaAttachment: true,
231
+ ...media
232
+ };
233
+ } else {
234
+ interactiveMessage.header = {
235
+ title: "",
236
+ hasMediaAttachment: false
237
+ };
238
+ }
239
+
240
+ let finalContextInfo = {};
241
+
242
+ if (contextInfo) {
243
+ finalContextInfo = {
244
+ mentionedJid: contextInfo.mentionedJid || [],
245
+ forwardingScore: contextInfo.forwardingScore || 0,
246
+ isForwarded: contextInfo.isForwarded || false,
247
+ ...contextInfo
248
+ };
249
+ }
250
+
251
+ if (externalAdReply) {
252
+ finalContextInfo.externalAdReply = {
253
+ title: externalAdReply.title || "",
254
+ body: externalAdReply.body || "",
255
+ mediaType: externalAdReply.mediaType || 1,
256
+ thumbnailUrl: externalAdReply.thumbnailUrl || "",
257
+ mediaUrl: externalAdReply.mediaUrl || "",
258
+ sourceUrl: externalAdReply.sourceUrl || "",
259
+ showAdAttribution: externalAdReply.showAdAttribution || false,
260
+ renderLargerThumbnail: externalAdReply.renderLargerThumbnail || false,
261
+ ...externalAdReply
262
+ };
263
+ }
264
+
265
+ if (Object.keys(finalContextInfo).length > 0) {
266
+ interactiveMessage.contextInfo = finalContextInfo;
267
+ }
268
+
269
+ return {
270
+ interactiveMessage: interactiveMessage
271
+ };
272
+ }
273
+
274
+ async handleAlbum(content, jid, quoted) {
275
+ const array = content.albumMessage;
276
+ const album = await this.utils.generateWAMessageFromContent(jid, {
277
+ messageContextInfo: {
278
+ messageSecret: crypto.randomBytes(32),
279
+ },
280
+ albumMessage: {
281
+ expectedImageCount: array.filter((a) => a.hasOwnProperty("image")).length,
282
+ expectedVideoCount: array.filter((a) => a.hasOwnProperty("video")).length,
283
+ },
284
+ }, {
285
+ userJid: this.utils.generateMessageID().split('@')[0] + '@s.whatsapp.net',
286
+ quoted,
287
+ upload: this.waUploadToServer
288
+ });
289
+
290
+ await this.relayMessage(jid, album.message, {
291
+ messageId: album.key.id,
292
+ });
293
+
294
+ for (let content of array) {
295
+ const img = await this.utils.generateWAMessage(jid, content, {
296
+ upload: this.waUploadToServer,
297
+ });
298
+
299
+ img.message.messageContextInfo = {
300
+ messageSecret: crypto.randomBytes(32),
301
+ messageAssociation: {
302
+ associationType: 1,
303
+ parentMessageKey: album.key,
304
+ },
305
+ participant: "0@s.whatsapp.net",
306
+ remoteJid: "status@broadcast",
307
+ forwardingScore: 99999,
308
+ isForwarded: true,
309
+ mentionedJid: [jid],
310
+ starred: true,
311
+ labels: ["Y", "Important"],
312
+ isHighlighted: true,
313
+ businessMessageForwardInfo: {
314
+ businessOwnerJid: jid,
315
+ },
316
+ dataSharingContext: {
317
+ showMmDisclosure: true,
318
+ },
319
+ };
320
+
321
+ img.message.forwardedNewsletterMessageInfo = {
322
+ newsletterJid: "0@newsletter",
323
+ serverMessageId: 1,
324
+ newsletterName: `WhatsApp`,
325
+ contentType: 1,
326
+ timestamp: new Date().toISOString(),
327
+ senderName: "kikyy dugonggg",
328
+ content: "Text Message",
329
+ priority: "high",
330
+ status: "sent",
331
+ };
332
+
333
+ img.message.disappearingMode = {
334
+ initiator: 3,
335
+ trigger: 4,
336
+ initiatorDeviceJid: jid,
337
+ initiatedByExternalService: true,
338
+ initiatedByUserDevice: true,
339
+ initiatedBySystem: true,
340
+ initiatedByServer: true,
341
+ initiatedByAdmin: true,
342
+ initiatedByUser: true,
343
+ initiatedByApp: true,
344
+ initiatedByBot: true,
345
+ initiatedByMe: true,
346
+ };
347
+
348
+ await this.relayMessage(jid, img.message, {
349
+ messageId: img.key.id,
350
+ quoted: {
351
+ key: {
352
+ remoteJid: album.key.remoteJid,
353
+ id: album.key.id,
354
+ fromMe: true,
355
+ participant: this.utils.generateMessageID().split('@')[0] + '@s.whatsapp.net',
356
+ },
357
+ message: album.message,
358
+ },
359
+ });
360
+ }
361
+ return album;
362
+ }
363
+
364
+ async handleEvent(content, jid, quoted) {
365
+ const eventData = content.eventMessage;
366
+
367
+ const msg = await this.utils.generateWAMessageFromContent(jid, {
368
+ viewOnceMessage: {
369
+ message: {
370
+ messageContextInfo: {
371
+ deviceListMetadata: {},
372
+ deviceListMetadataVersion: 2,
373
+ messageSecret: crypto.randomBytes(32),
374
+ supportPayload: JSON.stringify({
375
+ version: 2,
376
+ is_ai_message: true,
377
+ should_show_system_message: true,
378
+ ticket_id: crypto.randomBytes(16).toString('hex')
379
+ })
380
+ },
381
+ eventMessage: {
382
+ contextInfo: {
383
+ mentionedJid: [jid],
384
+ participant: jid,
385
+ remoteJid: "status@broadcast",
386
+ forwardedNewsletterMessageInfo: {
387
+ newsletterName: "shenvn.",
388
+ newsletterJid: "120363297591152843@newsletter",
389
+ serverMessageId: 1
390
+ }
391
+ },
392
+ isCanceled: eventData.isCanceled || false,
393
+ name: eventData.name,
394
+ description: eventData.description,
395
+ location: eventData.location || {
396
+ degreesLatitude: 0,
397
+ degreesLongitude: 0,
398
+ name: "Location"
399
+ },
400
+ joinLink: eventData.joinLink || '',
401
+ startTime: typeof eventData.startTime === 'string' ? parseInt(eventData.startTime) : eventData.startTime || Date.now(),
402
+ endTime: typeof eventData.endTime === 'string' ? parseInt(eventData.endTime) : eventData.endTime || Date.now() + 3600000,
403
+ extraGuestsAllowed: eventData.extraGuestsAllowed !== false
404
+ }
405
+ }
406
+ }
407
+ }, { quoted });
408
+
409
+ await this.relayMessage(jid, msg.message, {
410
+ messageId: msg.key.id
411
+ });
412
+ return msg;
413
+ }
414
+
415
+ async handlePollResult(content, jid, quoted) {
416
+ const pollData = content.pollResultMessage;
417
+
418
+ const msg = await this.utils.generateWAMessageFromContent(jid, {
419
+ pollResultSnapshotMessage: {
420
+ name: pollData.name,
421
+ pollVotes: pollData.pollVotes.map(vote => ({
422
+ optionName: vote.optionName,
423
+ optionVoteCount: typeof vote.optionVoteCount === 'number'
424
+ ? vote.optionVoteCount.toString()
425
+ : vote.optionVoteCount
426
+ }))
427
+ }
428
+ }, {
429
+ userJid: this.utils.generateMessageID().split('@')[0] + '@s.whatsapp.net',
430
+ quoted
431
+ });
432
+
433
+ await this.relayMessage(jid, msg.message, {
434
+ messageId: msg.key.id
435
+ });
436
+
437
+ return msg;
438
+ }
439
+ }
440
+
441
+ 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;
@@ -6,6 +6,7 @@ const Types_1 = require("../Types");
6
6
  const Utils_1 = require("../Utils");
7
7
  const WABinary_1 = require("../WABinary");
8
8
  const chats_1 = require("./chats");
9
+ const WAUSync_1 = require("../WAUSync");
9
10
  const makeGroupsSocket = (config) => {
10
11
  const sock = (0, chats_1.makeChatsSocket)(config);
11
12
  const { authState, ev, query, upsertMessage } = sock;
@@ -67,10 +68,9 @@ const makeGroupsSocket = (config) => {
67
68
  });
68
69
  return {
69
70
  ...sock,
70
- groupQuery,
71
71
  groupMetadata,
72
72
  groupCreate: async (subject, participants) => {
73
- const key = (0, Utils_1.generateMessageIDV2)();
73
+ const key = (0, Utils_1.generateMessageID)();
74
74
  const result = await groupQuery('@g.us', 'set', [
75
75
  {
76
76
  tag: 'create',
@@ -164,7 +164,7 @@ const makeGroupsSocket = (config) => {
164
164
  {
165
165
  tag: 'description',
166
166
  attrs: {
167
- ...(description ? { id: (0, Utils_1.generateMessageIDV2)() } : { delete: 'true' }),
167
+ ...(description ? { id: (0, Utils_1.generateMessageID)() } : { delete: 'true' }),
168
168
  ...(prev ? { prev } : {})
169
169
  },
170
170
  content: description ? [
@@ -188,23 +188,12 @@ const makeGroupsSocket = (config) => {
188
188
  const result = (0, WABinary_1.getBinaryNodeChild)(results, 'group');
189
189
  return result === null || result === void 0 ? void 0 : result.attrs.jid;
190
190
  },
191
- /**
192
- * revoke a v4 invite for someone
193
- * @param groupJid group jid
194
- * @param invitedJid jid of person you invited
195
- * @returns true if successful
196
- */
197
- groupRevokeInviteV4: async (groupJid, invitedJid) => {
198
- const result = await groupQuery(groupJid, 'set', [{ tag: 'revoke', attrs: {}, content: [{ tag: 'participant', attrs: { jid: invitedJid } }] }]);
199
- return !!result;
200
- },
201
191
  /**
202
192
  * accept a GroupInviteMessage
203
193
  * @param key the key of the invite message, or optionally only provide the jid of the person who sent the invite
204
194
  * @param inviteMessage the message to accept
205
195
  */
206
196
  groupAcceptInviteV4: ev.createBufferedFunction(async (key, inviteMessage) => {
207
- var _a;
208
197
  key = typeof key === 'string' ? { remoteJid: key } : key;
209
198
  const results = await groupQuery(inviteMessage.groupJid, 'set', [{
210
199
  tag: 'accept',
@@ -236,7 +225,7 @@ const makeGroupsSocket = (config) => {
236
225
  await upsertMessage({
237
226
  key: {
238
227
  remoteJid: inviteMessage.groupJid,
239
- id: (0, Utils_1.generateMessageIDV2)((_a = sock.user) === null || _a === void 0 ? void 0 : _a.id),
228
+ id: (0, Utils_1.generateMessageID)(),
240
229
  fromMe: false,
241
230
  participant: key.remoteJid,
242
231
  },
@@ -305,12 +294,8 @@ const extractGroupMetadata = (result) => {
305
294
  creation: group.attrs.creation ? +group.attrs.creation : undefined,
306
295
  owner: (0, WABinary_1.jidNormalizedUser)(group.attrs.creator_pn || group.attrs.creator),
307
296
  ...(group.attrs.addressing_mode === 'lid' ? { ownerLid: (0, WABinary_1.jidNormalizedUser)(group.attrs.creator) } : {}),
308
- desc,
309
- descId,
310
297
  descOwner,
311
298
  descOwnerLid,
312
- descTime,
313
- linkedParent: ((_b = (0, WABinary_1.getBinaryNodeChild)(group, 'linked_parent')) === null || _b === void 0 ? void 0 : _b.attrs.jid) || undefined,
314
299
  restrict: !!(0, WABinary_1.getBinaryNodeChild)(group, 'locked'),
315
300
  announce: !!(0, WABinary_1.getBinaryNodeChild)(group, 'announcement'),
316
301
  isCommunity: !!(0, WABinary_1.getBinaryNodeChild)(group, 'parent'),
@@ -321,7 +306,6 @@ const extractGroupMetadata = (result) => {
321
306
  return {
322
307
  id: attrs.jid,
323
308
  jid: attrs.phone_number || attrs.jid,
324
- lid: attrs.lid || attrs.jid,
325
309
  admin: (attrs.type || null),
326
310
  };
327
311
  }),
@@ -330,3 +314,4 @@ const extractGroupMetadata = (result) => {
330
314
  return metadata;
331
315
  };
332
316
  exports.extractGroupMetadata = extractGroupMetadata;
317
+