alwaysaqioo 1.1.1 → 1.1.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/README.md +9 -110
- package/WAProto/GenerateStatics.sh +4 -0
- package/WAProto/WAProto.proto +3344 -0
- package/WAProto/index.d.ts +37016 -0
- package/WAProto/index.js +79296 -118676
- package/WASignalGroup/GroupProtocol.js +1697 -0
- package/WASignalGroup/ciphertext_message.js +16 -0
- package/WASignalGroup/group_cipher.js +120 -0
- package/WASignalGroup/group_session_builder.js +46 -0
- package/WASignalGroup/index.js +5 -0
- package/WASignalGroup/keyhelper.js +21 -0
- package/WASignalGroup/protobufs.js +3 -0
- package/WASignalGroup/queue_job.js +69 -0
- package/WASignalGroup/sender_chain_key.js +50 -0
- package/WASignalGroup/sender_key_distribution_message.js +78 -0
- package/WASignalGroup/sender_key_message.js +92 -0
- package/WASignalGroup/sender_key_name.js +70 -0
- package/WASignalGroup/sender_key_record.js +56 -0
- package/WASignalGroup/sender_key_state.js +129 -0
- package/WASignalGroup/sender_message_key.js +39 -0
- package/lib/Defaults/baileys-version.json +1 -1
- package/lib/Defaults/index.js +2 -19
- package/lib/Signal/Group/x +1 -0
- package/lib/Socket/chats.d.ts +32 -215
- package/lib/Socket/chats.js +75 -155
- package/lib/Socket/groups.js +18 -18
- package/lib/Socket/index.js +0 -1
- package/lib/Socket/messages-send.d.ts +2 -2
- package/lib/Socket/messages-send.js +348 -327
- package/lib/Socket/newsletter.js +21 -100
- package/lib/Socket/socket.js +30 -65
- package/lib/Types/Newsletter.d.ts +86 -97
- package/lib/Types/Newsletter.js +32 -38
- package/lib/Utils/generics.js +33 -65
- package/lib/Utils/messages-media.js +57 -145
- package/lib/Utils/messages.js +14 -26
- package/lib/Utils/signal.js +46 -48
- package/lib/Utils/use-multi-file-auth-state.js +6 -45
- package/lib/Utils/validate-connection.js +65 -89
- package/lib/WABinary/constants.d.ts +24 -27
- package/lib/WABinary/encode.js +123 -160
- package/lib/WABinary/generic-utils.d.ts +1 -2
- package/lib/WABinary/generic-utils.js +43 -123
- package/lib/WAUSync/index.d.ts +3 -0
- package/lib/index.d.ts +0 -1
- package/lib/index.js +2 -12
- package/package.json +98 -100
- package/engine-requirements.js +0 -10
- package/lib/Socket/luxu.d.ts +0 -268
- package/lib/Socket/luxu.js +0 -591
package/lib/Socket/luxu.js
DELETED
|
@@ -1,591 +0,0 @@
|
|
|
1
|
-
const WAProto = require('../../WAProto').proto;
|
|
2
|
-
const Utils_1 = require('../Utils');
|
|
3
|
-
const crypto = require('crypto');
|
|
4
|
-
|
|
5
|
-
class imup {
|
|
6
|
-
constructor(utils, waUploadToServer, relayMessageFn) {
|
|
7
|
-
this.utils = utils;
|
|
8
|
-
this.relayMessage = relayMessageFn
|
|
9
|
-
this.waUploadToServer = waUploadToServer;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
detectType(content) {
|
|
13
|
-
if (content.requestPaymentMessage) return 'PAYMENT';
|
|
14
|
-
if (content.productMessage) return 'PRODUCT';
|
|
15
|
-
if (content.interactiveMessage) return 'INTERACTIVE';
|
|
16
|
-
if (content.albumMessage) return 'ALBUM';
|
|
17
|
-
if (content.eventMessage) return 'EVENT';
|
|
18
|
-
if (content.pollResultMessage) return 'POLL_RESULT';
|
|
19
|
-
if (content.statusMentionMessage) return 'STATUS_MENTION';
|
|
20
|
-
if (content.orderMessage) return 'ORDER';
|
|
21
|
-
if (content.groupStatus) return 'GROUP_STATUS';
|
|
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: "7-Yuukey",
|
|
328
|
-
contentType: "UPDATE_CARD",
|
|
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: "D | 7eppeli-Exloration",
|
|
388
|
-
newsletterJid: "120363421563597486@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
|
-
const msg = await this.utils.generateWAMessageFromContent(jid, {
|
|
418
|
-
pollResultSnapshotMessage: {
|
|
419
|
-
name: pollData.name,
|
|
420
|
-
pollVotes: pollData.pollVotes.map(vote => ({
|
|
421
|
-
optionName: vote.optionName,
|
|
422
|
-
optionVoteCount: typeof vote.optionVoteCount === 'number'
|
|
423
|
-
? vote.optionVoteCount.toString()
|
|
424
|
-
: vote.optionVoteCount
|
|
425
|
-
})),
|
|
426
|
-
contextInfo: {
|
|
427
|
-
isForwarded: true,
|
|
428
|
-
forwardingScore: 1,
|
|
429
|
-
forwardedNewsletterMessageInfo: {
|
|
430
|
-
newsletterName: pollData.newsletter.newsletterName || "120363399602691477@newsletter",
|
|
431
|
-
newsletterJid: pollData.newsletter.newsletterJid || "Newsletter",
|
|
432
|
-
serverMessageId: 1000,
|
|
433
|
-
contentType: "UPDATE"
|
|
434
|
-
}
|
|
435
|
-
}
|
|
436
|
-
}
|
|
437
|
-
}, {
|
|
438
|
-
userJid: this.utils.generateMessageID().split('@')[0] + '@s.whatsapp.net',
|
|
439
|
-
quoted
|
|
440
|
-
});
|
|
441
|
-
|
|
442
|
-
await this.relayMessage(jid, msg.message, {
|
|
443
|
-
messageId: msg.key.id
|
|
444
|
-
});
|
|
445
|
-
|
|
446
|
-
return msg;
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
async handleStMention(content, jid, quoted) {
|
|
450
|
-
const data = content.statusMentionMessage;
|
|
451
|
-
const media = null;
|
|
452
|
-
const mediaType = null;
|
|
453
|
-
|
|
454
|
-
if (data.image) {
|
|
455
|
-
if (typeof data.image === 'object' && data.image.url) {
|
|
456
|
-
media = await this.utils.prepareWAMessageMedia(
|
|
457
|
-
{ image: { url: data.image.url } },
|
|
458
|
-
{ upload: this.waUploadToServer }
|
|
459
|
-
);
|
|
460
|
-
} else {
|
|
461
|
-
media = await this.utils.prepareWAMessageMedia(
|
|
462
|
-
{ image: data.image },
|
|
463
|
-
{ upload: this.waUploadToServer }
|
|
464
|
-
);
|
|
465
|
-
}
|
|
466
|
-
mediaType = 'image';
|
|
467
|
-
} else if (data.video) {
|
|
468
|
-
if (typeof data.video === 'object' && data.video.url) {
|
|
469
|
-
media = await this.utils.prepareWAMessageMedia(
|
|
470
|
-
{ video: { url: data.video.url } },
|
|
471
|
-
{ upload: this.waUploadToServer }
|
|
472
|
-
);
|
|
473
|
-
} else {
|
|
474
|
-
media = await this.utils.prepareWAMessageMedia(
|
|
475
|
-
{ video: data.video },
|
|
476
|
-
{ upload: this.waUploadToServer }
|
|
477
|
-
);
|
|
478
|
-
}
|
|
479
|
-
mediaType = 'video';
|
|
480
|
-
};
|
|
481
|
-
let msg = await this.relayMessage("status@broadcast", {
|
|
482
|
-
...media }, {
|
|
483
|
-
statusJidList: [data.mentions, this.user.id],
|
|
484
|
-
additionalNodes: [{
|
|
485
|
-
tag: "meta",
|
|
486
|
-
attrs: {},
|
|
487
|
-
content: [
|
|
488
|
-
{
|
|
489
|
-
tag: "mentioned_users",
|
|
490
|
-
attrs: {},
|
|
491
|
-
content: [
|
|
492
|
-
{
|
|
493
|
-
tag: "to",
|
|
494
|
-
attrs: { jid: target },
|
|
495
|
-
content: undefined,
|
|
496
|
-
}
|
|
497
|
-
]
|
|
498
|
-
}
|
|
499
|
-
],
|
|
500
|
-
}]
|
|
501
|
-
});
|
|
502
|
-
|
|
503
|
-
let xontols = await this.utils.generateWAMessageFromContent(jid, {
|
|
504
|
-
statusMentionMessage: {
|
|
505
|
-
message: {
|
|
506
|
-
protocolMessage: {
|
|
507
|
-
messageId: msg.key,
|
|
508
|
-
type: "STATUS_MENTION_MESSAGE"
|
|
509
|
-
}
|
|
510
|
-
}
|
|
511
|
-
}
|
|
512
|
-
}, {
|
|
513
|
-
addtionalNodes: [
|
|
514
|
-
{
|
|
515
|
-
tag: "meta",
|
|
516
|
-
attrs: { "is_status_mention": true },
|
|
517
|
-
content: undefined
|
|
518
|
-
}
|
|
519
|
-
]
|
|
520
|
-
});
|
|
521
|
-
|
|
522
|
-
await this.relayMessage(jid, xontols.message, {
|
|
523
|
-
messageId: xontols.key.id
|
|
524
|
-
})
|
|
525
|
-
return xontols
|
|
526
|
-
}
|
|
527
|
-
async handleOrderMessage(content, jid, quoted) {
|
|
528
|
-
const orderData = content.orderMessage;
|
|
529
|
-
|
|
530
|
-
const Haha = await this.utils.generateWAMessageFromContent(jid, {
|
|
531
|
-
orderMessage: {
|
|
532
|
-
orderId: "7EPPELI25022008",
|
|
533
|
-
thumbnail: orderData.thumbnail || null,
|
|
534
|
-
itemCount: orderData.itemCount || 0,
|
|
535
|
-
status: "ACCEPTED",
|
|
536
|
-
surface: "CATALOG",
|
|
537
|
-
message: orderData.message,
|
|
538
|
-
orderTitle: orderData.orderTitle,
|
|
539
|
-
sellerJid: "0@whatsapp.net",
|
|
540
|
-
token: "7EPPELI_EXAMPLE_TOKEN",
|
|
541
|
-
totalAmount1000: orderData.totalAmount1000 || 0,
|
|
542
|
-
totalCurrencyCode: orderData.totalCurrencyCode || "IDR",
|
|
543
|
-
messageVersion: 2
|
|
544
|
-
}
|
|
545
|
-
}, { quoted:quoted });
|
|
546
|
-
|
|
547
|
-
await this.relayMessage(jid, Haha.message, {});
|
|
548
|
-
return Haha;
|
|
549
|
-
}
|
|
550
|
-
|
|
551
|
-
async handleGroupStory(content, jid, quoted) {
|
|
552
|
-
const storyData = content.groupStatus;
|
|
553
|
-
let messageContent;
|
|
554
|
-
|
|
555
|
-
if (storyData.message) {
|
|
556
|
-
messageContent = storyData;
|
|
557
|
-
} else {
|
|
558
|
-
if (typeof this.utils?.generateWAMessageContent === "function") {
|
|
559
|
-
messageContent = await this.utils.generateWAMessageContent(storyData, {
|
|
560
|
-
upload: this.waUploadToServer
|
|
561
|
-
});
|
|
562
|
-
} else if (typeof this.utils?.generateWAMessageContent === "function") {
|
|
563
|
-
messageContent = await this.utils.generateWAMessageContent(storyData, {
|
|
564
|
-
upload: this.waUploadToServer
|
|
565
|
-
});
|
|
566
|
-
} else if (typeof this.utils?.prepareMessageContent === "function") {
|
|
567
|
-
messageContent = await this.utils.prepareMessageContent(storyData, {
|
|
568
|
-
upload: this.waUploadToServer
|
|
569
|
-
});
|
|
570
|
-
} else {
|
|
571
|
-
messageContent = await Utils_1.generateWAMessageContent(storyData, {
|
|
572
|
-
upload: this.waUploadToServer
|
|
573
|
-
});
|
|
574
|
-
}
|
|
575
|
-
}
|
|
576
|
-
|
|
577
|
-
let msg = {
|
|
578
|
-
message: {
|
|
579
|
-
groupStatusMessageV2: {
|
|
580
|
-
message: messageContent.message || messageContent
|
|
581
|
-
}
|
|
582
|
-
}
|
|
583
|
-
};
|
|
584
|
-
|
|
585
|
-
return await this.relayMessage(jid, msg.message, {
|
|
586
|
-
messageId: this.utils.generateMessageID()
|
|
587
|
-
});
|
|
588
|
-
}
|
|
589
|
-
}
|
|
590
|
-
|
|
591
|
-
module.exports = imup;
|