@nuiisweety/baileys 0.1.15 → 0.1.17
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 +390 -833
- package/README.md.bak +1 -1
- package/lib/Socket/index.js +14 -22
- package/lib/Socket/index.js.bak +4 -4
- package/lib/Socket/messages-send.js +1 -0
- package/lib/Socket/messages-send.js.bak +5 -2
- package/lib/Utils/messages.js +13 -0
- package/lib/Utils/messages.js.bak +921 -309
- package/lib/Utils/rich-message-utils.js +3 -3
- package/lib/Utils/rich-message-utils.js.original +18 -9
- package/package.json +1 -1
|
@@ -676,7 +676,7 @@ const makeProductSection = (data) => {
|
|
|
676
676
|
return {
|
|
677
677
|
sub: {
|
|
678
678
|
messageType: RichSubMessageType.TEXT,
|
|
679
|
-
messageText: '
|
|
679
|
+
messageText: ''
|
|
680
680
|
},
|
|
681
681
|
section: isMultiple
|
|
682
682
|
? {
|
|
@@ -721,7 +721,7 @@ const makePostSection = (data) => {
|
|
|
721
721
|
return {
|
|
722
722
|
sub: {
|
|
723
723
|
messageType: RichSubMessageType.TEXT,
|
|
724
|
-
messageText: '
|
|
724
|
+
messageText: ''
|
|
725
725
|
},
|
|
726
726
|
section: {
|
|
727
727
|
view_model: {
|
|
@@ -825,7 +825,6 @@ export const prepareRichResponseMessage = (content) => {
|
|
|
825
825
|
/* ── mode flat (convenience fields) ── */
|
|
826
826
|
} else {
|
|
827
827
|
if (headerText) submessages.push(makeTextSub(headerText));
|
|
828
|
-
if (contentText) submessages.push(makeTextSub(contentText));
|
|
829
828
|
|
|
830
829
|
if (code) submessages.push(makeCodeSub(code, language || 'javascript'));
|
|
831
830
|
if (table) submessages.push(makeTableSub(table, title, noHeading));
|
|
@@ -843,6 +842,7 @@ export const prepareRichResponseMessage = (content) => {
|
|
|
843
842
|
if (source) { if (!extraSections) extraSections = []; extraSections.push(makeSourceSection(source)); }
|
|
844
843
|
if (richProduct) pushRich(makeProductSection(richProduct));
|
|
845
844
|
if (richPost) pushRich(makePostSection(richPost));
|
|
845
|
+
if (contentText) submessages.push(makeTextSub(contentText)); // ← setelah produk/post, tampil di bawah card
|
|
846
846
|
if (tip) pushRich(makeTipSub(tip));
|
|
847
847
|
if (suggest) { if (!extraSections) extraSections = []; extraSections.push(makeSuggestSection(suggest)); }
|
|
848
848
|
|
|
@@ -598,8 +598,13 @@ const makeVideoSub = (videoUrl) => {
|
|
|
598
598
|
});
|
|
599
599
|
return {
|
|
600
600
|
sub: {
|
|
601
|
-
messageType: RichSubMessageType.
|
|
602
|
-
|
|
601
|
+
messageType: RichSubMessageType.DYNAMIC,
|
|
602
|
+
dynamicMetadata: {
|
|
603
|
+
type: 1,
|
|
604
|
+
version: 1,
|
|
605
|
+
url: parsed[0]?.url || '',
|
|
606
|
+
loopCount: 0
|
|
607
|
+
}
|
|
603
608
|
},
|
|
604
609
|
sections: parsed.map(({ url, duration }) => ({
|
|
605
610
|
view_model: {
|
|
@@ -873,10 +878,17 @@ export const prepareRichResponseMessage = (content) => {
|
|
|
873
878
|
}
|
|
874
879
|
|
|
875
880
|
/* build unifiedResponse JSON — gabungkan sections dari submessages + extraSections */
|
|
876
|
-
|
|
881
|
+
// Pisahkan footerSubs (teks setelah media) agar selalu muncul SETELAH extraSections (video/image)
|
|
882
|
+
const footerSubMessages = footerText ? [makeTextSub(footerText)] : [];
|
|
883
|
+
// Hapus footerText dari submessages jika sudah ada (sudah di-push sebelumnya)
|
|
884
|
+
const mainSubmessages = footerText
|
|
885
|
+
? submessages.filter(s => !(s.messageType === RichSubMessageType.TEXT && s.messageText === footerText))
|
|
886
|
+
: submessages;
|
|
887
|
+
const baseUnified = toUnified(mainSubmessages);
|
|
888
|
+
const footerSections = footerSubMessages.map(buildUnifiedSection);
|
|
877
889
|
const unified = extraSections && extraSections.length > 0
|
|
878
|
-
? { ...baseUnified, sections: [...baseUnified.sections, ...extraSections] }
|
|
879
|
-
: baseUnified;
|
|
890
|
+
? { ...baseUnified, sections: [...baseUnified.sections, ...extraSections, ...footerSections] }
|
|
891
|
+
: { ...baseUnified, sections: [...baseUnified.sections, ...footerSections] };
|
|
880
892
|
|
|
881
893
|
const richResponseMessage = proto.AIRichResponseMessage.create({
|
|
882
894
|
submessages,
|
|
@@ -887,7 +899,6 @@ export const prepareRichResponseMessage = (content) => {
|
|
|
887
899
|
contextInfo: {
|
|
888
900
|
isForwarded: true,
|
|
889
901
|
forwardingScore: 1,
|
|
890
|
-
forwardedAiBotMessageInfo: { botJid: '867051314767696@bot' },
|
|
891
902
|
forwardOrigin: 4
|
|
892
903
|
}
|
|
893
904
|
});
|
|
@@ -955,7 +966,6 @@ const buildRichContextInfo = (quoted) => {
|
|
|
955
966
|
const ctxInfo = {
|
|
956
967
|
isForwarded: true,
|
|
957
968
|
forwardingScore: 1,
|
|
958
|
-
forwardedAiBotMessageInfo: { botJid: '867051314767696@bot' },
|
|
959
969
|
forwardOrigin: 4,
|
|
960
970
|
};
|
|
961
971
|
if (quoted?.key) {
|
|
@@ -1104,7 +1114,7 @@ export const captureUnifiedResponse = (msg) => {
|
|
|
1104
1114
|
// ── Link ──────────────────────────────────────────────────
|
|
1105
1115
|
|
|
1106
1116
|
export const generateLinkContent = (text, links, quoted, options = {}) => {
|
|
1107
|
-
const { footer,
|
|
1117
|
+
const { footer, forwardingScore = 3, citations = [], proofs = [] } = options;
|
|
1108
1118
|
const subs = [];
|
|
1109
1119
|
const fullText = footer ? `${text}${footer}` : text;
|
|
1110
1120
|
subs.push({ messageType: RichSubMessageType.TEXT, messageText: fullText });
|
|
@@ -1120,7 +1130,6 @@ export const generateLinkContent = (text, links, quoted, options = {}) => {
|
|
|
1120
1130
|
const base64Data = Buffer.from(JSON.stringify({ response_id: randomUUID(), sections })).toString('base64');
|
|
1121
1131
|
const ctxInfo = buildRichContextInfo(quoted);
|
|
1122
1132
|
ctxInfo.forwardingScore = forwardingScore;
|
|
1123
|
-
ctxInfo.forwardedAiBotMessageInfo = { botJid };
|
|
1124
1133
|
ctxInfo.botMessageSharingInfo = { forwardScore: forwardingScore };
|
|
1125
1134
|
const messageContextInfo = { messageSecret: randomBytes(32) };
|
|
1126
1135
|
if (citations.length > 0 || proofs.length > 0) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuiisweety/baileys",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.17",
|
|
5
5
|
"description": "A WebSockets library for interacting with WhatsApp Web — forked STRICTLY from @whiskeysockets/baileys only, NOT from any other baileys fork. Modified by NuiiS4TORU.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"whatsapp",
|