@ryuu-reinzz/haruka-lib 2.7.0 → 3.0.0-beta.1
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 +2 -2
- package/main/socket.js +31 -18
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
# How to use
|
|
10
10
|
``` bash
|
|
11
|
-
npm install @ryuu-reinzz/haruka-lib@
|
|
11
|
+
npm install @ryuu-reinzz/haruka-lib@3.0.0-beta.1
|
|
12
12
|
```
|
|
13
13
|
|
|
14
14
|
*how to use it in JavaScript:*
|
|
@@ -35,7 +35,7 @@ const property = {
|
|
|
35
35
|
};
|
|
36
36
|
|
|
37
37
|
const conn = makeWASocket({});
|
|
38
|
-
haruka.addProperty(conn,
|
|
38
|
+
haruka.addProperty(conn, property);
|
|
39
39
|
```
|
|
40
40
|
|
|
41
41
|
## 1. Send Button
|
package/main/socket.js
CHANGED
|
@@ -16,7 +16,7 @@ const __dirname = dirname(__filename);
|
|
|
16
16
|
* @param {import('baileys').WASocket} socket
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
-
export default function addProperty(socket,
|
|
19
|
+
export default function addProperty(socket, baileys) {
|
|
20
20
|
const {
|
|
21
21
|
proto,
|
|
22
22
|
generateWAMessageFromContent,
|
|
@@ -183,7 +183,9 @@ export default function addProperty(socket, store, smsg, baileys) {
|
|
|
183
183
|
location = null,
|
|
184
184
|
product = null,
|
|
185
185
|
businessOwnerJid = null,
|
|
186
|
-
|
|
186
|
+
contextInfo = null,
|
|
187
|
+
bottom_sheet = false,
|
|
188
|
+
bottom_name = ""
|
|
187
189
|
} = content;
|
|
188
190
|
|
|
189
191
|
if (!Array.isArray(buttons) || buttons.length === 0) {
|
|
@@ -410,27 +412,38 @@ export default function addProperty(socket, store, smsg, baileys) {
|
|
|
410
412
|
messageContent.nativeFlowMessage = {
|
|
411
413
|
buttons: processedButtons,
|
|
412
414
|
};
|
|
415
|
+
|
|
416
|
+
if (bottom_sheet) {
|
|
417
|
+
messageContent.nativeFlowMessage.messageParamsJson = JSON.stringify({
|
|
418
|
+
bottom_sheet: {
|
|
419
|
+
in_thread_buttons_limit: 1,
|
|
420
|
+
divider_indices: [1, 2],
|
|
421
|
+
list_title: bottom_name,
|
|
422
|
+
button_title: bottom_name
|
|
423
|
+
}
|
|
424
|
+
});
|
|
425
|
+
}
|
|
413
426
|
|
|
414
|
-
if (externalAdReply && typeof externalAdReply === "object") {
|
|
427
|
+
if (contextInfo.externalAdReply && typeof contextInfo.externalAdReply === "object") {
|
|
415
428
|
messageContent.contextInfo = {
|
|
416
429
|
externalAdReply: {
|
|
417
|
-
title: externalAdReply.title || "",
|
|
418
|
-
body: externalAdReply.body || "",
|
|
419
|
-
mediaType: externalAdReply.mediaType || 1,
|
|
420
|
-
sourceUrl: externalAdReply.sourceUrl || externalAdReply.url || "",
|
|
421
|
-
thumbnailUrl: externalAdReply.thumbnailUrl || "",
|
|
422
|
-
renderLargerThumbnail: externalAdReply.renderLargerThumbnail || false,
|
|
423
|
-
showAdAttribution: externalAdReply.showAdAttribution !== false,
|
|
424
|
-
containsAutoReply: externalAdReply.containsAutoReply || false,
|
|
425
|
-
...(externalAdReply.mediaUrl && {
|
|
426
|
-
mediaUrl: externalAdReply.mediaUrl,
|
|
430
|
+
title: contextInfo.externalAdReply.title || "",
|
|
431
|
+
body: contextInfo.externalAdReply.body || "",
|
|
432
|
+
mediaType: contextInfo.externalAdReply.mediaType || 1,
|
|
433
|
+
sourceUrl: contextInfo.externalAdReply.sourceUrl || contextInfo.externalAdReply.url || "",
|
|
434
|
+
thumbnailUrl: contextInfo.externalAdReply.thumbnailUrl || "",
|
|
435
|
+
renderLargerThumbnail: contextInfo.externalAdReply.renderLargerThumbnail || false,
|
|
436
|
+
showAdAttribution: contextInfo.externalAdReply.showAdAttribution !== false,
|
|
437
|
+
containsAutoReply: contextInfo.externalAdReply.containsAutoReply || false,
|
|
438
|
+
...(contextInfo.externalAdReply.mediaUrl && {
|
|
439
|
+
mediaUrl: contextInfo.externalAdReply.mediaUrl,
|
|
427
440
|
}),
|
|
428
|
-
...(externalAdReply.thumbnail &&
|
|
429
|
-
Buffer.isBuffer(externalAdReply.thumbnail) && {
|
|
430
|
-
thumbnail: externalAdReply.thumbnail,
|
|
441
|
+
...(contextInfo.externalAdReply.thumbnail &&
|
|
442
|
+
Buffer.isBuffer(contextInfo.externalAdReply.thumbnail) && {
|
|
443
|
+
thumbnail: contextInfo.externalAdReply.thumbnail,
|
|
431
444
|
}),
|
|
432
|
-
...(externalAdReply.jpegThumbnail && {
|
|
433
|
-
jpegThumbnail: externalAdReply.jpegThumbnail,
|
|
445
|
+
...(contextInfo.externalAdReply.jpegThumbnail && {
|
|
446
|
+
jpegThumbnail: contextInfo.externalAdReply.jpegThumbnail,
|
|
434
447
|
}),
|
|
435
448
|
},
|
|
436
449
|
...(options.mentionedJid && {
|