@fer2809fl/baileys 7.0.0 → 7.0.2
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 +259 -595
- package/WAProto/WAProto.proto +916 -360
- package/WAProto/fix-imports.js +18 -22
- package/WAProto/index.d.ts +15471 -8638
- package/WAProto/index.js +80576 -45941
- package/lib/Defaults/index.d.ts +14 -18
- package/lib/Defaults/index.d.ts.map +1 -1
- package/lib/Defaults/index.js +110 -115
- package/lib/Defaults/index.js.map +1 -1
- package/lib/Signal/Group/group_cipher.js.map +1 -1
- package/lib/Signal/Group/keyhelper.d.ts.map +1 -1
- package/lib/Signal/Group/keyhelper.js.map +1 -1
- package/lib/Signal/Group/sender-chain-key.js.map +1 -1
- package/lib/Signal/Group/sender-key-message.js.map +1 -1
- package/lib/Signal/Group/sender-message-key.js.map +1 -1
- package/lib/Signal/libsignal.d.ts.map +1 -1
- package/lib/Signal/libsignal.js +17 -45
- package/lib/Signal/libsignal.js.map +1 -1
- package/lib/Signal/lid-mapping.d.ts +0 -4
- package/lib/Signal/lid-mapping.d.ts.map +1 -1
- package/lib/Signal/lid-mapping.js +0 -6
- package/lib/Signal/lid-mapping.js.map +1 -1
- package/lib/Socket/business.d.ts +532 -280
- package/lib/Socket/business.d.ts.map +1 -1
- package/lib/Socket/business.js +401 -358
- package/lib/Socket/chats.d.ts +2 -22
- package/lib/Socket/chats.d.ts.map +1 -1
- package/lib/Socket/chats.js +43 -314
- package/lib/Socket/chats.js.map +1 -1
- package/lib/Socket/communities.d.ts +641 -336
- package/lib/Socket/communities.d.ts.map +1 -1
- package/lib/Socket/communities.js +3 -6
- package/lib/Socket/communities.js.map +1 -1
- package/lib/Socket/dugong.d.ts +130 -0
- package/lib/Socket/dugong.d.ts.map +1 -0
- package/lib/Socket/dugong.js +772 -0
- package/lib/Socket/dugong.js.map +1 -0
- package/lib/Socket/groups.d.ts +2 -23
- package/lib/Socket/groups.d.ts.map +1 -1
- package/lib/Socket/groups.js +8 -171
- package/lib/Socket/groups.js.map +1 -1
- package/lib/Socket/index.d.ts +631 -322
- package/lib/Socket/index.d.ts.map +1 -1
- package/lib/Socket/index.js +12 -9
- package/lib/Socket/index.js.map +1 -1
- package/lib/Socket/messages-recv.d.ts +52 -84
- package/lib/Socket/messages-recv.d.ts.map +1 -1
- package/lib/Socket/messages-recv.js +185 -686
- package/lib/Socket/messages-recv.js.map +1 -1
- package/lib/Socket/messages-send.d.ts +643 -262
- package/lib/Socket/messages-send.d.ts.map +1 -1
- package/lib/Socket/messages-send.js +1559 -1359
- package/lib/Socket/messages-send.js.map +1 -1
- package/lib/Socket/mex.d.ts +0 -1
- package/lib/Socket/mex.d.ts.map +1 -1
- package/lib/Socket/mex.js +8 -22
- package/lib/Socket/mex.js.map +1 -1
- package/lib/Socket/native-buttons.js +231 -0
- package/lib/Socket/newsletter.d.ts +27 -42
- package/lib/Socket/newsletter.d.ts.map +1 -1
- package/lib/Socket/newsletter.js +439 -402
- package/lib/Socket/newsletter.js.map +1 -1
- package/lib/Socket/socket.d.ts +2 -6
- package/lib/Socket/socket.d.ts.map +1 -1
- package/lib/Socket/socket.js +26 -62
- package/lib/Socket/socket.js.map +1 -1
- package/lib/Types/Auth.d.ts +0 -1
- package/lib/Types/Auth.d.ts.map +1 -1
- package/lib/Types/Bussines.d.ts +34 -22
- package/lib/Types/Call.d.ts +1 -1
- package/lib/Types/Call.d.ts.map +1 -1
- package/lib/Types/Chat.d.ts +0 -1
- package/lib/Types/Chat.d.ts.map +1 -1
- package/lib/Types/Contact.d.ts +0 -2
- package/lib/Types/Contact.d.ts.map +1 -1
- package/lib/Types/Events.d.ts +1 -20
- package/lib/Types/Events.d.ts.map +1 -1
- package/lib/Types/GroupMetadata.d.ts +1 -4
- package/lib/Types/GroupMetadata.d.ts.map +1 -1
- package/lib/Types/Message.d.ts +348 -354
- package/lib/Types/Message.d.ts.map +1 -1
- package/lib/Types/Message.js +0 -4
- package/lib/Types/Message.js.map +1 -1
- package/lib/Types/{Mex.d.ts → Newsletter.d.ts} +7 -26
- package/lib/Types/Newsletter.d.ts.map +1 -0
- package/lib/Types/{Mex.js → Newsletter.js} +3 -11
- package/lib/Types/Newsletter.js.map +1 -0
- package/lib/Types/Signal.d.ts +1 -12
- package/lib/Types/Signal.d.ts.map +1 -1
- package/lib/Types/Socket.d.ts +148 -135
- package/lib/Types/Socket.d.ts.map +1 -1
- package/lib/Types/Socket.js.map +1 -1
- package/lib/Types/State.d.ts +0 -65
- package/lib/Types/State.d.ts.map +1 -1
- package/lib/Types/State.js +0 -43
- package/lib/Types/State.js.map +1 -1
- package/lib/Types/index.d.ts +52 -52
- package/lib/Types/index.d.ts.map +1 -1
- package/lib/Types/index.js +30 -23
- package/lib/Types/index.js.map +1 -1
- package/lib/Utils/auth-utils.d.ts +0 -5
- package/lib/Utils/auth-utils.d.ts.map +1 -1
- package/lib/Utils/auth-utils.js +0 -12
- package/lib/Utils/auth-utils.js.map +1 -1
- package/lib/Utils/browser-utils.d.ts.map +1 -1
- package/lib/Utils/browser-utils.js +0 -1
- package/lib/Utils/browser-utils.js.map +1 -1
- package/lib/Utils/chat-utils.d.ts +4 -34
- package/lib/Utils/chat-utils.d.ts.map +1 -1
- package/lib/Utils/chat-utils.js +20 -80
- package/lib/Utils/chat-utils.js.map +1 -1
- package/lib/Utils/crypto.d.ts +12 -12
- package/lib/Utils/crypto.d.ts.map +1 -1
- package/lib/Utils/crypto.js.map +1 -1
- package/lib/Utils/decode-wa-message.d.ts +0 -18
- package/lib/Utils/decode-wa-message.d.ts.map +1 -1
- package/lib/Utils/decode-wa-message.js +0 -34
- package/lib/Utils/decode-wa-message.js.map +1 -1
- package/lib/Utils/event-buffer.d.ts +0 -2
- package/lib/Utils/event-buffer.d.ts.map +1 -1
- package/lib/Utils/event-buffer.js +1 -49
- package/lib/Utils/event-buffer.js.map +1 -1
- package/lib/Utils/generics.d.ts +2 -3
- package/lib/Utils/generics.d.ts.map +1 -1
- package/lib/Utils/generics.js +1 -10
- package/lib/Utils/generics.js.map +1 -1
- package/lib/Utils/history.d.ts +0 -2
- package/lib/Utils/history.d.ts.map +1 -1
- package/lib/Utils/history.js +9 -12
- package/lib/Utils/history.js.map +1 -1
- package/lib/Utils/identity-change-handler.d.ts +0 -7
- package/lib/Utils/identity-change-handler.d.ts.map +1 -1
- package/lib/Utils/identity-change-handler.js +0 -1
- package/lib/Utils/identity-change-handler.js.map +1 -1
- package/lib/Utils/index.d.ts +23 -30
- package/lib/Utils/index.d.ts.map +1 -1
- package/lib/Utils/index.js +2 -9
- package/lib/Utils/index.js.map +1 -1
- package/lib/Utils/link-preview.js +2 -2
- package/lib/Utils/link-preview.js.map +1 -1
- package/lib/Utils/message-retry-manager.d.ts +0 -5
- package/lib/Utils/message-retry-manager.d.ts.map +1 -1
- package/lib/Utils/message-retry-manager.js +0 -40
- package/lib/Utils/message-retry-manager.js.map +1 -1
- package/lib/Utils/messages-media.d.ts +13 -45
- package/lib/Utils/messages-media.d.ts.map +1 -1
- package/lib/Utils/messages-media.js +98 -293
- package/lib/Utils/messages-media.js.map +1 -1
- package/lib/Utils/messages.d.ts +3 -16
- package/lib/Utils/messages.d.ts.map +1 -1
- package/lib/Utils/messages.js +1123 -1219
- package/lib/Utils/messages.js.map +1 -1
- package/lib/Utils/noise-handler.d.ts +1 -1
- package/lib/Utils/process-message.d.ts.map +1 -1
- package/lib/Utils/process-message.js +1 -103
- package/lib/Utils/process-message.js.map +1 -1
- package/lib/Utils/rich-messages.d.ts +277 -0
- package/lib/Utils/rich-messages.d.ts.map +1 -0
- package/lib/Utils/rich-messages.js +1144 -0
- package/lib/Utils/rich-messages.js.map +1 -0
- package/lib/Utils/signal.d.ts +0 -13
- package/lib/Utils/signal.d.ts.map +1 -1
- package/lib/Utils/signal.js +0 -42
- package/lib/Utils/signal.js.map +1 -1
- package/lib/Utils/sticker-pack.d.ts +10 -0
- package/lib/Utils/sticker-pack.js +111 -0
- package/lib/Utils/sync-action-utils.d.ts.map +1 -1
- package/lib/Utils/sync-action-utils.js +0 -1
- package/lib/Utils/sync-action-utils.js.map +1 -1
- package/lib/Utils/tc-token-utils.d.ts +1 -26
- package/lib/Utils/tc-token-utils.d.ts.map +1 -1
- package/lib/Utils/tc-token-utils.js +5 -151
- package/lib/Utils/tc-token-utils.js.map +1 -1
- package/lib/Utils/validate-connection.d.ts +0 -1
- package/lib/Utils/validate-connection.d.ts.map +1 -1
- package/lib/Utils/validate-connection.js +3 -13
- package/lib/Utils/validate-connection.js.map +1 -1
- package/lib/WABinary/decode.d.ts +1 -1
- package/lib/WABinary/decode.d.ts.map +1 -1
- package/lib/WABinary/generic-utils.d.ts +3 -1
- package/lib/WABinary/generic-utils.d.ts.map +1 -1
- package/lib/WABinary/generic-utils.js +78 -0
- package/lib/WABinary/generic-utils.js.map +1 -1
- package/lib/WABinary/jid-utils.d.ts +0 -11
- package/lib/WABinary/jid-utils.d.ts.map +1 -1
- package/lib/WABinary/jid-utils.js +0 -33
- package/lib/WABinary/jid-utils.js.map +1 -1
- package/lib/WAM/encode.d.ts +1 -1
- package/lib/WAM/encode.d.ts.map +1 -1
- package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts.map +1 -1
- package/lib/WAUSync/Protocols/USyncContactProtocol.js +3 -26
- package/lib/WAUSync/Protocols/USyncContactProtocol.js.map +1 -1
- package/lib/WAUSync/Protocols/index.d.ts +0 -1
- package/lib/WAUSync/Protocols/index.d.ts.map +1 -1
- package/lib/WAUSync/Protocols/index.js +0 -1
- package/lib/WAUSync/Protocols/index.js.map +1 -1
- package/lib/WAUSync/USyncQuery.d.ts +0 -1
- package/lib/WAUSync/USyncQuery.d.ts.map +1 -1
- package/lib/WAUSync/USyncQuery.js +2 -6
- package/lib/WAUSync/USyncQuery.js.map +1 -1
- package/lib/WAUSync/USyncUser.d.ts +0 -4
- package/lib/WAUSync/USyncUser.d.ts.map +1 -1
- package/lib/WAUSync/USyncUser.js +0 -8
- package/lib/WAUSync/USyncUser.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -4
- package/lib/index.js.map +1 -1
- package/package.json +30 -34
- package/LICENSE +0 -21
- package/engine-requirements.js +0 -10
- package/lib/Socket/smgss.d.ts +0 -119
- package/lib/Socket/smgss.d.ts.map +0 -1
- package/lib/Socket/smgss.js +0 -453
- package/lib/Socket/smgss.js.map +0 -1
- package/lib/Store/index.d.ts +0 -4
- package/lib/Store/index.d.ts.map +0 -1
- package/lib/Store/index.js +0 -4
- package/lib/Store/index.js.map +0 -1
- package/lib/Store/make-in-memory-store.d.ts +0 -132
- package/lib/Store/make-in-memory-store.d.ts.map +0 -1
- package/lib/Store/make-in-memory-store.js +0 -450
- package/lib/Store/make-in-memory-store.js.map +0 -1
- package/lib/Store/make-ordered-dictionary.d.ts +0 -14
- package/lib/Store/make-ordered-dictionary.d.ts.map +0 -1
- package/lib/Store/make-ordered-dictionary.js +0 -80
- package/lib/Store/make-ordered-dictionary.js.map +0 -1
- package/lib/Store/object-repository.d.ts +0 -13
- package/lib/Store/object-repository.d.ts.map +0 -1
- package/lib/Store/object-repository.js +0 -24
- package/lib/Store/object-repository.js.map +0 -1
- package/lib/Types/Mex.d.ts.map +0 -1
- package/lib/Types/Mex.js.map +0 -1
- package/lib/Utils/button-handler.d.ts +0 -28
- package/lib/Utils/button-handler.d.ts.map +0 -1
- package/lib/Utils/button-handler.js +0 -140
- package/lib/Utils/button-handler.js.map +0 -1
- package/lib/Utils/companion-reg-client-utils.d.ts +0 -17
- package/lib/Utils/companion-reg-client-utils.d.ts.map +0 -1
- package/lib/Utils/companion-reg-client-utils.js +0 -35
- package/lib/Utils/companion-reg-client-utils.js.map +0 -1
- package/lib/Utils/interactive.d.ts +0 -60
- package/lib/Utils/interactive.d.ts.map +0 -1
- package/lib/Utils/interactive.js +0 -224
- package/lib/Utils/interactive.js.map +0 -1
- package/lib/Utils/message-composer.d.ts +0 -93
- package/lib/Utils/message-composer.d.ts.map +0 -1
- package/lib/Utils/message-composer.js +0 -311
- package/lib/Utils/message-composer.js.map +0 -1
- package/lib/Utils/messages-newsletter.d.ts +0 -74
- package/lib/Utils/messages-newsletter.d.ts.map +0 -1
- package/lib/Utils/messages-newsletter.js +0 -128
- package/lib/Utils/messages-newsletter.js.map +0 -1
- package/lib/Utils/shortcake-crypto.d.ts +0 -36
- package/lib/Utils/shortcake-crypto.d.ts.map +0 -1
- package/lib/Utils/shortcake-crypto.js +0 -71
- package/lib/Utils/shortcake-crypto.js.map +0 -1
- package/lib/Utils/shortcake.d.ts +0 -36
- package/lib/Utils/shortcake.d.ts.map +0 -1
- package/lib/Utils/shortcake.js +0 -162
- package/lib/Utils/shortcake.js.map +0 -1
- package/lib/Utils/use-single-file-auth-state.d.ts +0 -6
- package/lib/Utils/use-single-file-auth-state.d.ts.map +0 -1
- package/lib/Utils/use-single-file-auth-state.js +0 -111
- package/lib/Utils/use-single-file-auth-state.js.map +0 -1
- package/lib/Utils/use-sqlite-auth-state.d.ts +0 -14
- package/lib/Utils/use-sqlite-auth-state.d.ts.map +0 -1
- package/lib/Utils/use-sqlite-auth-state.js +0 -107
- package/lib/Utils/use-sqlite-auth-state.js.map +0 -1
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.d.ts +0 -10
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.d.ts.map +0 -1
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.js +0 -25
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.js.map +0 -1
package/lib/Utils/interactive.js
DELETED
|
@@ -1,224 +0,0 @@
|
|
|
1
|
-
const BRAND = '⚡ ASTA-BOTS';
|
|
2
|
-
/**
|
|
3
|
-
* Envía un mensaje con botón que copia texto al portapapeles
|
|
4
|
-
*/
|
|
5
|
-
export async function sendCopyButton(sock, jid, text, copyText, buttonText) {
|
|
6
|
-
try {
|
|
7
|
-
await sock.sendMessage(jid, {
|
|
8
|
-
interactiveMessage: {
|
|
9
|
-
body: { text },
|
|
10
|
-
footer: { text: BRAND },
|
|
11
|
-
header: {
|
|
12
|
-
title: '📋 Copiar Código',
|
|
13
|
-
hasMediaAttachment: false
|
|
14
|
-
},
|
|
15
|
-
nativeFlowMessage: {
|
|
16
|
-
buttons: [
|
|
17
|
-
{
|
|
18
|
-
name: 'cta_copy',
|
|
19
|
-
buttonParamsJson: JSON.stringify({
|
|
20
|
-
display_text: buttonText || '📋 Copiar',
|
|
21
|
-
copy_code: copyText
|
|
22
|
-
})
|
|
23
|
-
}
|
|
24
|
-
]
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
catch (error) {
|
|
30
|
-
console.error('[interactive] Error en sendCopyButton:', error);
|
|
31
|
-
await sock.sendMessage(jid, { text: `${text}\n\n📋 Copia esto: ${copyText}` });
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Envía un mensaje con botón de enlace (URL)
|
|
36
|
-
*/
|
|
37
|
-
export async function sendUrlButton(sock, jid, text, url, buttonText) {
|
|
38
|
-
try {
|
|
39
|
-
await sock.sendMessage(jid, {
|
|
40
|
-
interactiveMessage: {
|
|
41
|
-
body: { text },
|
|
42
|
-
footer: { text: BRAND },
|
|
43
|
-
header: {
|
|
44
|
-
title: '🔗 Enlace Rápido',
|
|
45
|
-
hasMediaAttachment: false
|
|
46
|
-
},
|
|
47
|
-
nativeFlowMessage: {
|
|
48
|
-
buttons: [
|
|
49
|
-
{
|
|
50
|
-
name: 'cta_url',
|
|
51
|
-
buttonParamsJson: JSON.stringify({
|
|
52
|
-
display_text: buttonText || '🔗 Abrir Enlace',
|
|
53
|
-
url,
|
|
54
|
-
merchant_url: url
|
|
55
|
-
})
|
|
56
|
-
}
|
|
57
|
-
]
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
catch (error) {
|
|
63
|
-
console.error('[interactive] Error en sendUrlButton:', error);
|
|
64
|
-
await sock.sendMessage(jid, { text: `${text}\n\n🔗 Enlace: ${url}` });
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Envía un mensaje con botones de respuesta rápida
|
|
69
|
-
*/
|
|
70
|
-
export async function sendQuickReplyButtons(sock, jid, text, buttons) {
|
|
71
|
-
try {
|
|
72
|
-
const interactiveButtons = buttons.map(btn => ({
|
|
73
|
-
name: 'quick_reply',
|
|
74
|
-
buttonParamsJson: JSON.stringify({
|
|
75
|
-
display_text: btn.text,
|
|
76
|
-
id: btn.id
|
|
77
|
-
})
|
|
78
|
-
}));
|
|
79
|
-
await sock.sendMessage(jid, {
|
|
80
|
-
interactiveMessage: {
|
|
81
|
-
body: { text },
|
|
82
|
-
footer: { text: `${BRAND} - Selecciona una opción` },
|
|
83
|
-
header: {
|
|
84
|
-
hasMediaAttachment: false
|
|
85
|
-
},
|
|
86
|
-
nativeFlowMessage: {
|
|
87
|
-
buttons: interactiveButtons
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
catch (error) {
|
|
93
|
-
console.error('[interactive] Error en sendQuickReplyButtons:', error);
|
|
94
|
-
const buttonsText = buttons.map(b => `• ${b.text} → ${b.id}`).join('\n');
|
|
95
|
-
await sock.sendMessage(jid, { text: `${text}\n\n${buttonsText}` });
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Envía un mensaje con botón de llamada telefónica
|
|
100
|
-
*/
|
|
101
|
-
export async function sendCallButton(sock, jid, text, phoneNumber, buttonText) {
|
|
102
|
-
try {
|
|
103
|
-
await sock.sendMessage(jid, {
|
|
104
|
-
interactiveMessage: {
|
|
105
|
-
body: { text },
|
|
106
|
-
footer: { text: BRAND },
|
|
107
|
-
header: {
|
|
108
|
-
title: '📞 Llamar',
|
|
109
|
-
hasMediaAttachment: false
|
|
110
|
-
},
|
|
111
|
-
nativeFlowMessage: {
|
|
112
|
-
buttons: [
|
|
113
|
-
{
|
|
114
|
-
name: 'cta_call',
|
|
115
|
-
buttonParamsJson: JSON.stringify({
|
|
116
|
-
display_text: buttonText || '📞 Llamar Ahora',
|
|
117
|
-
phone_number: phoneNumber
|
|
118
|
-
})
|
|
119
|
-
}
|
|
120
|
-
]
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
catch (error) {
|
|
126
|
-
console.error('[interactive] Error en sendCallButton:', error);
|
|
127
|
-
await sock.sendMessage(jid, { text: `${text}\n\n📞 Llama a: ${phoneNumber}` });
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* Envía un mensaje con lista desplegable (single select)
|
|
132
|
-
*/
|
|
133
|
-
export async function sendListMenu(sock, jid, text, title, sections) {
|
|
134
|
-
try {
|
|
135
|
-
const formattedSections = sections.map(section => ({
|
|
136
|
-
title: section.title,
|
|
137
|
-
rows: section.rows.map(row => ({
|
|
138
|
-
header: row.header || '',
|
|
139
|
-
title: row.title,
|
|
140
|
-
description: row.description || '',
|
|
141
|
-
id: row.id
|
|
142
|
-
}))
|
|
143
|
-
}));
|
|
144
|
-
await sock.sendMessage(jid, {
|
|
145
|
-
interactiveMessage: {
|
|
146
|
-
body: { text },
|
|
147
|
-
footer: { text: `${BRAND} - Menú Interactivo` },
|
|
148
|
-
header: {
|
|
149
|
-
title: title || '📋 Menú de Opciones',
|
|
150
|
-
hasMediaAttachment: false
|
|
151
|
-
},
|
|
152
|
-
nativeFlowMessage: {
|
|
153
|
-
buttons: [
|
|
154
|
-
{
|
|
155
|
-
name: 'single_select',
|
|
156
|
-
buttonParamsJson: JSON.stringify({
|
|
157
|
-
title: '📋 Ver opciones',
|
|
158
|
-
sections: formattedSections
|
|
159
|
-
})
|
|
160
|
-
}
|
|
161
|
-
]
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
|
-
catch (error) {
|
|
167
|
-
console.error('[interactive] Error en sendListMenu:', error);
|
|
168
|
-
let fallbackText = `${text}\n\n`;
|
|
169
|
-
for (const sec of sections) {
|
|
170
|
-
fallbackText += `\n*${sec.title}*\n`;
|
|
171
|
-
for (const row of sec.rows) {
|
|
172
|
-
fallbackText += `• ${row.id} - ${row.title}\n`;
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
await sock.sendMessage(jid, { text: fallbackText });
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
/**
|
|
179
|
-
* Envía un mensaje con múltiples botones combinados (copy, url, call, quick)
|
|
180
|
-
*/
|
|
181
|
-
export async function sendInteractiveMessage(sock, jid, text, buttonsConfig) {
|
|
182
|
-
try {
|
|
183
|
-
const buttons = buttonsConfig.map(btn => {
|
|
184
|
-
switch (btn.type) {
|
|
185
|
-
case 'copy':
|
|
186
|
-
return {
|
|
187
|
-
name: 'cta_copy',
|
|
188
|
-
buttonParamsJson: JSON.stringify({ display_text: btn.text, copy_code: btn.value })
|
|
189
|
-
};
|
|
190
|
-
case 'url':
|
|
191
|
-
return {
|
|
192
|
-
name: 'cta_url',
|
|
193
|
-
buttonParamsJson: JSON.stringify({ display_text: btn.text, url: btn.value, merchant_url: btn.value })
|
|
194
|
-
};
|
|
195
|
-
case 'call':
|
|
196
|
-
return {
|
|
197
|
-
name: 'cta_call',
|
|
198
|
-
buttonParamsJson: JSON.stringify({ display_text: btn.text, phone_number: btn.value })
|
|
199
|
-
};
|
|
200
|
-
case 'quick':
|
|
201
|
-
default:
|
|
202
|
-
return {
|
|
203
|
-
name: 'quick_reply',
|
|
204
|
-
buttonParamsJson: JSON.stringify({ display_text: btn.text, id: btn.id || btn.value })
|
|
205
|
-
};
|
|
206
|
-
}
|
|
207
|
-
});
|
|
208
|
-
await sock.sendMessage(jid, {
|
|
209
|
-
interactiveMessage: {
|
|
210
|
-
body: { text },
|
|
211
|
-
footer: { text: BRAND },
|
|
212
|
-
header: {
|
|
213
|
-
hasMediaAttachment: false
|
|
214
|
-
},
|
|
215
|
-
nativeFlowMessage: { buttons }
|
|
216
|
-
}
|
|
217
|
-
});
|
|
218
|
-
}
|
|
219
|
-
catch (error) {
|
|
220
|
-
console.error('[interactive] Error en sendInteractiveMessage:', error);
|
|
221
|
-
await sock.sendMessage(jid, { text });
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
//# sourceMappingURL=interactive.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"interactive.js","sourceRoot":"","sources":["../../src/Utils/interactive.ts"],"names":[],"mappings":"AAIA,MAAM,KAAK,GAAG,aAAa,CAAA;AAyB3B;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CACnC,IAAc,EACd,GAAW,EACX,IAAY,EACZ,QAAgB,EAChB,UAAmB;IAEnB,IAAI,CAAC;QACJ,MAAM,IAAI,CAAC,WAAW,CAAC,GAAG,EAAE;YAC3B,kBAAkB,EAAE;gBACnB,IAAI,EAAE,EAAE,IAAI,EAAE;gBACd,MAAM,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE;gBACvB,MAAM,EAAE;oBACP,KAAK,EAAE,kBAAkB;oBACzB,kBAAkB,EAAE,KAAK;iBACzB;gBACD,iBAAiB,EAAE;oBAClB,OAAO,EAAE;wBACR;4BACC,IAAI,EAAE,UAAU;4BAChB,gBAAgB,EAAE,IAAI,CAAC,SAAS,CAAC;gCAChC,YAAY,EAAE,UAAU,IAAI,WAAW;gCACvC,SAAS,EAAE,QAAQ;6BACnB,CAAC;yBACF;qBACD;iBACD;aACD;SACM,CAAC,CAAA;IACV,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,OAAO,CAAC,KAAK,CAAC,wCAAwC,EAAE,KAAK,CAAC,CAAA;QAC9D,MAAM,IAAI,CAAC,WAAW,CAAC,GAAG,EAAE,EAAE,IAAI,EAAE,GAAG,IAAI,sBAAsB,QAAQ,EAAE,EAAE,CAAC,CAAA;IAC/E,CAAC;AACF,CAAC;A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,KAAK,EAAE,YAAY,EAAE,GAAG,CAAC,KAAK,EAAE,CAAC;qBACrG,CAAA;gBACF,KAAK,MAAM;oBACV,OAAO;wBACN,IAAI,EAAE,UAAU;wBAChB,gBAAgB,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,YAAY,EAAE,GAAG,CAAC,IAAI,EAAE,YAAY,EAAE,GAAG,CAAC,KAAK,EAAE,CAAC;qBACrF,CAAA;gBACF,KAAK,OAAO,CAAC;gBACb;oBACC,OAAO;wBACN,IAAI,EAAE,aAAa;wBACnB,gBAAgB,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,YAAY,EAAE,GAAG,CAAC,IAAI,EAAE,EAAE,EAAE,GAAG,CAAC,EAAE,IAAI,GAAG,CAAC,KAAK,EAAE,CAAC;qBACrF,CAAA;YACH,CAAC;QACF,CAAC,CAAC,CAAA;QAEF,MAAM,IAAI,CAAC,WAAW,CAAC,GAAG,EAAE;YAC3B,kBAAkB,EAAE;gBACnB,IAAI,EAAE,EAAE,IAAI,EAAE;gBACd,MAAM,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE;gBACvB,MAAM,EAAE;oBACP,kBAAkB,EAAE,KAAK;iBACzB;gBACD,iBAAiB,EAAE,EAAE,OAAO,EAAE;aAC9B;SACM,CAAC,CAAA;IACV,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,OAAO,CAAC,KAAK,CAAC,gDAAgD,EAAE,KAAK,CAAC,CAAA;QACtE,MAAM,IAAI,CAAC,WAAW,CAAC,GAAG,EAAE,EAAE,IAAI,EAAE,CAAC,CAAA;IACtC,CAAC;AACF,CAAC"}
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import { proto } from '../../WAProto/index.js';
|
|
2
|
-
import type { WAMessage, WAMessageKey } from '../Types/index.js';
|
|
3
|
-
export declare const JS_KEYWORDS: Set<string>;
|
|
4
|
-
export declare const PYTHON_KEYWORDS: Set<string>;
|
|
5
|
-
export declare const LANGUAGE_KEYWORDS: Record<string, Set<string>>;
|
|
6
|
-
export declare const CodeHighlightType: {
|
|
7
|
-
DEFAULT: proto.AIRichResponseCodeMetadata.AIRichResponseCodeHighlightType;
|
|
8
|
-
KEYWORD: proto.AIRichResponseCodeMetadata.AIRichResponseCodeHighlightType;
|
|
9
|
-
METHOD: proto.AIRichResponseCodeMetadata.AIRichResponseCodeHighlightType;
|
|
10
|
-
STRING: proto.AIRichResponseCodeMetadata.AIRichResponseCodeHighlightType;
|
|
11
|
-
NUMBER: proto.AIRichResponseCodeMetadata.AIRichResponseCodeHighlightType;
|
|
12
|
-
COMMENT: proto.AIRichResponseCodeMetadata.AIRichResponseCodeHighlightType;
|
|
13
|
-
};
|
|
14
|
-
export declare const RichSubMessageType: {
|
|
15
|
-
UNKNOWN: proto.AIRichResponseSubMessageType;
|
|
16
|
-
GRID_IMAGE: proto.AIRichResponseSubMessageType;
|
|
17
|
-
TEXT: proto.AIRichResponseSubMessageType;
|
|
18
|
-
INLINE_IMAGE: proto.AIRichResponseSubMessageType;
|
|
19
|
-
TABLE: proto.AIRichResponseSubMessageType;
|
|
20
|
-
CODE: proto.AIRichResponseSubMessageType;
|
|
21
|
-
DYNAMIC: proto.AIRichResponseSubMessageType;
|
|
22
|
-
MAP: proto.AIRichResponseSubMessageType;
|
|
23
|
-
LATEX: proto.AIRichResponseSubMessageType;
|
|
24
|
-
CONTENT_ITEMS: proto.AIRichResponseSubMessageType;
|
|
25
|
-
};
|
|
26
|
-
export type CodeBlock = {
|
|
27
|
-
highlightType: number;
|
|
28
|
-
codeContent: string;
|
|
29
|
-
};
|
|
30
|
-
export declare const tokenizeCode: (codeStr: string, language?: string) => CodeBlock[];
|
|
31
|
-
type Quotable = WAMessage | {
|
|
32
|
-
key: WAMessageKey;
|
|
33
|
-
message?: proto.IMessage | null;
|
|
34
|
-
sender?: string;
|
|
35
|
-
} | undefined;
|
|
36
|
-
export declare const buildRichContextInfo: (quoted?: Quotable) => proto.IContextInfo;
|
|
37
|
-
export declare const buildBotForwardedMessage: (submessages: proto.IAIRichResponseSubMessage[], contextInfo: proto.IContextInfo, unifiedResponse?: proto.IAIRichResponseUnifiedResponse) => proto.IMessage;
|
|
38
|
-
export type RichMessageResult = {
|
|
39
|
-
message: proto.IMessage;
|
|
40
|
-
messageId: string;
|
|
41
|
-
};
|
|
42
|
-
export type RichContentOptions = {
|
|
43
|
-
footer?: string;
|
|
44
|
-
headerText?: string;
|
|
45
|
-
};
|
|
46
|
-
export declare const generateTableContent: (title: string, headers: string[], rows: unknown[][], quoted?: Quotable, options?: RichContentOptions) => RichMessageResult;
|
|
47
|
-
export declare const generateListContent: (title: string, items: unknown[], quoted?: Quotable, options?: RichContentOptions) => RichMessageResult;
|
|
48
|
-
export declare const generateCodeBlockContent: (code: string, quoted?: Quotable, options?: RichContentOptions & {
|
|
49
|
-
title?: string;
|
|
50
|
-
language?: string;
|
|
51
|
-
}) => RichMessageResult;
|
|
52
|
-
export type LatexExpressionInput = {
|
|
53
|
-
latexExpression: string;
|
|
54
|
-
url?: string;
|
|
55
|
-
width?: number;
|
|
56
|
-
height?: number;
|
|
57
|
-
fontHeight?: number;
|
|
58
|
-
imageTopPadding?: number;
|
|
59
|
-
imageLeadingPadding?: number;
|
|
60
|
-
imageBottomPadding?: number;
|
|
61
|
-
imageTrailingPadding?: number;
|
|
62
|
-
};
|
|
63
|
-
export declare const generateLatexContent: (quoted: Quotable | undefined, options: RichContentOptions & {
|
|
64
|
-
text?: string;
|
|
65
|
-
expressions: LatexExpressionInput[];
|
|
66
|
-
}) => RichMessageResult;
|
|
67
|
-
type RenderLatexToPng = (expr: string) => Promise<{
|
|
68
|
-
buffer: Buffer;
|
|
69
|
-
width: number;
|
|
70
|
-
height: number;
|
|
71
|
-
}>;
|
|
72
|
-
type UploadFn = (buffer: Buffer, type: string) => Promise<{
|
|
73
|
-
url?: string;
|
|
74
|
-
directPath?: string;
|
|
75
|
-
}>;
|
|
76
|
-
export declare const generateLatexImageContent: (quoted: Quotable | undefined, options: RichContentOptions & {
|
|
77
|
-
text?: string;
|
|
78
|
-
expressions: LatexExpressionInput[];
|
|
79
|
-
}, uploadFn: UploadFn, renderLatexToPng: RenderLatexToPng) => Promise<RichMessageResult>;
|
|
80
|
-
export declare const generateLatexInlineImageContent: (quoted: Quotable | undefined, options: RichContentOptions & {
|
|
81
|
-
text?: string;
|
|
82
|
-
expressions: LatexExpressionInput[];
|
|
83
|
-
}, uploadFn: UploadFn, renderLatexToPng: RenderLatexToPng) => Promise<RichMessageResult>;
|
|
84
|
-
export type CapturedUnifiedResponse = {
|
|
85
|
-
unifiedResponse: proto.IAIRichResponseUnifiedResponse;
|
|
86
|
-
submessages: proto.IAIRichResponseSubMessage[];
|
|
87
|
-
contextInfo: proto.IContextInfo;
|
|
88
|
-
};
|
|
89
|
-
export declare const captureUnifiedResponse: (msg?: proto.IMessage | null) => CapturedUnifiedResponse | null;
|
|
90
|
-
export declare const generateUnifiedResponseContent: (quoted: Quotable | undefined, captured: CapturedUnifiedResponse) => RichMessageResult;
|
|
91
|
-
export declare const generateRichMessageContent: (submessages: proto.IAIRichResponseSubMessage[], quoted?: Quotable) => RichMessageResult;
|
|
92
|
-
export {};
|
|
93
|
-
//# sourceMappingURL=message-composer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"message-composer.d.ts","sourceRoot":"","sources":["../../src/Utils/message-composer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAC9C,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAGvD,eAAO,MAAM,WAAW,aAKtB,CAAA;AAEF,eAAO,MAAM,eAAe,aAI1B,CAAA;AAEF,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAOzD,CAAA;AAGD,eAAO,MAAM,iBAAiB;;;;;;;CAO7B,CAAA;AAED,eAAO,MAAM,k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B,kBAAkB,gBAAgB,KAChC,OAAO,CAAC,iBAAiB,CA4B3B,CAAA;AAED,eAAO,MAAM,+BAA+B,GAC3C,QAAQ,QAAQ,GAAG,SAAS,EAC5B,SAAS,kBAAkB,GAAG;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,oBAAoB,EAAE,CAAA;CAAE,EACpF,UAAU,QAAQ,EAClB,kBAAkB,gBAAgB,KAChC,OAAO,CAAC,iBAAiB,CAmC3B,CAAA;AAED,MAAM,MAAM,uBAAuB,GAAG;IACrC,eAAe,EAAE,KAAK,CAAC,8BAA8B,CAAA;IACrD,WAAW,EAAE,KAAK,CAAC,yBAAyB,EAAE,CAAA;IAC9C,WAAW,EAAE,KAAK,CAAC,YAAY,CAAA;CAC/B,CAAA;AAED,eAAO,MAAM,sBAAsB,GAAI,MAAM,KAAK,CAAC,QAAQ,GAAG,IAAI,KAAG,uBAAuB,GAAG,IAgB9F,CAAA;AAED,eAAO,MAAM,8BAA8B,GAC1C,QAAQ,QAAQ,GAAG,SAAS,EAC5B,UAAU,uBAAuB,KAC/B,iBAMF,CAAA;AAED,eAAO,MAAM,0BAA0B,GACtC,aAAa,KAAK,CAAC,yBAAyB,EAAE,EAC9C,SAAS,QAAQ,KACf,iBAGF,CAAA"}
|
|
@@ -1,311 +0,0 @@
|
|
|
1
|
-
import { proto } from '../../WAProto/index.js';
|
|
2
|
-
import { generateMessageIDV2 } from './generics.js';
|
|
3
|
-
export const JS_KEYWORDS = new Set([
|
|
4
|
-
'import', 'export', 'from', 'default', 'as', 'const', 'let', 'var', 'function', 'class', 'extends', 'new',
|
|
5
|
-
'return', 'if', 'else', 'for', 'while', 'do', 'switch', 'case', 'break', 'continue', 'try', 'catch', 'finally',
|
|
6
|
-
'throw', 'async', 'await', 'yield', 'typeof', 'instanceof', 'in', 'of', 'delete', 'void', 'true', 'false',
|
|
7
|
-
'null', 'undefined', 'NaN', 'Infinity', 'this', 'super', 'static', 'get', 'set', 'debugger', 'with'
|
|
8
|
-
]);
|
|
9
|
-
export const PYTHON_KEYWORDS = new Set([
|
|
10
|
-
'import', 'from', 'as', 'def', 'class', 'return', 'if', 'elif', 'else', 'for', 'while', 'break', 'continue',
|
|
11
|
-
'try', 'except', 'finally', 'raise', 'with', 'yield', 'lambda', 'pass', 'del', 'global', 'nonlocal', 'assert',
|
|
12
|
-
'True', 'False', 'None', 'and', 'or', 'not', 'in', 'is', 'async', 'await', 'self', 'print'
|
|
13
|
-
]);
|
|
14
|
-
export const LANGUAGE_KEYWORDS = {
|
|
15
|
-
javascript: JS_KEYWORDS,
|
|
16
|
-
typescript: JS_KEYWORDS,
|
|
17
|
-
js: JS_KEYWORDS,
|
|
18
|
-
ts: JS_KEYWORDS,
|
|
19
|
-
python: PYTHON_KEYWORDS,
|
|
20
|
-
py: PYTHON_KEYWORDS
|
|
21
|
-
};
|
|
22
|
-
const HL = proto.AIRichResponseCodeMetadata.AIRichResponseCodeHighlightType;
|
|
23
|
-
export const CodeHighlightType = {
|
|
24
|
-
DEFAULT: HL.AI_RICH_RESPONSE_CODE_HIGHLIGHT_DEFAULT,
|
|
25
|
-
KEYWORD: HL.AI_RICH_RESPONSE_CODE_HIGHLIGHT_KEYWORD,
|
|
26
|
-
METHOD: HL.AI_RICH_RESPONSE_CODE_HIGHLIGHT_METHOD,
|
|
27
|
-
STRING: HL.AI_RICH_RESPONSE_CODE_HIGHLIGHT_STRING,
|
|
28
|
-
NUMBER: HL.AI_RICH_RESPONSE_CODE_HIGHLIGHT_NUMBER,
|
|
29
|
-
COMMENT: HL.AI_RICH_RESPONSE_CODE_HIGHLIGHT_COMMENT
|
|
30
|
-
};
|
|
31
|
-
export const RichSubMessageType = {
|
|
32
|
-
UNKNOWN: proto.AIRichResponseSubMessageType.AI_RICH_RESPONSE_UNKNOWN,
|
|
33
|
-
GRID_IMAGE: proto.AIRichResponseSubMessageType.AI_RICH_RESPONSE_GRID_IMAGE,
|
|
34
|
-
TEXT: proto.AIRichResponseSubMessageType.AI_RICH_RESPONSE_TEXT,
|
|
35
|
-
INLINE_IMAGE: proto.AIRichResponseSubMessageType.AI_RICH_RESPONSE_INLINE_IMAGE,
|
|
36
|
-
TABLE: proto.AIRichResponseSubMessageType.AI_RICH_RESPONSE_TABLE,
|
|
37
|
-
CODE: proto.AIRichResponseSubMessageType.AI_RICH_RESPONSE_CODE,
|
|
38
|
-
DYNAMIC: proto.AIRichResponseSubMessageType.AI_RICH_RESPONSE_DYNAMIC,
|
|
39
|
-
MAP: proto.AIRichResponseSubMessageType.AI_RICH_RESPONSE_MAP,
|
|
40
|
-
LATEX: proto.AIRichResponseSubMessageType.AI_RICH_RESPONSE_LATEX,
|
|
41
|
-
CONTENT_ITEMS: proto.AIRichResponseSubMessageType.AI_RICH_RESPONSE_CONTENT_ITEMS
|
|
42
|
-
};
|
|
43
|
-
export const tokenizeCode = (codeStr, language = 'javascript') => {
|
|
44
|
-
const keywords = LANGUAGE_KEYWORDS[language] || JS_KEYWORDS;
|
|
45
|
-
const blocks = [];
|
|
46
|
-
const lines = codeStr.split('\n');
|
|
47
|
-
for (let li = 0; li < lines.length; li++) {
|
|
48
|
-
const line = lines[li];
|
|
49
|
-
const isLast = li === lines.length - 1;
|
|
50
|
-
const nl = isLast ? '' : '\n';
|
|
51
|
-
if (!line.trim()) {
|
|
52
|
-
blocks.push({ highlightType: CodeHighlightType.DEFAULT, codeContent: line + nl });
|
|
53
|
-
continue;
|
|
54
|
-
}
|
|
55
|
-
if (line.trim().startsWith('//') || line.trim().startsWith('#')) {
|
|
56
|
-
blocks.push({ highlightType: CodeHighlightType.COMMENT, codeContent: line + nl });
|
|
57
|
-
continue;
|
|
58
|
-
}
|
|
59
|
-
const regex = /(\/\/.*$|#.*$)|(["'`](?:[^"'`\\]|\\.)*["'`])|(\b\d+(?:\.\d+)?\b)|(\b[a-zA-Z_$][\w$]*\b)|([^\s\w$"'`]+)|(\s+)/g;
|
|
60
|
-
let match;
|
|
61
|
-
const tokens = [];
|
|
62
|
-
while ((match = regex.exec(line)) !== null) {
|
|
63
|
-
const val = match[0];
|
|
64
|
-
if (match[1]) {
|
|
65
|
-
tokens.push({ highlightType: CodeHighlightType.COMMENT, codeContent: val });
|
|
66
|
-
}
|
|
67
|
-
else if (match[2]) {
|
|
68
|
-
tokens.push({ highlightType: CodeHighlightType.STRING, codeContent: val });
|
|
69
|
-
}
|
|
70
|
-
else if (match[3]) {
|
|
71
|
-
tokens.push({ highlightType: CodeHighlightType.NUMBER, codeContent: val });
|
|
72
|
-
}
|
|
73
|
-
else if (match[4]) {
|
|
74
|
-
if (keywords.has(val)) {
|
|
75
|
-
tokens.push({ highlightType: CodeHighlightType.KEYWORD, codeContent: val });
|
|
76
|
-
}
|
|
77
|
-
else {
|
|
78
|
-
const after = line.slice(regex.lastIndex).trimStart();
|
|
79
|
-
if (after.startsWith('(')) {
|
|
80
|
-
tokens.push({ highlightType: CodeHighlightType.METHOD, codeContent: val });
|
|
81
|
-
}
|
|
82
|
-
else {
|
|
83
|
-
tokens.push({ highlightType: CodeHighlightType.DEFAULT, codeContent: val });
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
else {
|
|
88
|
-
tokens.push({ highlightType: CodeHighlightType.DEFAULT, codeContent: val });
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
if (tokens.length === 0) {
|
|
92
|
-
blocks.push({ highlightType: CodeHighlightType.DEFAULT, codeContent: line + nl });
|
|
93
|
-
continue;
|
|
94
|
-
}
|
|
95
|
-
const merged = [];
|
|
96
|
-
for (const t of tokens) {
|
|
97
|
-
const prev = merged.length > 0 ? merged[merged.length - 1] : undefined;
|
|
98
|
-
if (prev && prev.highlightType === t.highlightType) {
|
|
99
|
-
prev.codeContent += t.codeContent;
|
|
100
|
-
}
|
|
101
|
-
else {
|
|
102
|
-
merged.push({ ...t });
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
if (merged.length > 0) {
|
|
106
|
-
merged[merged.length - 1].codeContent += nl;
|
|
107
|
-
}
|
|
108
|
-
blocks.push(...merged);
|
|
109
|
-
}
|
|
110
|
-
return blocks;
|
|
111
|
-
};
|
|
112
|
-
export const buildRichContextInfo = (quoted) => {
|
|
113
|
-
const ctxInfo = {
|
|
114
|
-
forwardingScore: 1,
|
|
115
|
-
isForwarded: true,
|
|
116
|
-
forwardedAiBotMessageInfo: { botJid: '867051314767696@bot' },
|
|
117
|
-
forwardOrigin: proto.ContextInfo.ForwardOrigin.META_AI
|
|
118
|
-
};
|
|
119
|
-
if (quoted?.key) {
|
|
120
|
-
ctxInfo.stanzaId = quoted.key.id;
|
|
121
|
-
ctxInfo.participant = quoted.key.participant || quoted.sender || quoted.key.remoteJid || undefined;
|
|
122
|
-
ctxInfo.quotedMessage = quoted.message;
|
|
123
|
-
}
|
|
124
|
-
return ctxInfo;
|
|
125
|
-
};
|
|
126
|
-
export const buildBotForwardedMessage = (submessages, contextInfo, unifiedResponse) => {
|
|
127
|
-
const richResponse = {
|
|
128
|
-
messageType: proto.AIRichResponseMessageType.AI_RICH_RESPONSE_TYPE_STANDARD,
|
|
129
|
-
submessages,
|
|
130
|
-
contextInfo
|
|
131
|
-
};
|
|
132
|
-
if (unifiedResponse) {
|
|
133
|
-
richResponse.unifiedResponse = unifiedResponse;
|
|
134
|
-
}
|
|
135
|
-
return {
|
|
136
|
-
botForwardedMessage: {
|
|
137
|
-
message: {
|
|
138
|
-
richResponseMessage: richResponse
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
};
|
|
142
|
-
};
|
|
143
|
-
export const generateTableContent = (title, headers, rows, quoted, options = {}) => {
|
|
144
|
-
const { footer, headerText } = options;
|
|
145
|
-
const tableRows = [{ items: headers, isHeading: true }, ...rows.map(row => ({ items: row.map(String) }))];
|
|
146
|
-
const submessages = [];
|
|
147
|
-
if (headerText) {
|
|
148
|
-
submessages.push({ messageType: RichSubMessageType.TEXT, messageText: headerText });
|
|
149
|
-
}
|
|
150
|
-
submessages.push({
|
|
151
|
-
messageType: RichSubMessageType.TABLE,
|
|
152
|
-
tableMetadata: { title, rows: tableRows }
|
|
153
|
-
});
|
|
154
|
-
if (footer) {
|
|
155
|
-
submessages.push({ messageType: RichSubMessageType.TEXT, messageText: footer });
|
|
156
|
-
}
|
|
157
|
-
const ctxInfo = buildRichContextInfo(quoted);
|
|
158
|
-
return { message: buildBotForwardedMessage(submessages, ctxInfo), messageId: generateMessageIDV2() };
|
|
159
|
-
};
|
|
160
|
-
export const generateListContent = (title, items, quoted, options = {}) => {
|
|
161
|
-
const { footer, headerText } = options;
|
|
162
|
-
const tableRows = items.map(item => ({
|
|
163
|
-
items: Array.isArray(item) ? item.map(String) : [String(item)]
|
|
164
|
-
}));
|
|
165
|
-
const submessages = [];
|
|
166
|
-
if (headerText) {
|
|
167
|
-
submessages.push({ messageType: RichSubMessageType.TEXT, messageText: headerText });
|
|
168
|
-
}
|
|
169
|
-
submessages.push({
|
|
170
|
-
messageType: RichSubMessageType.TABLE,
|
|
171
|
-
tableMetadata: { title, rows: tableRows }
|
|
172
|
-
});
|
|
173
|
-
if (footer) {
|
|
174
|
-
submessages.push({ messageType: RichSubMessageType.TEXT, messageText: footer });
|
|
175
|
-
}
|
|
176
|
-
const ctxInfo = buildRichContextInfo(quoted);
|
|
177
|
-
return { message: buildBotForwardedMessage(submessages, ctxInfo), messageId: generateMessageIDV2() };
|
|
178
|
-
};
|
|
179
|
-
export const generateCodeBlockContent = (code, quoted, options = {}) => {
|
|
180
|
-
const { title, footer, language = 'javascript' } = options;
|
|
181
|
-
const submessages = [];
|
|
182
|
-
if (title) {
|
|
183
|
-
submessages.push({ messageType: RichSubMessageType.TEXT, messageText: title });
|
|
184
|
-
}
|
|
185
|
-
submessages.push({
|
|
186
|
-
messageType: RichSubMessageType.CODE,
|
|
187
|
-
codeMetadata: {
|
|
188
|
-
codeLanguage: language,
|
|
189
|
-
codeBlocks: tokenizeCode(code, language)
|
|
190
|
-
}
|
|
191
|
-
});
|
|
192
|
-
if (footer) {
|
|
193
|
-
submessages.push({ messageType: RichSubMessageType.TEXT, messageText: footer });
|
|
194
|
-
}
|
|
195
|
-
const ctxInfo = buildRichContextInfo(quoted);
|
|
196
|
-
return { message: buildBotForwardedMessage(submessages, ctxInfo), messageId: generateMessageIDV2() };
|
|
197
|
-
};
|
|
198
|
-
export const generateLatexContent = (quoted, options) => {
|
|
199
|
-
const { text, expressions, headerText, footer } = options;
|
|
200
|
-
const submessages = [];
|
|
201
|
-
if (headerText) {
|
|
202
|
-
submessages.push({ messageType: RichSubMessageType.TEXT, messageText: headerText });
|
|
203
|
-
}
|
|
204
|
-
const latexExpressions = expressions.map(expr => {
|
|
205
|
-
const entry = {
|
|
206
|
-
latexExpression: expr.latexExpression,
|
|
207
|
-
url: expr.url,
|
|
208
|
-
width: expr.width,
|
|
209
|
-
height: expr.height
|
|
210
|
-
};
|
|
211
|
-
if (expr.fontHeight !== undefined)
|
|
212
|
-
entry.fontHeight = expr.fontHeight;
|
|
213
|
-
if (expr.imageTopPadding !== undefined)
|
|
214
|
-
entry.imageTopPadding = expr.imageTopPadding;
|
|
215
|
-
if (expr.imageLeadingPadding !== undefined)
|
|
216
|
-
entry.imageLeadingPadding = expr.imageLeadingPadding;
|
|
217
|
-
if (expr.imageBottomPadding !== undefined)
|
|
218
|
-
entry.imageBottomPadding = expr.imageBottomPadding;
|
|
219
|
-
if (expr.imageTrailingPadding !== undefined)
|
|
220
|
-
entry.imageTrailingPadding = expr.imageTrailingPadding;
|
|
221
|
-
return entry;
|
|
222
|
-
});
|
|
223
|
-
submessages.push({
|
|
224
|
-
messageType: RichSubMessageType.LATEX,
|
|
225
|
-
latexMetadata: { text: text || '', expressions: latexExpressions }
|
|
226
|
-
});
|
|
227
|
-
if (footer) {
|
|
228
|
-
submessages.push({ messageType: RichSubMessageType.TEXT, messageText: footer });
|
|
229
|
-
}
|
|
230
|
-
const ctxInfo = buildRichContextInfo(quoted);
|
|
231
|
-
return { message: buildBotForwardedMessage(submessages, ctxInfo), messageId: generateMessageIDV2() };
|
|
232
|
-
};
|
|
233
|
-
export const generateLatexImageContent = async (quoted, options, uploadFn, renderLatexToPng) => {
|
|
234
|
-
const { text, expressions, headerText, footer } = options;
|
|
235
|
-
const submessages = [];
|
|
236
|
-
if (headerText) {
|
|
237
|
-
submessages.push({ messageType: RichSubMessageType.TEXT, messageText: headerText });
|
|
238
|
-
}
|
|
239
|
-
const latexExpressions = await Promise.all(expressions.map(async (expr) => {
|
|
240
|
-
const { buffer, width, height } = await renderLatexToPng(expr.latexExpression);
|
|
241
|
-
const uploadResult = await uploadFn(buffer, 'image');
|
|
242
|
-
const imageUrl = uploadResult.url || uploadResult.directPath;
|
|
243
|
-
return { latexExpression: expr.latexExpression, url: imageUrl, width, height };
|
|
244
|
-
}));
|
|
245
|
-
submessages.push({
|
|
246
|
-
messageType: RichSubMessageType.LATEX,
|
|
247
|
-
latexMetadata: { text: text || '', expressions: latexExpressions }
|
|
248
|
-
});
|
|
249
|
-
if (footer) {
|
|
250
|
-
submessages.push({ messageType: RichSubMessageType.TEXT, messageText: footer });
|
|
251
|
-
}
|
|
252
|
-
const ctxInfo = buildRichContextInfo(quoted);
|
|
253
|
-
return { message: buildBotForwardedMessage(submessages, ctxInfo), messageId: generateMessageIDV2() };
|
|
254
|
-
};
|
|
255
|
-
export const generateLatexInlineImageContent = async (quoted, options, uploadFn, renderLatexToPng) => {
|
|
256
|
-
const { text, expressions, headerText, footer } = options;
|
|
257
|
-
const submessages = [];
|
|
258
|
-
if (headerText) {
|
|
259
|
-
submessages.push({ messageType: RichSubMessageType.TEXT, messageText: headerText });
|
|
260
|
-
}
|
|
261
|
-
if (text) {
|
|
262
|
-
submessages.push({ messageType: RichSubMessageType.TEXT, messageText: text });
|
|
263
|
-
}
|
|
264
|
-
for (const expr of expressions) {
|
|
265
|
-
const { buffer, width, height } = await renderLatexToPng(expr.latexExpression);
|
|
266
|
-
const uploadResult = await uploadFn(buffer, 'image');
|
|
267
|
-
const imageUrl = uploadResult.url || uploadResult.directPath;
|
|
268
|
-
submessages.push({
|
|
269
|
-
messageType: RichSubMessageType.INLINE_IMAGE,
|
|
270
|
-
imageMetadata: {
|
|
271
|
-
imageUrl: { imagePreviewUrl: imageUrl, imageHighResUrl: imageUrl },
|
|
272
|
-
imageText: expr.latexExpression,
|
|
273
|
-
alignment: 2
|
|
274
|
-
}
|
|
275
|
-
});
|
|
276
|
-
void width;
|
|
277
|
-
void height;
|
|
278
|
-
}
|
|
279
|
-
if (footer) {
|
|
280
|
-
submessages.push({ messageType: RichSubMessageType.TEXT, messageText: footer });
|
|
281
|
-
}
|
|
282
|
-
const ctxInfo = buildRichContextInfo(quoted);
|
|
283
|
-
return { message: buildBotForwardedMessage(submessages, ctxInfo), messageId: generateMessageIDV2() };
|
|
284
|
-
};
|
|
285
|
-
export const captureUnifiedResponse = (msg) => {
|
|
286
|
-
const botFwd = msg?.botForwardedMessage?.message;
|
|
287
|
-
if (!botFwd) {
|
|
288
|
-
return null;
|
|
289
|
-
}
|
|
290
|
-
const rich = botFwd.richResponseMessage;
|
|
291
|
-
if (!rich?.unifiedResponse?.data) {
|
|
292
|
-
return null;
|
|
293
|
-
}
|
|
294
|
-
return {
|
|
295
|
-
unifiedResponse: { data: rich.unifiedResponse.data },
|
|
296
|
-
submessages: rich.submessages || [],
|
|
297
|
-
contextInfo: rich.contextInfo || {}
|
|
298
|
-
};
|
|
299
|
-
};
|
|
300
|
-
export const generateUnifiedResponseContent = (quoted, captured) => {
|
|
301
|
-
const ctxInfo = buildRichContextInfo(quoted);
|
|
302
|
-
return {
|
|
303
|
-
message: buildBotForwardedMessage(captured.submessages, ctxInfo, captured.unifiedResponse),
|
|
304
|
-
messageId: generateMessageIDV2()
|
|
305
|
-
};
|
|
306
|
-
};
|
|
307
|
-
export const generateRichMessageContent = (submessages, quoted) => {
|
|
308
|
-
const ctxInfo = buildRichContextInfo(quoted);
|
|
309
|
-
return { message: buildBotForwardedMessage(submessages, ctxInfo), messageId: generateMessageIDV2() };
|
|
310
|
-
};
|
|
311
|
-
//# sourceMappingURL=message-composer.js.map
|