@prototypevip/baileys 0.0.2 → 0.0.4
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/Store/prototype-store.js +88 -34
- package/lib/Utils/index.js +1 -0
- package/lib/Utils/message-builder.js +2281 -0
- package/lib/Utils/messages.js +45 -0
- package/package.json +5 -1
package/lib/Utils/messages.js
CHANGED
|
@@ -938,6 +938,51 @@ export const generateWAMessageContent = async (message, options) => {
|
|
|
938
938
|
options,
|
|
939
939
|
);
|
|
940
940
|
m.stickerPackMessage = stickerPackMessage;
|
|
941
|
+
} else if (
|
|
942
|
+
hasNonNullishProperty(message, "buttons") &&
|
|
943
|
+
Array.isArray(message.buttons) &&
|
|
944
|
+
message.buttons.length > 0
|
|
945
|
+
) {
|
|
946
|
+
// === دعم الصيغة القديمة للأزرار (buttonId/buttonText/type + headerType) ===
|
|
947
|
+
// واتساب وقف عرض buttonsMessage/templateMessage القديمة، فبنحوّلها هنا
|
|
948
|
+
// تلقائيًا لنفس آلية nativeFlow الحديثة (المُثبتة إنها بترسم فعليًا)
|
|
949
|
+
// عشان أي بلجن قديم يفضل شغال من غير ما يتعدل.
|
|
950
|
+
const legacyNativeFlow = message.buttons.map((b) => ({
|
|
951
|
+
id: b.buttonId,
|
|
952
|
+
text:
|
|
953
|
+
(typeof b.buttonText === "string"
|
|
954
|
+
? b.buttonText
|
|
955
|
+
: b.buttonText?.displayText) || "👉🏻 اضغط",
|
|
956
|
+
}));
|
|
957
|
+
const interactiveMessage = {
|
|
958
|
+
nativeFlowMessage: prepareNativeFlowButtons({
|
|
959
|
+
nativeFlow: legacyNativeFlow,
|
|
960
|
+
}),
|
|
961
|
+
};
|
|
962
|
+
if (hasOptionalProperty(message, "caption")) {
|
|
963
|
+
let mediaHeader = {};
|
|
964
|
+
if (
|
|
965
|
+
hasOptionalProperty(message, "image") ||
|
|
966
|
+
hasOptionalProperty(message, "video") ||
|
|
967
|
+
hasOptionalProperty(message, "document")
|
|
968
|
+
) {
|
|
969
|
+
mediaHeader = await prepareWAMessageMedia(message, options);
|
|
970
|
+
}
|
|
971
|
+
const isValidHeader = hasValidInteractiveHeader(mediaHeader);
|
|
972
|
+
interactiveMessage.header = {
|
|
973
|
+
title: message.title || "",
|
|
974
|
+
subtitle: message.subtitle || "",
|
|
975
|
+
hasMediaAttachment: !!isValidHeader,
|
|
976
|
+
...mediaHeader,
|
|
977
|
+
};
|
|
978
|
+
interactiveMessage.body = { text: message.caption };
|
|
979
|
+
} else if (hasOptionalProperty(message, "text")) {
|
|
980
|
+
interactiveMessage.body = { text: message.text };
|
|
981
|
+
}
|
|
982
|
+
if (hasOptionalProperty(message, "footer")) {
|
|
983
|
+
interactiveMessage.footer = { text: message.footer };
|
|
984
|
+
}
|
|
985
|
+
m = { interactiveMessage };
|
|
941
986
|
} else if (hasNonNullishProperty(message, "nativeFlow")) {
|
|
942
987
|
const interactiveMessage = {
|
|
943
988
|
nativeFlowMessage: prepareNativeFlowButtons(message),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prototypevip/baileys",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"description": "A simple fork of Baileys for WhatsApp automation",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -45,6 +45,7 @@
|
|
|
45
45
|
"@hapi/boom": "^9.1.3",
|
|
46
46
|
"async-mutex": "^0.5.0",
|
|
47
47
|
"fflate": "^0.8.2",
|
|
48
|
+
"fluent-ffmpeg": "^2.1.3",
|
|
48
49
|
"libsignal": "github:WhiskeySockets/libsignal-wasm#master",
|
|
49
50
|
"lru-cache": "^11.2.6",
|
|
50
51
|
"music-metadata": "^11.7.0",
|
|
@@ -73,6 +74,9 @@
|
|
|
73
74
|
},
|
|
74
75
|
"link-preview-js": {
|
|
75
76
|
"optional": true
|
|
77
|
+
},
|
|
78
|
+
"sharp": {
|
|
79
|
+
"optional": true
|
|
76
80
|
}
|
|
77
81
|
}
|
|
78
82
|
}
|