amiudmodz 6.2.6 → 6.2.9
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/Defaults/index.d.ts.map +1 -1
- package/lib/Signal/libsignal.d.ts.map +1 -1
- package/lib/Signal/libsignal.js.map +1 -1
- package/lib/Signal/lid-mapping.d.ts.map +1 -1
- package/lib/Signal/lid-mapping.js.map +1 -1
- package/lib/Socket/Client/types.d.ts.map +1 -1
- package/lib/Socket/Client/websocket.js.map +1 -1
- package/lib/Socket/business.d.ts +9 -27
- package/lib/Socket/business.d.ts.map +1 -1
- package/lib/Socket/business.js.map +1 -1
- package/lib/Socket/chats.d.ts +16 -13
- package/lib/Socket/chats.d.ts.map +1 -1
- package/lib/Socket/chats.js +1 -10
- package/lib/Socket/chats.js.map +1 -1
- package/lib/Socket/communities.d.ts +53 -71
- package/lib/Socket/communities.d.ts.map +1 -1
- package/lib/Socket/communities.js.map +1 -1
- package/lib/Socket/groups.d.ts +29 -25
- package/lib/Socket/groups.d.ts.map +1 -1
- package/lib/Socket/groups.js.map +1 -1
- package/lib/Socket/index.d.ts.map +1 -1
- package/lib/Socket/index.js +29 -14
- package/lib/Socket/index.js.map +1 -1
- package/lib/Socket/messages-recv.d.ts +45 -63
- package/lib/Socket/messages-recv.d.ts.map +1 -1
- package/lib/Socket/messages-recv.js.map +1 -1
- package/lib/Socket/messages-send.d.ts +47 -65
- package/lib/Socket/messages-send.d.ts.map +1 -1
- package/lib/Socket/messages-send.js +85 -280
- package/lib/Socket/messages-send.js.map +1 -1
- package/lib/Socket/mex.d.ts.map +1 -1
- package/lib/Socket/mex.js.map +1 -1
- package/lib/Socket/newsletter.d.ts +5 -1
- package/lib/Socket/newsletter.d.ts.map +1 -1
- package/lib/Socket/newsletter.js.map +1 -1
- package/lib/Socket/socket.d.ts +8 -8
- package/lib/Socket/socket.d.ts.map +1 -1
- package/lib/Socket/socket.js +1 -1
- package/lib/Socket/socket.js.map +1 -1
- package/lib/Types/Bussines.d.ts +1 -1
- package/lib/Types/Bussines.d.ts.map +1 -1
- package/lib/Types/Message.d.ts +1 -13
- package/lib/Types/Message.d.ts.map +1 -1
- package/lib/Types/Message.js.map +1 -1
- package/lib/Types/USync.d.ts.map +1 -1
- package/lib/Types/USync.js.map +1 -1
- package/lib/Types/index.d.ts.map +1 -1
- package/lib/Types/index.js.map +1 -1
- package/lib/Utils/MessageBuilder.d.ts +0 -1
- package/lib/Utils/MessageBuilder.d.ts.map +1 -1
- package/lib/Utils/MessageBuilder.js +0 -11
- package/lib/Utils/MessageBuilder.js.map +1 -1
- package/lib/Utils/auth-utils.d.ts.map +1 -1
- package/lib/Utils/auth-utils.js.map +1 -1
- package/lib/Utils/baileys-event-stream.js +0 -0
- package/lib/Utils/browser-utils.d.ts.map +1 -1
- package/lib/Utils/business.d.ts.map +1 -1
- package/lib/Utils/business.js.map +1 -1
- package/lib/Utils/chat-utils.d.ts.map +1 -1
- package/lib/Utils/chat-utils.js.map +1 -1
- package/lib/Utils/companion-reg-client-utils.d.ts.map +1 -1
- 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.map +1 -1
- package/lib/Utils/decode-wa-message.js.map +1 -1
- package/lib/Utils/event-buffer.d.ts.map +1 -1
- package/lib/Utils/event-buffer.js.map +1 -1
- package/lib/Utils/generics.d.ts.map +1 -1
- package/lib/Utils/generics.js.map +1 -1
- package/lib/Utils/history.d.ts.map +1 -1
- package/lib/Utils/history.js.map +1 -1
- package/lib/Utils/identity-change-handler.d.ts.map +1 -1
- package/lib/Utils/identity-change-handler.js.map +1 -1
- package/lib/Utils/index.d.ts +0 -1
- package/lib/Utils/index.d.ts.map +1 -1
- package/lib/Utils/index.js +0 -1
- package/lib/Utils/index.js.map +1 -1
- package/lib/Utils/link-preview.d.ts.map +1 -1
- package/lib/Utils/messages-media.d.ts.map +1 -1
- package/lib/Utils/messages-media.js.map +1 -1
- package/lib/Utils/messages.d.ts +1 -1
- package/lib/Utils/messages.d.ts.map +1 -1
- package/lib/Utils/messages.js +0 -97
- package/lib/Utils/messages.js.map +1 -1
- package/lib/Utils/noise-handler.d.ts.map +1 -1
- package/lib/Utils/noise-handler.js.map +1 -1
- package/lib/Utils/offline-node-processor.d.ts.map +1 -1
- package/lib/Utils/pre-key-manager.d.ts.map +1 -1
- package/lib/Utils/process-message.d.ts.map +1 -1
- package/lib/Utils/process-message.js.map +1 -1
- package/lib/Utils/reporting-utils.d.ts.map +1 -1
- package/lib/Utils/rich-message-utils.js.map +1 -1
- package/lib/Utils/shortcake-crypto.d.ts.map +1 -1
- package/lib/Utils/shortcake.d.ts.map +1 -1
- package/lib/Utils/shortcake.js.map +1 -1
- package/lib/Utils/signal.d.ts.map +1 -1
- package/lib/Utils/signal.js.map +1 -1
- package/lib/Utils/stanza-ack.d.ts.map +1 -1
- package/lib/Utils/sync-action-utils.d.ts.map +1 -1
- package/lib/Utils/sync-action-utils.js.map +1 -1
- package/lib/Utils/tc-token-utils.d.ts.map +1 -1
- package/lib/Utils/tc-token-utils.js.map +1 -1
- package/lib/Utils/use-multi-file-auth-state.d.ts.map +1 -1
- package/lib/Utils/use-single-file-auth-state.d.ts.map +1 -1
- package/lib/Utils/use-single-file-auth-state.js.map +1 -1
- package/lib/Utils/use-sqlite-auth-state.d.ts.map +1 -1
- package/lib/Utils/validate-connection.d.ts.map +1 -1
- package/lib/Utils/validate-connection.js.map +1 -1
- package/lib/VoIP/audio-feeder.d.ts +54 -0
- package/lib/VoIP/audio-feeder.d.ts.map +1 -0
- package/lib/VoIP/audio-feeder.js +269 -0
- package/lib/VoIP/audio-feeder.js.map +1 -0
- package/lib/VoIP/index.d.ts +108 -0
- package/lib/VoIP/index.d.ts.map +1 -0
- package/lib/VoIP/index.js +920 -0
- package/lib/VoIP/index.js.map +1 -0
- package/lib/VoIP/relay-transport.d.ts +42 -0
- package/lib/VoIP/relay-transport.d.ts.map +1 -0
- package/lib/VoIP/relay-transport.js +652 -0
- package/lib/VoIP/relay-transport.js.map +1 -0
- package/lib/VoIP/signaling.d.ts +71 -0
- package/lib/VoIP/signaling.d.ts.map +1 -0
- package/lib/VoIP/signaling.js +1046 -0
- package/lib/VoIP/signaling.js.map +1 -0
- package/lib/VoIP/types.d.ts +13 -0
- package/lib/VoIP/types.d.ts.map +1 -0
- package/lib/VoIP/types.js +13 -0
- package/lib/VoIP/types.js.map +1 -0
- package/lib/VoIP/video-feeder.d.ts +53 -0
- package/lib/VoIP/video-feeder.d.ts.map +1 -0
- package/lib/VoIP/video-feeder.js +269 -0
- package/lib/VoIP/video-feeder.js.map +1 -0
- package/lib/VoIP/wasm-engine.d.ts +36 -0
- package/lib/VoIP/wasm-engine.d.ts.map +1 -0
- package/lib/VoIP/wasm-engine.js +1364 -0
- package/lib/VoIP/wasm-engine.js.map +1 -0
- package/lib/VoIP/worker-bootstrap.d.ts +2 -0
- package/lib/VoIP/worker-bootstrap.d.ts.map +1 -0
- package/lib/VoIP/worker-bootstrap.js +1023 -0
- package/lib/VoIP/worker-bootstrap.js.map +1 -0
- package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts.map +1 -1
- package/lib/WAUSync/Protocols/USyncContactProtocol.js.map +1 -1
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts.map +1 -1
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js.map +1 -1
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts.map +1 -1
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js.map +1 -1
- package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts.map +1 -1
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js.map +1 -1
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.d.ts.map +1 -1
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.js.map +1 -1
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts.map +1 -1
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js.map +1 -1
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts.map +1 -1
- package/lib/WAUSync/USyncQuery.d.ts.map +1 -1
- package/lib/WAUSync/USyncQuery.js.map +1 -1
- package/lib/assets/wasm/README.md +76 -0
- package/lib/assets/wasm/loader.d.ts +2 -0
- package/lib/assets/wasm/loader.d.ts.map +1 -0
- package/lib/assets/wasm/loader.js +1866 -0
- package/lib/assets/wasm/loader.js.map +1 -0
- package/lib/assets/wasm/whatsapp.wasm +0 -0
- package/lib/assets/wasm/worker-modules.d.ts +2 -0
- package/lib/assets/wasm/worker-modules.d.ts.map +1 -0
- package/lib/assets/wasm/worker-modules.js +11038 -0
- package/lib/assets/wasm/worker-modules.js.map +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js.map +1 -1
- package/package.json +146 -142
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import crypto from 'crypto';
|
|
2
1
|
import NodeCache from '@cacheable/node-cache';
|
|
3
2
|
import { Boom } from '@hapi/boom';
|
|
3
|
+
import crypto from 'crypto';
|
|
4
4
|
import { proto } from '../../WAProto/index.js';
|
|
5
5
|
import { BIZ_BOT_SUPPORT_PAYLOAD, DEFAULT_CACHE_TTLS, WA_DEFAULT_EPHEMERAL } from '../Defaults/index.js';
|
|
6
6
|
import { aggregateMessageKeysNotFromMe, assertMediaContent, assertMeId, bindWaitForEvent, decryptMediaRetryData, DEF_MEDIA_HOST, encodeNewsletterMessage, encodeSignedDeviceIdentity, encodeWAMessage, encryptMediaRetryRequest, extractDeviceJids, generateMessageIDV2, generateParticipantHashV2, generateWAMessage, getStatusCodeForMediaRetry, getUrlFromDirectPath, getWAUploadToServer, MessageRetryManager, normalizeMessageContent, shouldIncludeBizBinaryNode, parseAndInjectE2ESessions, unixTimestampSeconds } from '../Utils/index.js';
|
|
@@ -16,25 +16,16 @@ export const makeMessagesSocket = (config) => {
|
|
|
16
16
|
const sock = makeNewsletterSocket(config);
|
|
17
17
|
const { ev, authState, messageMutex, signalRepository, upsertMessage, query, fetchPrivacySettings, sendNode, groupMetadata, groupToggleEphemeral, registerSocketEndHandler } = sock;
|
|
18
18
|
const getLIDForPN = signalRepository.lidMapping.getLIDForPN.bind(signalRepository.lidMapping);
|
|
19
|
-
/**
|
|
20
|
-
* Set of tctoken storage JIDs with a fire-and-forget `issuePrivacyTokens` IQ in flight.
|
|
21
|
-
* Prevents duplicate IQs from rapid back-to-back sends before `senderTimestamp` persists.
|
|
22
|
-
* Entries are always removed in `.finally()`, so the set is bounded by concurrency.
|
|
23
|
-
*/
|
|
24
19
|
const inFlightTcTokenIssuance = new Set();
|
|
25
20
|
const userDevicesCache = config.userDevicesCache ||
|
|
26
21
|
new NodeCache({
|
|
27
|
-
stdTTL: DEFAULT_CACHE_TTLS.USER_DEVICES,
|
|
22
|
+
stdTTL: DEFAULT_CACHE_TTLS.USER_DEVICES,
|
|
28
23
|
useClones: false
|
|
29
24
|
});
|
|
30
|
-
/** Serializes writes to userDevicesCache across USync refresh and device-notification handling. */
|
|
31
25
|
const devicesMutex = makeMutex();
|
|
32
|
-
// Initialize message retry manager if enabled
|
|
33
26
|
const messageRetryManager = enableRecentMessageCache ? new MessageRetryManager(logger, maxMsgRetryCount) : null;
|
|
34
|
-
// Prevent race conditions in Signal session encryption by user
|
|
35
27
|
const encryptionMutex = makeKeyedMutex();
|
|
36
28
|
let mediaConn;
|
|
37
|
-
/** Per-socket media host; updated whenever media_conn is fetched. Defaults to the public WhatsApp host. */
|
|
38
29
|
let mediaHost = DEF_MEDIA_HOST;
|
|
39
30
|
const refreshMediaConn = async (forceGet = false) => {
|
|
40
31
|
const media = await mediaConn;
|
|
@@ -68,10 +59,6 @@ export const makeMessagesSocket = (config) => {
|
|
|
68
59
|
}
|
|
69
60
|
return mediaConn;
|
|
70
61
|
};
|
|
71
|
-
/**
|
|
72
|
-
* generic send receipt function
|
|
73
|
-
* used for receipts of phone call, read, delivery etc.
|
|
74
|
-
* */
|
|
75
62
|
const sendReceipt = async (jid, participant, messageIds, type) => {
|
|
76
63
|
if (!messageIds || messageIds.length === 0) {
|
|
77
64
|
throw new Boom('missing ids in receipt');
|
|
@@ -115,20 +102,17 @@ export const makeMessagesSocket = (config) => {
|
|
|
115
102
|
logger.debug({ attrs: node.attrs, messageIds }, 'sending receipt for messages');
|
|
116
103
|
await sendNode(node);
|
|
117
104
|
};
|
|
118
|
-
/** Correctly bulk send receipts to multiple chats, participants */
|
|
119
105
|
const sendReceipts = async (keys, type) => {
|
|
120
106
|
const recps = aggregateMessageKeysNotFromMe(keys);
|
|
121
107
|
for (const { jid, participant, messageIds } of recps) {
|
|
122
108
|
await sendReceipt(jid, participant, messageIds, type);
|
|
123
109
|
}
|
|
124
110
|
};
|
|
125
|
-
/** Bulk read messages. Keys can be from different chats & participants */
|
|
126
111
|
const readMessages = async (keys) => {
|
|
127
112
|
const privacySettings = await fetchPrivacySettings();
|
|
128
113
|
const readType = privacySettings.readreceipts === 'all' ? 'read' : 'read-self';
|
|
129
114
|
await sendReceipts(keys, readType);
|
|
130
115
|
};
|
|
131
|
-
/** Fetch all the devices we've to send a message to */
|
|
132
116
|
const getUSyncDevices = async (jids, useCache, ignoreZeroDevices) => {
|
|
133
117
|
const deviceResults = [];
|
|
134
118
|
if (!useCache) {
|
|
@@ -262,9 +246,6 @@ export const makeMessagesSocket = (config) => {
|
|
|
262
246
|
}
|
|
263
247
|
return deviceResults;
|
|
264
248
|
};
|
|
265
|
-
/**
|
|
266
|
-
* Update Member Label
|
|
267
|
-
*/
|
|
268
249
|
const updateMemberLabel = (jid, memberLabel) => {
|
|
269
250
|
return relayMessage(jid, {
|
|
270
251
|
protocolMessage: {
|
|
@@ -866,7 +847,7 @@ export const makeMessagesSocket = (config) => {
|
|
|
866
847
|
const normalizedMessage = normalizeMessageContent(message);
|
|
867
848
|
if (!normalizedMessage)
|
|
868
849
|
return 'text';
|
|
869
|
-
//
|
|
850
|
+
// Interactive Meta HTML payloads must route through 'text' envelope stanzas on WhatsApp's wire
|
|
870
851
|
if (normalizedMessage.botForwardedMessage || normalizedMessage.richResponseMessage) {
|
|
871
852
|
return 'text';
|
|
872
853
|
}
|
|
@@ -937,6 +918,9 @@ export const makeMessagesSocket = (config) => {
|
|
|
937
918
|
else if (innerMsg.interactiveResponseMessage) {
|
|
938
919
|
return 'native_flow_response';
|
|
939
920
|
}
|
|
921
|
+
else if (innerMsg.richResponseMessage || message.botForwardedMessage) {
|
|
922
|
+
return 'rich_response';
|
|
923
|
+
}
|
|
940
924
|
else if (innerMsg.commentMessage) {
|
|
941
925
|
return 'comment';
|
|
942
926
|
}
|
|
@@ -954,6 +938,76 @@ export const makeMessagesSocket = (config) => {
|
|
|
954
938
|
}
|
|
955
939
|
return '';
|
|
956
940
|
};
|
|
941
|
+
/**
|
|
942
|
+
* First-class HTML / Canvas Message Relaying Helper
|
|
943
|
+
*/
|
|
944
|
+
const sendHTML = async (jid, htmlPayload, options = {}) => {
|
|
945
|
+
const response_id = crypto.randomUUID();
|
|
946
|
+
const title = options.title || 'THENUX Interactive';
|
|
947
|
+
const trusted_sources = options.trustedSources || ['thenuxofc.store', 'nixel.dev'];
|
|
948
|
+
const htmlEnvelope = {
|
|
949
|
+
messageContextInfo: {
|
|
950
|
+
deviceListMetadata: {},
|
|
951
|
+
deviceListMetadataVersion: 2,
|
|
952
|
+
botMetadata: {
|
|
953
|
+
messageDisclaimerText: '',
|
|
954
|
+
botResponseId: crypto.randomUUID(),
|
|
955
|
+
verificationMetadata: {
|
|
956
|
+
proofs: [
|
|
957
|
+
{
|
|
958
|
+
version: 1,
|
|
959
|
+
useCase: 1,
|
|
960
|
+
signature: Buffer.from('TklYRUwuTWVzc2FnZUJ1aWxkZXJWNC43LVZlcmlmaWNhdGlvblNpZ25hdHVyZS5NZXRhZGF0YeN55YRyad2+ZA==', 'base64'),
|
|
961
|
+
certificateChain: [
|
|
962
|
+
Buffer.from('TklYRUwuTWVzc2FnZUJ1aWxkZXJWNC43LUNl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
+
}
|
|
968
|
+
}
|
|
969
|
+
},
|
|
970
|
+
botForwardedMessage: {
|
|
971
|
+
message: {
|
|
972
|
+
richResponseMessage: {
|
|
973
|
+
messageType: 1,
|
|
974
|
+
submessages: [
|
|
975
|
+
{
|
|
976
|
+
messageType: 2,
|
|
977
|
+
messageText: title
|
|
978
|
+
}
|
|
979
|
+
],
|
|
980
|
+
unifiedResponse: {
|
|
981
|
+
data: Buffer.from(JSON.stringify({
|
|
982
|
+
response_id,
|
|
983
|
+
sections: [
|
|
984
|
+
{
|
|
985
|
+
view_model: {
|
|
986
|
+
primitive: {
|
|
987
|
+
__typename: 'GenAIaeacdsnwHtmlPrimitive',
|
|
988
|
+
payload: htmlPayload,
|
|
989
|
+
trusted_sources
|
|
990
|
+
},
|
|
991
|
+
__typename: 'GenAISingleLayoutViewModel'
|
|
992
|
+
}
|
|
993
|
+
}
|
|
994
|
+
]
|
|
995
|
+
}))
|
|
996
|
+
},
|
|
997
|
+
contextInfo: {
|
|
998
|
+
forwardingScore: 1,
|
|
999
|
+
isForwarded: true,
|
|
1000
|
+
forwardedAiBotMessageInfo: {
|
|
1001
|
+
botJid: '867051314767696@bot'
|
|
1002
|
+
},
|
|
1003
|
+
forwardOrigin: 4
|
|
1004
|
+
}
|
|
1005
|
+
}
|
|
1006
|
+
}
|
|
1007
|
+
}
|
|
1008
|
+
};
|
|
1009
|
+
return await relayMessage(jid, htmlEnvelope, {});
|
|
1010
|
+
};
|
|
957
1011
|
const issuePrivacyTokens = async (jids, timestamp) => {
|
|
958
1012
|
const t = (timestamp ?? unixTimestampSeconds()).toString();
|
|
959
1013
|
const result = await query({
|
|
@@ -1010,6 +1064,7 @@ export const makeMessagesSocket = (config) => {
|
|
|
1010
1064
|
getUSyncDevices,
|
|
1011
1065
|
messageRetryManager,
|
|
1012
1066
|
updateMemberLabel,
|
|
1067
|
+
sendHTML,
|
|
1013
1068
|
updateMediaMessage: async (message) => {
|
|
1014
1069
|
const content = assertMediaContent(message.message);
|
|
1015
1070
|
const mediaKey = content.mediaKey;
|
|
@@ -1052,266 +1107,16 @@ export const makeMessagesSocket = (config) => {
|
|
|
1052
1107
|
ev.emit('messages.update', [{ key: message.key, update: { message: message.message } }]);
|
|
1053
1108
|
return message;
|
|
1054
1109
|
},
|
|
1055
|
-
menurich: async (jid, options) => {
|
|
1056
|
-
const responseId = crypto.randomUUID();
|
|
1057
|
-
const botResponseId = crypto.randomUUID();
|
|
1058
|
-
const title = options.title;
|
|
1059
|
-
const sections = [
|
|
1060
|
-
{
|
|
1061
|
-
view_model: {
|
|
1062
|
-
primitive: {
|
|
1063
|
-
__typename: 'FOATextPrimitive',
|
|
1064
|
-
text: title
|
|
1065
|
-
},
|
|
1066
|
-
__typename: 'GenAISingleLayoutViewModel'
|
|
1067
|
-
}
|
|
1068
|
-
}
|
|
1069
|
-
];
|
|
1070
|
-
if (options.subtitle) {
|
|
1071
|
-
sections.push({
|
|
1072
|
-
view_model: {
|
|
1073
|
-
primitive: {
|
|
1074
|
-
__typename: 'GenAIMarkdownTextUXPrimitive',
|
|
1075
|
-
text: options.subtitle
|
|
1076
|
-
},
|
|
1077
|
-
__typename: 'GenAISingleLayoutViewModel'
|
|
1078
|
-
}
|
|
1079
|
-
});
|
|
1080
|
-
}
|
|
1081
|
-
if (options.imageUrl) {
|
|
1082
|
-
sections.push({
|
|
1083
|
-
view_model: {
|
|
1084
|
-
primitive: {
|
|
1085
|
-
__typename: 'GenAIImagePrimitive',
|
|
1086
|
-
preview_image: {
|
|
1087
|
-
__typename: 'GenAIMediaItem',
|
|
1088
|
-
mime_type: 'image/jpeg',
|
|
1089
|
-
url: options.imageUrl
|
|
1090
|
-
},
|
|
1091
|
-
full_image: {
|
|
1092
|
-
__typename: 'GenAIMediaItem',
|
|
1093
|
-
mime_type: 'image/jpeg',
|
|
1094
|
-
url: options.imageUrl
|
|
1095
|
-
}
|
|
1096
|
-
},
|
|
1097
|
-
__typename: 'GenAISingleLayoutViewModel'
|
|
1098
|
-
}
|
|
1099
|
-
});
|
|
1100
|
-
}
|
|
1101
|
-
if (options.menus && options.menus.length > 0) {
|
|
1102
|
-
let idCounter = 0;
|
|
1103
|
-
const primitives = options.menus.map(menu => {
|
|
1104
|
-
return {
|
|
1105
|
-
__typename: 'GenAI3PExtWidgetPrimitive',
|
|
1106
|
-
header: {
|
|
1107
|
-
__typename: 'GenAI3PExtWidgetStandardHeader',
|
|
1108
|
-
title: menu.title
|
|
1109
|
-
},
|
|
1110
|
-
body: {
|
|
1111
|
-
__typename: 'GenAI3PExtCalendarEventList',
|
|
1112
|
-
sections: [],
|
|
1113
|
-
ctas: menu.buttons.map(btn => {
|
|
1114
|
-
const toolCallId = String(idCounter++).padStart(2, '0');
|
|
1115
|
-
return {
|
|
1116
|
-
__typename: 'GenAI3PExtWidgetCTA',
|
|
1117
|
-
label: btn.label,
|
|
1118
|
-
state: 'PENDING',
|
|
1119
|
-
kind: 'OTHER',
|
|
1120
|
-
tool_call_id: toolCallId,
|
|
1121
|
-
toast: btn.toast ? {
|
|
1122
|
-
__typename: 'GenAI3PExtWidgetToast',
|
|
1123
|
-
label: btn.toast
|
|
1124
|
-
} : undefined
|
|
1125
|
-
};
|
|
1126
|
-
})
|
|
1127
|
-
}
|
|
1128
|
-
};
|
|
1129
|
-
});
|
|
1130
|
-
sections.push({
|
|
1131
|
-
view_model: {
|
|
1132
|
-
primitives,
|
|
1133
|
-
__typename: 'GenAIHScrollLayoutViewModel'
|
|
1134
|
-
}
|
|
1135
|
-
});
|
|
1136
|
-
}
|
|
1137
|
-
if (options.footerLinks && options.footerLinks.length > 0) {
|
|
1138
|
-
const primitives = options.footerLinks.map(link => {
|
|
1139
|
-
return {
|
|
1140
|
-
__typename: 'GenAIFooterActionPrimitive',
|
|
1141
|
-
cta_text: link.label,
|
|
1142
|
-
cta_type: 'OPEN_URL',
|
|
1143
|
-
cta_url: link.url
|
|
1144
|
-
};
|
|
1145
|
-
});
|
|
1146
|
-
sections.push({
|
|
1147
|
-
view_model: {
|
|
1148
|
-
primitives,
|
|
1149
|
-
__typename: 'GenAIHScrollLayoutViewModel'
|
|
1150
|
-
}
|
|
1151
|
-
});
|
|
1152
|
-
}
|
|
1153
|
-
const unifiedResponse = {
|
|
1154
|
-
response_id: responseId,
|
|
1155
|
-
sections
|
|
1156
|
-
};
|
|
1157
|
-
const signatureRaw = 'TklYRUwuTWVzc2FnZUJ1aWxkZXJWNC43LVZlcmlmaWNhdGlvblNpZ25hdHVyZS5NZXRhZGF0YeN55YRyad2+ZA==';
|
|
1158
|
-
const signature = Buffer.from(Buffer.from(signatureRaw, 'base64').toString('binary').replace('NIXEL', 'UDMODZ'), 'binary').toString('base64');
|
|
1159
|
-
const certificateChainRaw = [
|
|
1160
|
-
'TklYRUwuTWVzc2FnZUJ1aWxkZXJWNC43LUNlcnRpZmljYXRlQ2hhaW4uTWV0YWRhdGEOvtJr968bbpKdZreOTwkk9aPN++XPE60RfuzNLkXXc7LE8BOkJOWRpo2oNXaRJ3uCNJ43HY3A+oetnvHSfcxWqmvvTSrBOI5V1NOD6RMsZ/st1XVPUx83AGps1l5jYBOYzqMNy6un2tToJ2Bt9bXRo29tWLZTu8m7TNY/hISwVpVc5tjSet5U7btPN+dMIx2UvykB1jcbWGsdklheeuz8RXSStNXzeaGvsf1lpZ/ugLE4b2BdmlRNKrY6zLE4qFtRYQoS7axOyQX+4QUyN2m9bfm7urQmn+QRSXJwMO7X5kAJJLbkVGJFt9Pm9VXPwQVrK2aaqiXlpusj+7DfDw00OULmYMmZDTqXM0nUVLxj13z0LhMQoQhhNG8utdUn4uKOFceliTZ/xiP+A54GnX9620641bqw3ctfh9NNXPsTEK8hAUD7FDqUhVntHmoEYYEHq8X1tHHZYP49/f2iezTiE8AUaoZo42/jIWQIKohOGNUib2hEqMkW8NsR8vPihvNuqPc0zKZcl6359YFQdjiiW8kCRD/rsDOr9v1eYLFZKYloFyzFqEgj+jcG/V47elOjShJ5CCPwatXwP6HIloVwtgygFsnOFmCg6Ojoivfo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fctBNDhTwaC5QMi0P9wjU5XI9SBtkdQLizc5oqpoiHeqgb8+aJHVLcbgIJ/KLZKtRWFDfzRNM02Csx4etUUapVd2NA/L0oMs/O5T9sVj9FBJ7q99GWr3PVmxJb36mHZLXC4k1gGN9swE0LtzYsUdT5tUo9ri/hS3W/SM+F1p4Kh4QIgRcG3ciIHGN44bnDh3HDCz0fDnzKYw0bclMxZPctEyJ5gEOPF6OAkjD9dEaRGq/tEPf1k9Aub+v2dEjnfrYWAm4E5Zfhs2Xh0CT0k+SzhgKd0K/46ChJ20G5+blwpIvahvTVS68+aVIX6CwXs4tcVx6FnmVsMOOkIasfaqQLZYbNBkuLoZnQAq4j8yRekrQ=='
|
|
1162
|
-
];
|
|
1163
|
-
const certificateChain = certificateChainRaw.map((cert) => typeof cert === 'string'
|
|
1164
|
-
? Buffer.from(Buffer.from(cert, 'base64').toString('binary').replace('NIXEL', 'UDMODZ'), 'binary').toString('base64')
|
|
1165
|
-
: cert);
|
|
1166
|
-
const message = {
|
|
1167
|
-
messageContextInfo: {
|
|
1168
|
-
deviceListMetadata: {},
|
|
1169
|
-
deviceListMetadataVersion: 2,
|
|
1170
|
-
botMetadata: {
|
|
1171
|
-
messageDisclaimerText: '',
|
|
1172
|
-
botResponseId,
|
|
1173
|
-
verificationMetadata: {
|
|
1174
|
-
proofs: [
|
|
1175
|
-
{
|
|
1176
|
-
version: 1,
|
|
1177
|
-
useCase: 1,
|
|
1178
|
-
signature: typeof signature === 'string' ? Buffer.from(signature, 'base64') : signature,
|
|
1179
|
-
certificateChain: certificateChain.map(cert => typeof cert === 'string' ? Buffer.from(cert, 'base64') : cert)
|
|
1180
|
-
}
|
|
1181
|
-
]
|
|
1182
|
-
}
|
|
1183
|
-
}
|
|
1184
|
-
},
|
|
1185
|
-
botForwardedMessage: {
|
|
1186
|
-
message: {
|
|
1187
|
-
richResponseMessage: {
|
|
1188
|
-
messageType: 1,
|
|
1189
|
-
submessages: [
|
|
1190
|
-
{
|
|
1191
|
-
messageType: 2,
|
|
1192
|
-
messageText: title
|
|
1193
|
-
}
|
|
1194
|
-
],
|
|
1195
|
-
unifiedResponse: {
|
|
1196
|
-
data: Buffer.from(JSON.stringify(unifiedResponse))
|
|
1197
|
-
},
|
|
1198
|
-
contextInfo: {
|
|
1199
|
-
forwardingScore: 1,
|
|
1200
|
-
isForwarded: true,
|
|
1201
|
-
forwardedAiBotMessageInfo: {
|
|
1202
|
-
botJid: '867051314767696@bot'
|
|
1203
|
-
},
|
|
1204
|
-
forwardOrigin: 4
|
|
1205
|
-
}
|
|
1206
|
-
}
|
|
1207
|
-
}
|
|
1208
|
-
}
|
|
1209
|
-
};
|
|
1210
|
-
const msgId = generateMessageIDV2(sock.user?.id);
|
|
1211
|
-
await relayMessage(jid, message, { messageId: msgId });
|
|
1212
|
-
return msgId;
|
|
1213
|
-
},
|
|
1214
|
-
sendHtmlGame: async (jid, htmlPayload, options = {}) => {
|
|
1215
|
-
const responseId = options.responseId || crypto.randomUUID();
|
|
1216
|
-
const botResponseId = options.botResponseId || crypto.randomUUID();
|
|
1217
|
-
const title = options.title || 'UDMODZ';
|
|
1218
|
-
const trustedSources = options.trustedSources || ['udmodz.dev'];
|
|
1219
|
-
const botJid = options.botJid || '867051314767696@bot';
|
|
1220
|
-
const signatureRaw = options.signature || 'TklYRUwuTWVzc2FnZUJ1aWxkZXJWNC43LVZlcmlmaWNhdGlvblNpZ25hdHVyZS5NZXRhZGF0YeN55YRyad2+ZA==';
|
|
1221
|
-
const signature = Buffer.from(Buffer.from(signatureRaw, 'base64').toString('binary').replace('NIXEL', 'UDMODZ'), 'binary').toString('base64');
|
|
1222
|
-
const certificateChainRaw = options.certificateChain || [
|
|
1223
|
-
'TklYRUwuTWVzc2FnZUJ1aWxkZXJWNC43LUNlcnRpZmljYXRlQ2hhaW4uTWV0YWRhdGEOvtJr968bbpKdZreOTwkk9aPN++XPE60RfuzNLkXXc7LE8BOkJOWRpo2oNXaRJ3uCNJ43HY3A+oetnvHSfcx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k57/+OYoU5zzTaEgLhyvNFHSyAlyLQ3SGFtVHAaJZHSmmSPyJowCOB+92Gkk6SWVMsk6FbU8QJWFtlhzV/W/gZ7WzUlS/AKgN0th9/cup2ToFkW7X9c+rtYavufmuieqFhXgaMD8AGsoN9QC/HzNC9D1nydPfFYEUr9BHVy2nF5gM58Y59r*+TRf6S4P7BWAl5gh5CJ6ZBrwcaKXZqcSjEwm52MqVCgYZdapAaNYUy/QndttjLOG0wxxwuX1hIhMjPnIKZR1kwnqD5EqlHpilrnojRZvjVGN4zEKmilS8rNstt4HHs/D849W+Q6LRVWiWMs0cT2IugrX+Skxd8En7Gq52UEmuVBrSTpN+UpIu20NsVb9lsvuYh3XO441606tOEY2eKcZJdTtqrOTNqbbTk0zVn1yhbOCvmfctBNDhTwaC5QMi0P9wjU5XI9SBtkdQLizc5oqpoiHeqgb8+aJHVLcbgIJ/KLZKtRWFDfzRNM02Csx4etUUapVd2NA/L0oMs/O5T9sVj9FBJ7q99GWr3PVmxJb36mHZLXC4k1gGN9swE0LtzYsUdT5tUo9ri/hS3W/SM+F1p4Kh4QIgRcG3ciIHGN44bnDh3HDCz0fDnzKYw0bclMxZPctEyJ5gEOPF6OAkjD9dEaRGq/tEPf1k9Aub+v2dEjnfrYWAm4E5Zfhs2Xh0CT0k+SzhgKd0K/46ChJ20G5+blwpIvahvTVS68+aVIX6CwXs4tcVx6FnmVsMOOkIasfaqQLZYbNBkuLoZnQAq4j8yRekrQ=='
|
|
1225
|
-
];
|
|
1226
|
-
const certificateChain = certificateChainRaw.map((cert) => typeof cert === 'string'
|
|
1227
|
-
? Buffer.from(Buffer.from(cert, 'base64').toString('binary').replace('NIXEL', 'UDMODZ'), 'binary').toString('base64')
|
|
1228
|
-
: cert);
|
|
1229
|
-
const sections = [
|
|
1230
|
-
{
|
|
1231
|
-
view_model: {
|
|
1232
|
-
primitive: {
|
|
1233
|
-
__typename: 'FOATextPrimitive',
|
|
1234
|
-
text: title
|
|
1235
|
-
},
|
|
1236
|
-
__typename: 'GenAISingleLayoutViewModel'
|
|
1237
|
-
}
|
|
1238
|
-
}
|
|
1239
|
-
];
|
|
1240
|
-
if (options.subtitle) {
|
|
1241
|
-
sections.push({
|
|
1242
|
-
view_model: {
|
|
1243
|
-
primitive: {
|
|
1244
|
-
__typename: 'GenAIMarkdownTextUXPrimitive',
|
|
1245
|
-
text: options.subtitle
|
|
1246
|
-
},
|
|
1247
|
-
__typename: 'GenAISingleLayoutViewModel'
|
|
1248
|
-
}
|
|
1249
|
-
});
|
|
1250
|
-
}
|
|
1251
|
-
sections.push({
|
|
1252
|
-
view_model: {
|
|
1253
|
-
primitive: {
|
|
1254
|
-
__typename: 'GenAIaeacdsnwHtmlPrimitive',
|
|
1255
|
-
payload: htmlPayload,
|
|
1256
|
-
trusted_sources: trustedSources
|
|
1257
|
-
},
|
|
1258
|
-
__typename: 'GenAISingleLayoutViewModel'
|
|
1259
|
-
}
|
|
1260
|
-
});
|
|
1261
|
-
const unifiedResponse = {
|
|
1262
|
-
response_id: responseId,
|
|
1263
|
-
sections
|
|
1264
|
-
};
|
|
1265
|
-
const message = {
|
|
1266
|
-
messageContextInfo: {
|
|
1267
|
-
deviceListMetadata: {},
|
|
1268
|
-
deviceListMetadataVersion: 2,
|
|
1269
|
-
botMetadata: {
|
|
1270
|
-
messageDisclaimerText: '',
|
|
1271
|
-
botResponseId,
|
|
1272
|
-
verificationMetadata: {
|
|
1273
|
-
proofs: [
|
|
1274
|
-
{
|
|
1275
|
-
version: 1,
|
|
1276
|
-
useCase: 1,
|
|
1277
|
-
signature: typeof signature === 'string' ? Buffer.from(signature, 'base64') : signature,
|
|
1278
|
-
certificateChain: certificateChain.map(cert => typeof cert === 'string' ? Buffer.from(cert, 'base64') : cert)
|
|
1279
|
-
}
|
|
1280
|
-
]
|
|
1281
|
-
}
|
|
1282
|
-
}
|
|
1283
|
-
},
|
|
1284
|
-
botForwardedMessage: {
|
|
1285
|
-
message: {
|
|
1286
|
-
richResponseMessage: {
|
|
1287
|
-
messageType: 1,
|
|
1288
|
-
submessages: [
|
|
1289
|
-
{
|
|
1290
|
-
messageType: 2,
|
|
1291
|
-
messageText: title
|
|
1292
|
-
}
|
|
1293
|
-
],
|
|
1294
|
-
unifiedResponse: {
|
|
1295
|
-
data: Buffer.from(JSON.stringify(unifiedResponse))
|
|
1296
|
-
},
|
|
1297
|
-
contextInfo: {
|
|
1298
|
-
forwardingScore: 1,
|
|
1299
|
-
isForwarded: true,
|
|
1300
|
-
forwardedAiBotMessageInfo: {
|
|
1301
|
-
botJid
|
|
1302
|
-
},
|
|
1303
|
-
forwardOrigin: 4
|
|
1304
|
-
}
|
|
1305
|
-
}
|
|
1306
|
-
}
|
|
1307
|
-
}
|
|
1308
|
-
};
|
|
1309
|
-
const msgId = generateMessageIDV2(sock.user?.id);
|
|
1310
|
-
await relayMessage(jid, message, { messageId: msgId });
|
|
1311
|
-
return msgId;
|
|
1312
|
-
},
|
|
1313
1110
|
sendMessage: async (jid, content, options = {}) => {
|
|
1314
1111
|
const userJid = authState.creds.me.id;
|
|
1112
|
+
// Direct sendHTML routing when { html: "..." } is passed to sendMessage
|
|
1113
|
+
if (typeof content === 'object' && content && 'html' in content && typeof content.html === 'string') {
|
|
1114
|
+
return await sendHTML(jid, content.html, {
|
|
1115
|
+
title: content.title,
|
|
1116
|
+
trustedSources: content.trustedSources,
|
|
1117
|
+
quoted: options.quoted
|
|
1118
|
+
});
|
|
1119
|
+
}
|
|
1315
1120
|
if (isJidGroup(jid) && typeof content === 'object' && content) {
|
|
1316
1121
|
if (('mentionAll' in content && content.mentionAll) ||
|
|
1317
1122
|
(Array.isArray(content.mentions) && content.mentions.includes('@all')) ||
|