baileyz 1.0.6 → 1.0.8
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/lib/Socket/chats.js +28 -15
- package/lib/Socket/{dxz.d.ts → dugong.d.ts} +37 -51
- package/lib/Socket/dugong.js +484 -0
- package/lib/Socket/messages-send.js +12 -16
- package/lib/Utils/generics.js +1 -1
- package/lib/Utils/messages-media.js +545 -835
- package/lib/Utils/messages.js +497 -1571
- package/lib/Utils/validate-connection.js +1 -1
- package/lib/WABinary/jid-utils.js +0 -3
- package/lib/WAUSync/index.d.ts +3 -0
- package/lib/index.js +1 -1
- package/package.json +1 -1
- package/lib/Defaults/constants.js +0 -74
- package/lib/Defaults/media.js +0 -48
- package/lib/Socket/dxz.js +0 -591
|
@@ -0,0 +1,484 @@
|
|
|
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
|
+
const Utils_1 = require("../Utils");
|
|
8
|
+
|
|
9
|
+
class kikyy {
|
|
10
|
+
constructor(utils, waUploadToServer, relayMessageFn) {
|
|
11
|
+
this.utils = utils;
|
|
12
|
+
this.relayMessage = relayMessageFn
|
|
13
|
+
this.waUploadToServer = waUploadToServer;
|
|
14
|
+
|
|
15
|
+
this.bail = {
|
|
16
|
+
generateWAMessageContent: this.utils.generateWAMessageContent || Utils_1.generateWAMessageContent,
|
|
17
|
+
generateMessageID: Utils_1.generateMessageID,
|
|
18
|
+
getContentType: (msg) => Object.keys(msg.message || {})[0]
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
detectType(content) {
|
|
23
|
+
if (content.requestPaymentMessage) return 'PAYMENT';
|
|
24
|
+
if (content.productMessage) return 'PRODUCT';
|
|
25
|
+
if (content.interactiveMessage) return 'INTERACTIVE';
|
|
26
|
+
if (content.albumMessage) return 'ALBUM';
|
|
27
|
+
if (content.eventMessage) return 'EVENT';
|
|
28
|
+
if (content.pollResultMessage) return 'POLL_RESULT';
|
|
29
|
+
if (content.groupStatusMessage) return 'GROUP_STORY';
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
async handlePayment(content, quoted) {
|
|
34
|
+
const data = content.requestPaymentMessage;
|
|
35
|
+
let notes = {};
|
|
36
|
+
|
|
37
|
+
if (data.sticker?.stickerMessage) {
|
|
38
|
+
notes = {
|
|
39
|
+
stickerMessage: {
|
|
40
|
+
...data.sticker.stickerMessage,
|
|
41
|
+
contextInfo: {
|
|
42
|
+
stanzaId: quoted?.key?.id,
|
|
43
|
+
participant: quoted?.key?.participant || content.sender,
|
|
44
|
+
quotedMessage: quoted?.message
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
} else if (data.note) {
|
|
49
|
+
notes = {
|
|
50
|
+
extendedTextMessage: {
|
|
51
|
+
text: data.note,
|
|
52
|
+
contextInfo: {
|
|
53
|
+
stanzaId: quoted?.key?.id,
|
|
54
|
+
participant: quoted?.key?.participant || content.sender,
|
|
55
|
+
quotedMessage: quoted?.message
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return {
|
|
62
|
+
requestPaymentMessage: WAProto.Message.RequestPaymentMessage.fromObject({
|
|
63
|
+
expiryTimestamp: data.expiry || 0,
|
|
64
|
+
amount1000: data.amount || 0,
|
|
65
|
+
currencyCodeIso4217: data.currency || "IDR",
|
|
66
|
+
requestFrom: data.from || "0@s.whatsapp.net",
|
|
67
|
+
noteMessage: notes,
|
|
68
|
+
background: data.background ?? {
|
|
69
|
+
id: "DEFAULT",
|
|
70
|
+
placeholderArgb: 0xFFF0F0F0
|
|
71
|
+
}
|
|
72
|
+
})
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
async handleProduct(content, jid, quoted) {
|
|
77
|
+
const {
|
|
78
|
+
title,
|
|
79
|
+
description,
|
|
80
|
+
thumbnail,
|
|
81
|
+
productId,
|
|
82
|
+
retailerId,
|
|
83
|
+
url,
|
|
84
|
+
body = "",
|
|
85
|
+
footer = "",
|
|
86
|
+
buttons = [],
|
|
87
|
+
priceAmount1000 = null,
|
|
88
|
+
currencyCode = "IDR"
|
|
89
|
+
} = content.productMessage;
|
|
90
|
+
|
|
91
|
+
let productImage;
|
|
92
|
+
|
|
93
|
+
if (Buffer.isBuffer(thumbnail)) {
|
|
94
|
+
const { imageMessage } = await this.utils.generateWAMessageContent(
|
|
95
|
+
{ image: thumbnail },
|
|
96
|
+
{ upload: this.waUploadToServer }
|
|
97
|
+
);
|
|
98
|
+
productImage = imageMessage;
|
|
99
|
+
} else if (typeof thumbnail === 'object' && thumbnail.url) {
|
|
100
|
+
const { imageMessage } = await this.utils.generateWAMessageContent(
|
|
101
|
+
{ image: { url: thumbnail.url }},
|
|
102
|
+
{ upload: this.waUploadToServer }
|
|
103
|
+
);
|
|
104
|
+
productImage = imageMessage;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return {
|
|
108
|
+
viewOnceMessage: {
|
|
109
|
+
message: {
|
|
110
|
+
interactiveMessage: {
|
|
111
|
+
body: { text: body },
|
|
112
|
+
footer: { text: footer },
|
|
113
|
+
header: {
|
|
114
|
+
title,
|
|
115
|
+
hasMediaAttachment: true,
|
|
116
|
+
productMessage: {
|
|
117
|
+
product: {
|
|
118
|
+
productImage,
|
|
119
|
+
productId,
|
|
120
|
+
title,
|
|
121
|
+
description,
|
|
122
|
+
currencyCode,
|
|
123
|
+
priceAmount1000,
|
|
124
|
+
retailerId,
|
|
125
|
+
url,
|
|
126
|
+
productImageCount: 1
|
|
127
|
+
},
|
|
128
|
+
businessOwnerJid: "0@s.whatsapp.net"
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
nativeFlowMessage: { buttons }
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
async handleInteractive(content, jid, quoted) {
|
|
139
|
+
const {
|
|
140
|
+
title,
|
|
141
|
+
footer,
|
|
142
|
+
thumbnail,
|
|
143
|
+
image,
|
|
144
|
+
video,
|
|
145
|
+
document,
|
|
146
|
+
mimetype,
|
|
147
|
+
fileName,
|
|
148
|
+
jpegThumbnail,
|
|
149
|
+
contextInfo,
|
|
150
|
+
externalAdReply,
|
|
151
|
+
buttons = [],
|
|
152
|
+
nativeFlowMessage,
|
|
153
|
+
header
|
|
154
|
+
} = content.interactiveMessage;
|
|
155
|
+
|
|
156
|
+
let media = null;
|
|
157
|
+
let mediaType = null;
|
|
158
|
+
|
|
159
|
+
if (thumbnail) {
|
|
160
|
+
media = await this.utils.prepareWAMessageMedia(
|
|
161
|
+
{ image: { url: thumbnail } },
|
|
162
|
+
{ upload: this.waUploadToServer }
|
|
163
|
+
);
|
|
164
|
+
mediaType = 'image';
|
|
165
|
+
} else if (image) {
|
|
166
|
+
if (typeof image === 'object' && image.url) {
|
|
167
|
+
media = await this.utils.prepareWAMessageMedia(
|
|
168
|
+
{ image: { url: image.url } },
|
|
169
|
+
{ upload: this.waUploadToServer }
|
|
170
|
+
);
|
|
171
|
+
} else {
|
|
172
|
+
media = await this.utils.prepareWAMessageMedia(
|
|
173
|
+
{ image: image },
|
|
174
|
+
{ upload: this.waUploadToServer }
|
|
175
|
+
);
|
|
176
|
+
}
|
|
177
|
+
mediaType = 'image';
|
|
178
|
+
} else if (video) {
|
|
179
|
+
if (typeof video === 'object' && video.url) {
|
|
180
|
+
media = await this.utils.prepareWAMessageMedia(
|
|
181
|
+
{ video: { url: video.url } },
|
|
182
|
+
{ upload: this.waUploadToServer }
|
|
183
|
+
);
|
|
184
|
+
} else {
|
|
185
|
+
media = await this.utils.prepareWAMessageMedia(
|
|
186
|
+
{ video: video },
|
|
187
|
+
{ upload: this.waUploadToServer }
|
|
188
|
+
);
|
|
189
|
+
}
|
|
190
|
+
mediaType = 'video';
|
|
191
|
+
} else if (document) {
|
|
192
|
+
let documentPayload = {
|
|
193
|
+
document: document
|
|
194
|
+
};
|
|
195
|
+
if (jpegThumbnail) {
|
|
196
|
+
if (typeof jpegThumbnail === 'object' && jpegThumbnail.url) {
|
|
197
|
+
documentPayload.jpegThumbnail = { url: jpegThumbnail.url };
|
|
198
|
+
} else {
|
|
199
|
+
documentPayload.jpegThumbnail = jpegThumbnail;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
media = await this.utils.prepareWAMessageMedia(
|
|
204
|
+
documentPayload,
|
|
205
|
+
{ upload: this.waUploadToServer }
|
|
206
|
+
);
|
|
207
|
+
if (fileName) {
|
|
208
|
+
media.documentMessage.fileName = fileName;
|
|
209
|
+
}
|
|
210
|
+
if (mimetype) {
|
|
211
|
+
media.documentMessage.mimetype = mimetype;
|
|
212
|
+
}
|
|
213
|
+
mediaType = 'document';
|
|
214
|
+
}
|
|
215
|
+
let interactiveMessage = {
|
|
216
|
+
body: { text: title || "" },
|
|
217
|
+
footer: { text: footer || "" }
|
|
218
|
+
};
|
|
219
|
+
if (buttons && buttons.length > 0) {
|
|
220
|
+
interactiveMessage.nativeFlowMessage = {
|
|
221
|
+
buttons: buttons
|
|
222
|
+
};
|
|
223
|
+
if (nativeFlowMessage) {
|
|
224
|
+
interactiveMessage.nativeFlowMessage = {
|
|
225
|
+
...interactiveMessage.nativeFlowMessage,
|
|
226
|
+
...nativeFlowMessage
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
} else if (nativeFlowMessage) {
|
|
230
|
+
interactiveMessage.nativeFlowMessage = nativeFlowMessage;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
if (media) {
|
|
234
|
+
interactiveMessage.header = {
|
|
235
|
+
title: header || "",
|
|
236
|
+
hasMediaAttachment: true,
|
|
237
|
+
...media
|
|
238
|
+
};
|
|
239
|
+
} else {
|
|
240
|
+
interactiveMessage.header = {
|
|
241
|
+
title: header || "",
|
|
242
|
+
hasMediaAttachment: false
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
let finalContextInfo = {};
|
|
247
|
+
if (contextInfo) {
|
|
248
|
+
finalContextInfo = {
|
|
249
|
+
mentionedJid: contextInfo.mentionedJid || [],
|
|
250
|
+
forwardingScore: contextInfo.forwardingScore || 0,
|
|
251
|
+
isForwarded: contextInfo.isForwarded || false,
|
|
252
|
+
...contextInfo
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
if (externalAdReply) {
|
|
257
|
+
finalContextInfo.externalAdReply = {
|
|
258
|
+
title: externalAdReply.title || "",
|
|
259
|
+
body: externalAdReply.body || "",
|
|
260
|
+
mediaType: externalAdReply.mediaType || 1,
|
|
261
|
+
thumbnailUrl: externalAdReply.thumbnailUrl || "",
|
|
262
|
+
mediaUrl: externalAdReply.mediaUrl || "",
|
|
263
|
+
sourceUrl: externalAdReply.sourceUrl || "",
|
|
264
|
+
showAdAttribution: externalAdReply.showAdAttribution || false,
|
|
265
|
+
renderLargerThumbnail: externalAdReply.renderLargerThumbnail || false,
|
|
266
|
+
...externalAdReply
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
if (Object.keys(finalContextInfo).length > 0) {
|
|
271
|
+
interactiveMessage.contextInfo = finalContextInfo;
|
|
272
|
+
}
|
|
273
|
+
return {
|
|
274
|
+
interactiveMessage: interactiveMessage
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
async handleAlbum(content, jid, quoted) {
|
|
279
|
+
const array = content.albumMessage;
|
|
280
|
+
const album = await this.utils.generateWAMessageFromContent(jid, {
|
|
281
|
+
messageContextInfo: {
|
|
282
|
+
messageSecret: crypto.randomBytes(32),
|
|
283
|
+
},
|
|
284
|
+
albumMessage: {
|
|
285
|
+
expectedImageCount: array.filter((a) => a.hasOwnProperty("image")).length,
|
|
286
|
+
expectedVideoCount: array.filter((a) => a.hasOwnProperty("video")).length,
|
|
287
|
+
},
|
|
288
|
+
}, {
|
|
289
|
+
userJid: this.utils.generateMessageID().split('@')[0] + '@s.whatsapp.net',
|
|
290
|
+
quoted,
|
|
291
|
+
upload: this.waUploadToServer
|
|
292
|
+
});
|
|
293
|
+
|
|
294
|
+
await this.relayMessage(jid, album.message, {
|
|
295
|
+
messageId: album.key.id,
|
|
296
|
+
});
|
|
297
|
+
|
|
298
|
+
for (let content of array) {
|
|
299
|
+
const img = await this.utils.generateWAMessage(jid, content, {
|
|
300
|
+
upload: this.waUploadToServer,
|
|
301
|
+
});
|
|
302
|
+
|
|
303
|
+
img.message.messageContextInfo = {
|
|
304
|
+
messageSecret: crypto.randomBytes(32),
|
|
305
|
+
messageAssociation: {
|
|
306
|
+
associationType: 1,
|
|
307
|
+
parentMessageKey: album.key,
|
|
308
|
+
},
|
|
309
|
+
participant: "0@s.whatsapp.net",
|
|
310
|
+
remoteJid: "status@broadcast",
|
|
311
|
+
forwardingScore: 99999,
|
|
312
|
+
isForwarded: true,
|
|
313
|
+
mentionedJid: [jid],
|
|
314
|
+
starred: true,
|
|
315
|
+
labels: ["Y", "Important"],
|
|
316
|
+
isHighlighted: true,
|
|
317
|
+
businessMessageForwardInfo: {
|
|
318
|
+
businessOwnerJid: jid,
|
|
319
|
+
},
|
|
320
|
+
dataSharingContext: {
|
|
321
|
+
showMmDisclosure: true,
|
|
322
|
+
},
|
|
323
|
+
};
|
|
324
|
+
|
|
325
|
+
img.message.forwardedNewsletterMessageInfo = {
|
|
326
|
+
newsletterJid: "0@newsletter",
|
|
327
|
+
serverMessageId: 1,
|
|
328
|
+
newsletterName: `WhatsApp`,
|
|
329
|
+
contentType: 1,
|
|
330
|
+
timestamp: new Date().toISOString(),
|
|
331
|
+
senderName: "kikyy dugonggg",
|
|
332
|
+
content: "Text Message",
|
|
333
|
+
priority: "high",
|
|
334
|
+
status: "sent",
|
|
335
|
+
};
|
|
336
|
+
|
|
337
|
+
img.message.disappearingMode = {
|
|
338
|
+
initiator: 3,
|
|
339
|
+
trigger: 4,
|
|
340
|
+
initiatorDeviceJid: jid,
|
|
341
|
+
initiatedByExternalService: true,
|
|
342
|
+
initiatedByUserDevice: true,
|
|
343
|
+
initiatedBySystem: true,
|
|
344
|
+
initiatedByServer: true,
|
|
345
|
+
initiatedByAdmin: true,
|
|
346
|
+
initiatedByUser: true,
|
|
347
|
+
initiatedByApp: true,
|
|
348
|
+
initiatedByBot: true,
|
|
349
|
+
initiatedByMe: true,
|
|
350
|
+
};
|
|
351
|
+
|
|
352
|
+
await this.relayMessage(jid, img.message, {
|
|
353
|
+
messageId: img.key.id,
|
|
354
|
+
quoted: {
|
|
355
|
+
key: {
|
|
356
|
+
remoteJid: album.key.remoteJid,
|
|
357
|
+
id: album.key.id,
|
|
358
|
+
fromMe: true,
|
|
359
|
+
participant: this.utils.generateMessageID().split('@')[0] + '@s.whatsapp.net',
|
|
360
|
+
},
|
|
361
|
+
message: album.message,
|
|
362
|
+
},
|
|
363
|
+
});
|
|
364
|
+
}
|
|
365
|
+
return album;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
async handleEvent(content, jid, quoted) {
|
|
369
|
+
const eventData = content.eventMessage;
|
|
370
|
+
|
|
371
|
+
const msg = await this.utils.generateWAMessageFromContent(jid, {
|
|
372
|
+
viewOnceMessage: {
|
|
373
|
+
message: {
|
|
374
|
+
messageContextInfo: {
|
|
375
|
+
deviceListMetadata: {},
|
|
376
|
+
deviceListMetadataVersion: 2,
|
|
377
|
+
messageSecret: crypto.randomBytes(32),
|
|
378
|
+
supportPayload: JSON.stringify({
|
|
379
|
+
version: 2,
|
|
380
|
+
is_ai_message: true,
|
|
381
|
+
should_show_system_message: true,
|
|
382
|
+
ticket_id: crypto.randomBytes(16).toString('hex')
|
|
383
|
+
})
|
|
384
|
+
},
|
|
385
|
+
eventMessage: {
|
|
386
|
+
contextInfo: {
|
|
387
|
+
mentionedJid: [jid],
|
|
388
|
+
participant: jid,
|
|
389
|
+
remoteJid: "status@broadcast",
|
|
390
|
+
forwardedNewsletterMessageInfo: {
|
|
391
|
+
newsletterName: "shenvn.",
|
|
392
|
+
newsletterJid: "120363297591152843@newsletter",
|
|
393
|
+
serverMessageId: 1
|
|
394
|
+
}
|
|
395
|
+
},
|
|
396
|
+
isCanceled: eventData.isCanceled || false,
|
|
397
|
+
name: eventData.name,
|
|
398
|
+
description: eventData.description,
|
|
399
|
+
location: eventData.location || {
|
|
400
|
+
degreesLatitude: 0,
|
|
401
|
+
degreesLongitude: 0,
|
|
402
|
+
name: "Location"
|
|
403
|
+
},
|
|
404
|
+
joinLink: eventData.joinLink || '',
|
|
405
|
+
startTime: typeof eventData.startTime === 'string' ? parseInt(eventData.startTime) : eventData.startTime || Date.now(),
|
|
406
|
+
endTime: typeof eventData.endTime === 'string' ? parseInt(eventData.endTime) : eventData.endTime || Date.now() + 3600000,
|
|
407
|
+
extraGuestsAllowed: eventData.extraGuestsAllowed !== false
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
}, { quoted });
|
|
412
|
+
|
|
413
|
+
await this.relayMessage(jid, msg.message, {
|
|
414
|
+
messageId: msg.key.id
|
|
415
|
+
});
|
|
416
|
+
return msg;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
async handlePollResult(content, jid, quoted) {
|
|
420
|
+
const pollData = content.pollResultMessage;
|
|
421
|
+
|
|
422
|
+
const msg = await this.utils.generateWAMessageFromContent(jid, {
|
|
423
|
+
pollResultSnapshotMessage: {
|
|
424
|
+
name: pollData.name,
|
|
425
|
+
pollVotes: pollData.pollVotes.map(vote => ({
|
|
426
|
+
optionName: vote.optionName,
|
|
427
|
+
optionVoteCount: typeof vote.optionVoteCount === 'number'
|
|
428
|
+
? vote.optionVoteCount.toString()
|
|
429
|
+
: vote.optionVoteCount
|
|
430
|
+
}))
|
|
431
|
+
}
|
|
432
|
+
}, {
|
|
433
|
+
userJid: this.utils.generateMessageID().split('@')[0] + '@s.whatsapp.net',
|
|
434
|
+
quoted
|
|
435
|
+
});
|
|
436
|
+
|
|
437
|
+
await this.relayMessage(jid, msg.message, {
|
|
438
|
+
messageId: msg.key.id
|
|
439
|
+
});
|
|
440
|
+
|
|
441
|
+
return msg;
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
async handleGroupStory(content, jid, quoted) {
|
|
445
|
+
const storyData = content.groupStatusMessage;
|
|
446
|
+
let waMsgContent;
|
|
447
|
+
|
|
448
|
+
if (storyData.message) {
|
|
449
|
+
waMsgContent = storyData;
|
|
450
|
+
} else {
|
|
451
|
+
if (typeof this.bail?.generateWAMessageContent === "function") {
|
|
452
|
+
waMsgContent = await this.bail.generateWAMessageContent(storyData, {
|
|
453
|
+
upload: this.waUploadToServer
|
|
454
|
+
});
|
|
455
|
+
} else if (typeof this.utils?.generateWAMessageContent === "function") {
|
|
456
|
+
waMsgContent = await this.utils.generateWAMessageContent(storyData, {
|
|
457
|
+
upload: this.waUploadToServer
|
|
458
|
+
});
|
|
459
|
+
} else if (typeof this.utils?.prepareMessageContent === "function") {
|
|
460
|
+
waMsgContent = await this.utils.prepareMessageContent(storyData, {
|
|
461
|
+
upload: this.waUploadToServer
|
|
462
|
+
});
|
|
463
|
+
} else {
|
|
464
|
+
waMsgContent = await Utils_1.generateWAMessageContent(storyData, {
|
|
465
|
+
upload: this.waUploadToServer
|
|
466
|
+
});
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
let msg = {
|
|
471
|
+
message: {
|
|
472
|
+
groupStatusMessageV2: {
|
|
473
|
+
message: waMsgContent.message || waMsgContent
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
};
|
|
477
|
+
|
|
478
|
+
return await this.relayMessage(jid, msg.message, {
|
|
479
|
+
messageId: this.bail.generateMessageID()
|
|
480
|
+
});
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
module.exports = kikyy;
|
|
@@ -15,7 +15,7 @@ const link_preview_1 = require("../Utils/link-preview");
|
|
|
15
15
|
const WABinary_1 = require("../WABinary");
|
|
16
16
|
const newsletter_1 = require("./newsletter");
|
|
17
17
|
const WAUSync_1 = require("../WAUSync")
|
|
18
|
-
const
|
|
18
|
+
const kikyy = require('./dugong');
|
|
19
19
|
var ListType = WAProto_1.proto.Message.ListMessage.ListType;
|
|
20
20
|
const makeMessagesSocket = (config) => {
|
|
21
21
|
const {
|
|
@@ -724,7 +724,7 @@ const makeMessagesSocket = (config) => {
|
|
|
724
724
|
return result;
|
|
725
725
|
}
|
|
726
726
|
const waUploadToServer = (0, Utils_1.getWAUploadToServer)(config, refreshMediaConn);
|
|
727
|
-
const
|
|
727
|
+
const rahmi = new kikyy(Utils_1, waUploadToServer, relayMessage);
|
|
728
728
|
const waitForMsgMediaUpdate = (0, Utils_1.bindWaitForEvent)(ev, 'messages.media-update');
|
|
729
729
|
return {
|
|
730
730
|
...sock,
|
|
@@ -733,7 +733,7 @@ const makeMessagesSocket = (config) => {
|
|
|
733
733
|
relayMessage,
|
|
734
734
|
sendReceipt,
|
|
735
735
|
sendReceipts,
|
|
736
|
-
|
|
736
|
+
rahmi,
|
|
737
737
|
readMessages,
|
|
738
738
|
refreshMediaConn,
|
|
739
739
|
getUSyncDevices,
|
|
@@ -792,7 +792,7 @@ const makeMessagesSocket = (config) => {
|
|
|
792
792
|
delete options.ephemeralExpiration
|
|
793
793
|
const { filter = false, quoted } = options;
|
|
794
794
|
const getParticipantAttr = () => filter ? { participant: { jid } } : {};
|
|
795
|
-
const messageType =
|
|
795
|
+
const messageType = rahmi.detectType(content);
|
|
796
796
|
if (typeof content === 'object' && 'disappearingMessagesInChat' in content &&
|
|
797
797
|
typeof content['disappearingMessagesInChat'] !== 'undefined' && WABinary_1.isJidGroup(jid)) {
|
|
798
798
|
const { disappearingMessagesInChat } = content
|
|
@@ -811,14 +811,14 @@ const makeMessagesSocket = (config) => {
|
|
|
811
811
|
if (messageType) {
|
|
812
812
|
switch(messageType) {
|
|
813
813
|
case 'PAYMENT':
|
|
814
|
-
const paymentContent = await
|
|
814
|
+
const paymentContent = await rahmi.handlePayment(content, quoted);
|
|
815
815
|
return await relayMessage(jid, paymentContent, {
|
|
816
816
|
messageId: Utils_1.generateMessageID(),
|
|
817
817
|
...getParticipantAttr()
|
|
818
818
|
});
|
|
819
819
|
|
|
820
820
|
case 'PRODUCT':
|
|
821
|
-
const productContent = await
|
|
821
|
+
const productContent = await rahmi.handleProduct(content, jid, quoted);
|
|
822
822
|
const productMsg = await Utils_1.generateWAMessageFromContent(jid, productContent, { quoted });
|
|
823
823
|
return await relayMessage(jid, productMsg.message, {
|
|
824
824
|
messageId: productMsg.key.id,
|
|
@@ -826,24 +826,20 @@ const makeMessagesSocket = (config) => {
|
|
|
826
826
|
});
|
|
827
827
|
|
|
828
828
|
case 'INTERACTIVE':
|
|
829
|
-
const interactiveContent = await
|
|
829
|
+
const interactiveContent = await rahmi.handleInteractive(content, jid, quoted);
|
|
830
830
|
const interactiveMsg = await Utils_1.generateWAMessageFromContent(jid, interactiveContent, { quoted });
|
|
831
831
|
return await relayMessage(jid, interactiveMsg.message, {
|
|
832
832
|
messageId: interactiveMsg.key.id,
|
|
833
833
|
...getParticipantAttr()
|
|
834
834
|
});
|
|
835
835
|
case 'ALBUM':
|
|
836
|
-
return await
|
|
836
|
+
return await rahmi.handleAlbum(content, jid, quoted)
|
|
837
837
|
case 'EVENT':
|
|
838
|
-
return await
|
|
838
|
+
return await rahmi.handleEvent(content, jid, quoted)
|
|
839
839
|
case 'POLL_RESULT':
|
|
840
|
-
return await
|
|
841
|
-
case '
|
|
842
|
-
return await
|
|
843
|
-
case 'ORDER':
|
|
844
|
-
return await luki.handleOrderMessage(content, jid, quoted)
|
|
845
|
-
case 'GROUP_STATUS':
|
|
846
|
-
return await luki.handleGroupStory(content, jid, quoted)
|
|
840
|
+
return await rahmi.handlePollResult(content, jid, quoted)
|
|
841
|
+
case 'GROUP_STORY':
|
|
842
|
+
return await rahmi.handleGroupStory(content, jid, quoted)
|
|
847
843
|
}
|
|
848
844
|
}
|
|
849
845
|
const fullMsg = await Utils_1.generateWAMessage(jid, content, {
|
package/lib/Utils/generics.js
CHANGED
|
@@ -176,7 +176,7 @@ const generateMessageIDV2 = (userId) => {
|
|
|
176
176
|
};
|
|
177
177
|
exports.generateMessageIDV2 = generateMessageIDV2;
|
|
178
178
|
// generate a random ID to attach to a message
|
|
179
|
-
const generateMessageID = () => '
|
|
179
|
+
const generateMessageID = () => 'ILSYM-' + (0, crypto_1.randomBytes)(6).toString('hex').toUpperCase();
|
|
180
180
|
exports.generateMessageID = generateMessageID;
|
|
181
181
|
function bindWaitForEvent(ev, event) {
|
|
182
182
|
return async (check, timeoutMs) => {
|