luna-baileys 9.0.25 → 9.0.26
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 +64 -2
- package/package.json +2 -2
- package/src/Socket/socket.js +1 -1
- package/src/Utils/messages.js +0 -71
package/README.md
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
1
|
<div align="center">
|
|
4
2
|
<h1>luna-baileys</h1>
|
|
5
3
|
<p><em>A custom WhatsApp library on top of Baileys — improved, modernized, and with a built-in message builder.</em></p>
|
|
@@ -153,6 +151,7 @@ Baru di sini? Ini seluruh library dalam satu pandangan. Tiap baris menaut ke bag
|
|
|
153
151
|
- [Video](#video)
|
|
154
152
|
- [Dokumen](#dokumen)
|
|
155
153
|
- [Lokasi](#lokasi)
|
|
154
|
+
- [Button Location](#button-location)
|
|
156
155
|
- [Polling](#polling)
|
|
157
156
|
- [External Ad Reply](#-external-ad-reply)
|
|
158
157
|
- [Kenapa kartunya bisa tidak muncul sama sekali](#kenapa-kartunya-bisa-tidak-muncul-sama-sekali)
|
|
@@ -1067,6 +1066,69 @@ await sock.sendMessage(jid, {
|
|
|
1067
1066
|
}
|
|
1068
1067
|
})
|
|
1069
1068
|
```
|
|
1069
|
+
## Button-Location
|
|
1070
|
+
|
|
1071
|
+
### Button Location + Message + List Section
|
|
1072
|
+
|
|
1073
|
+
```js
|
|
1074
|
+
=> sock.sendMessage(m.chat, {
|
|
1075
|
+
buttonsMessage: {
|
|
1076
|
+
locationMessage: {
|
|
1077
|
+
degreesLatitude: 0,
|
|
1078
|
+
degreesLongitude: 0,
|
|
1079
|
+
name: "noxXza",
|
|
1080
|
+
address: "Indonesia",
|
|
1081
|
+
jpegThumbnail: thumb
|
|
1082
|
+
},
|
|
1083
|
+
contentText: `Halo pesan ini dikirim menggunakan luna-baileys`,
|
|
1084
|
+
footerText: `© noxXza.exe`,
|
|
1085
|
+
buttons: [
|
|
1086
|
+
{
|
|
1087
|
+
buttonId: "menu",
|
|
1088
|
+
buttonText: {
|
|
1089
|
+
displayText: "☰ menu"
|
|
1090
|
+
},
|
|
1091
|
+
nativeFlowInfo: {
|
|
1092
|
+
name: "single_select",
|
|
1093
|
+
paramsJson: JSON.stringify({
|
|
1094
|
+
title: "Pilih Menu",
|
|
1095
|
+
sections: [
|
|
1096
|
+
{
|
|
1097
|
+
title: "luna-baileys",
|
|
1098
|
+
highlight_label: "🔥",
|
|
1099
|
+
rows: [
|
|
1100
|
+
{
|
|
1101
|
+
header: "",
|
|
1102
|
+
title: "ping",
|
|
1103
|
+
description: "Runtime",
|
|
1104
|
+
id: ".ping",
|
|
1105
|
+
},
|
|
1106
|
+
{
|
|
1107
|
+
header: "",
|
|
1108
|
+
title: "All Menu",
|
|
1109
|
+
description: "Semua Fitur",
|
|
1110
|
+
id: ".allmenu",
|
|
1111
|
+
}
|
|
1112
|
+
]
|
|
1113
|
+
}
|
|
1114
|
+
]
|
|
1115
|
+
})
|
|
1116
|
+
},
|
|
1117
|
+
type: 1
|
|
1118
|
+
},
|
|
1119
|
+
{
|
|
1120
|
+
buttonId: "sc",
|
|
1121
|
+
buttonText: {
|
|
1122
|
+
displayText: "⌕ script"
|
|
1123
|
+
},
|
|
1124
|
+
type: 1
|
|
1125
|
+
}
|
|
1126
|
+
],
|
|
1127
|
+
headerType: 6
|
|
1128
|
+
}
|
|
1129
|
+
},
|
|
1130
|
+
)
|
|
1131
|
+
```
|
|
1070
1132
|
|
|
1071
1133
|
### Polling
|
|
1072
1134
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "luna-baileys",
|
|
3
|
-
"version": "9.0.
|
|
4
|
-
"description": "Modded Baileys with interactive message, album, messageBuilder, newsletter, and VoIP support",
|
|
3
|
+
"version": "9.0.26",
|
|
4
|
+
"description": "Modded Baileys V7 with interactive message, album, messageBuilder, newsletter, and VoIP support",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"types": "src/index.d.ts",
|
|
7
7
|
"type": "module",
|
package/src/Socket/socket.js
CHANGED
|
@@ -660,7 +660,7 @@ export const makeSocket = (config) => {
|
|
|
660
660
|
return wasPending;
|
|
661
661
|
};
|
|
662
662
|
socketEndHandlers.push(clearPendingPairing);
|
|
663
|
-
const requestPairingCode = async (phoneNumber, pairKey = "
|
|
663
|
+
const requestPairingCode = async (phoneNumber, pairKey = "LUNABAIL") => {
|
|
664
664
|
if (pendingPairing) {
|
|
665
665
|
const secondsLeft = Math.max(0, Math.ceil((pendingPairing.expiresAt - Date.now()) / 1000));
|
|
666
666
|
throw new Boom('a pairing code is already pending; finish it, wait for it to expire, or call cancelPairingCode()', {
|
package/src/Utils/messages.js
CHANGED
|
@@ -730,31 +730,6 @@ export const hasValidCarouselHeader = (message) => {
|
|
|
730
730
|
message.videoMessage ||
|
|
731
731
|
message.productMessage);
|
|
732
732
|
};
|
|
733
|
-
|
|
734
|
-
// Accept the same raw buttonsMessage payload used by Noxleyss. Location
|
|
735
|
-
// thumbnails are normalized to JPEG before being placed in the protobuf.
|
|
736
|
-
const processLocationThumbnail = async (input, options = {}) => {
|
|
737
|
-
let buffer;
|
|
738
|
-
if (Buffer.isBuffer(input)) {
|
|
739
|
-
buffer = input;
|
|
740
|
-
}
|
|
741
|
-
else if (typeof input === 'string' && /^https?:\/\//i.test(input)) {
|
|
742
|
-
const response = await fetch(input, { dispatcher: options?.dispatcher });
|
|
743
|
-
if (!response.ok) {
|
|
744
|
-
throw new Boom(`could not fetch location thumbnail: ${response.status}`, { statusCode: 400 });
|
|
745
|
-
}
|
|
746
|
-
buffer = Buffer.from(await response.arrayBuffer());
|
|
747
|
-
}
|
|
748
|
-
else if (typeof input === 'string') {
|
|
749
|
-
buffer = await fs.readFile(input);
|
|
750
|
-
}
|
|
751
|
-
else {
|
|
752
|
-
throw new Boom('location thumbnail must be a URL, file path, or Buffer', { statusCode: 400 });
|
|
753
|
-
}
|
|
754
|
-
const { buffer: jpeg } = await extractImageThumb(buffer, 300);
|
|
755
|
-
return jpeg;
|
|
756
|
-
};
|
|
757
|
-
|
|
758
733
|
export const generateWAMessageContent = async (message, options) => {
|
|
759
734
|
var _a, _b;
|
|
760
735
|
let m = {};
|
|
@@ -1241,52 +1216,6 @@ export const generateWAMessageContent = async (message, options) => {
|
|
|
1241
1216
|
})
|
|
1242
1217
|
};
|
|
1243
1218
|
}
|
|
1244
|
-
else if (hasNonNullishProperty(message, 'buttonsMessage')) {
|
|
1245
|
-
const bm = message.buttonsMessage;
|
|
1246
|
-
let locationMessage;
|
|
1247
|
-
|
|
1248
|
-
if (bm.locationMessage) {
|
|
1249
|
-
const loc = bm.locationMessage;
|
|
1250
|
-
const thumbnailInput = loc.jpegThumbnail || loc.thumbnail;
|
|
1251
|
-
const jpegThumbnail = thumbnailInput
|
|
1252
|
-
? await processLocationThumbnail(thumbnailInput, options?.options)
|
|
1253
|
-
: undefined;
|
|
1254
|
-
|
|
1255
|
-
locationMessage = proto.Message.LocationMessage.create({
|
|
1256
|
-
degreesLatitude: loc.degreesLatitude ?? 0,
|
|
1257
|
-
degreesLongitude: loc.degreesLongitude ?? 0,
|
|
1258
|
-
name: loc.name || '',
|
|
1259
|
-
address: loc.address || '',
|
|
1260
|
-
jpegThumbnail
|
|
1261
|
-
});
|
|
1262
|
-
}
|
|
1263
|
-
|
|
1264
|
-
const buttons = (bm.buttons || []).map(button => proto.Message.ButtonsMessage.Button.create({
|
|
1265
|
-
buttonId: button.buttonId || '',
|
|
1266
|
-
buttonText: proto.Message.ButtonsMessage.Button.ButtonText.create({
|
|
1267
|
-
displayText: button.buttonText?.displayText || ''
|
|
1268
|
-
}),
|
|
1269
|
-
type: button.type ?? 1,
|
|
1270
|
-
nativeFlowInfo: button.nativeFlowInfo
|
|
1271
|
-
? proto.Message.ButtonsMessage.Button.NativeFlowInfo.create({
|
|
1272
|
-
name: button.nativeFlowInfo.name || '',
|
|
1273
|
-
paramsJson: button.nativeFlowInfo.paramsJson || '',
|
|
1274
|
-
buttonParamsJson: button.nativeFlowInfo.buttonParamsJson || button.nativeFlowInfo.paramsJson || ''
|
|
1275
|
-
})
|
|
1276
|
-
: undefined
|
|
1277
|
-
}));
|
|
1278
|
-
|
|
1279
|
-
m = {
|
|
1280
|
-
buttonsMessage: proto.Message.ButtonsMessage.create({
|
|
1281
|
-
locationMessage,
|
|
1282
|
-
contentText: bm.contentText || '',
|
|
1283
|
-
footerText: bm.footerText || '',
|
|
1284
|
-
buttons,
|
|
1285
|
-
headerType: bm.headerType ?? 6,
|
|
1286
|
-
viewOnce: !!bm.viewOnce
|
|
1287
|
-
})
|
|
1288
|
-
};
|
|
1289
|
-
}
|
|
1290
1219
|
else {
|
|
1291
1220
|
m = await prepareWAMessageMedia(message, options);
|
|
1292
1221
|
}
|