cuki-bailx 1.2.5 → 2.0.7
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/WAProto/AICommon.js +27981 -0
- package/WAProto/AICommon.proto +713 -0
- package/WAProto/Ephemeral.js +295 -0
- package/WAProto/Ephemeral.proto +7 -0
- package/WAProto/GenerateStatics.sh +4 -0
- package/WAProto/WAProto.proto +4775 -0
- package/WAProto/cuki.js +7 -0
- package/WAProto/index.js +56886 -17506
- package/lib/Defaults/baileys-version.json +2 -2
- package/lib/Defaults/index.js +117 -102
- package/lib/Socket/Client/index.js +2 -3
- package/lib/Socket/Client/{web-socket-client.js → websocket.js} +54 -5
- package/lib/Socket/chats.js +97 -90
- package/lib/Socket/groups.js +20 -5
- package/lib/Socket/index.js +2 -2
- package/lib/Socket/messages-recv.js +9 -65
- package/lib/Socket/messages-send.js +612 -286
- package/lib/Socket/newsletter.js +68 -41
- package/lib/Socket/{dugong.js → setup.js} +5 -13
- package/lib/Socket/socket.js +58 -32
- package/lib/Store/index.js +1 -3
- package/lib/Store/make-in-memory-store.js +26 -14
- package/lib/Store/make-ordered-dictionary.js +2 -2
- package/lib/Types/Label.js +1 -1
- package/lib/Types/LabelAssociation.js +1 -1
- package/lib/Types/Message.js +0 -2
- package/lib/Types/Newsletter.js +3 -17
- package/lib/Types/index.js +2 -2
- package/lib/Utils/auth-utils.js +6 -13
- package/lib/Utils/business.js +2 -2
- package/lib/Utils/chat-utils.js +36 -35
- package/lib/Utils/crypto.js +71 -29
- package/lib/Utils/decode-wa-message.js +65 -56
- package/lib/Utils/event-buffer.js +11 -7
- package/lib/Utils/generics.js +73 -23
- package/lib/Utils/history.js +4 -6
- package/lib/Utils/link-preview.js +34 -1
- package/lib/Utils/lt-hash.js +6 -6
- package/lib/Utils/messages-media.js +479 -161
- package/lib/Utils/messages.js +391 -77
- package/lib/Utils/noise-handler.js +19 -23
- package/lib/Utils/signal.js +47 -36
- package/lib/Utils/use-multi-file-auth-state.js +51 -6
- package/lib/Utils/validate-connection.js +94 -66
- package/lib/WABinary/constants.js +1276 -13
- package/lib/WABinary/decode.js +26 -13
- package/lib/WABinary/encode.js +39 -17
- package/lib/WABinary/generic-utils.js +2 -85
- package/lib/WABinary/jid-utils.js +12 -5
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +1 -1
- package/lib/index.js +18 -5
- package/package.json +100 -105
- package/engine-requirements.js +0 -10
- package/lib/Defaults/index.d.ts +0 -53
- package/lib/Defaults/phonenumber-mcc.json +0 -223
- package/lib/Signal/Group/ciphertext-message.d.ts +0 -9
- package/lib/Signal/Group/group-session-builder.d.ts +0 -14
- package/lib/Signal/Group/group_cipher.d.ts +0 -17
- package/lib/Signal/Group/index.d.ts +0 -11
- package/lib/Signal/Group/keyhelper.d.ts +0 -10
- package/lib/Signal/Group/queue-job.d.ts +0 -1
- package/lib/Signal/Group/sender-chain-key.d.ts +0 -13
- package/lib/Signal/Group/sender-key-distribution-message.d.ts +0 -16
- package/lib/Signal/Group/sender-key-message.d.ts +0 -18
- package/lib/Signal/Group/sender-key-name.d.ts +0 -17
- package/lib/Signal/Group/sender-key-record.d.ts +0 -30
- package/lib/Signal/Group/sender-key-state.d.ts +0 -38
- package/lib/Signal/Group/sender-message-key.d.ts +0 -11
- package/lib/Signal/libsignal.d.ts +0 -3
- package/lib/Socket/Client/abstract-socket-client.d.ts +0 -17
- package/lib/Socket/Client/index.d.ts +0 -3
- package/lib/Socket/Client/mobile-socket-client.d.ts +0 -13
- package/lib/Socket/Client/mobile-socket-client.js +0 -65
- package/lib/Socket/Client/web-socket-client.d.ts +0 -12
- package/lib/Socket/business.d.ts +0 -171
- package/lib/Socket/chats.d.ts +0 -80
- package/lib/Socket/dugong.d.ts +0 -219
- package/lib/Socket/groups.d.ts +0 -115
- package/lib/Socket/index.d.ts +0 -173
- package/lib/Socket/messages-recv.d.ts +0 -161
- package/lib/Socket/messages-send.d.ts +0 -149
- package/lib/Socket/newsletter.d.ts +0 -134
- package/lib/Socket/registration.d.ts +0 -267
- package/lib/Socket/registration.js +0 -166
- package/lib/Socket/socket.d.ts +0 -43
- package/lib/Socket/socket.js.bak +0 -630
- package/lib/Socket/usync.d.ts +0 -36
- package/lib/Store/index.d.ts +0 -3
- package/lib/Store/make-cache-manager-store.d.ts +0 -13
- package/lib/Store/make-cache-manager-store.js +0 -83
- package/lib/Store/make-in-memory-store.d.ts +0 -118
- package/lib/Store/make-ordered-dictionary.d.ts +0 -13
- package/lib/Store/object-repository.d.ts +0 -10
- package/lib/Types/Auth.d.ts +0 -110
- package/lib/Types/Call.d.ts +0 -13
- package/lib/Types/Chat.d.ts +0 -102
- package/lib/Types/Contact.d.ts +0 -19
- package/lib/Types/Events.d.ts +0 -157
- package/lib/Types/GroupMetadata.d.ts +0 -55
- package/lib/Types/Label.d.ts +0 -35
- package/lib/Types/LabelAssociation.d.ts +0 -29
- package/lib/Types/Message.d.ts +0 -273
- package/lib/Types/Newsletter.d.ts +0 -92
- package/lib/Types/Product.d.ts +0 -78
- package/lib/Types/Signal.d.ts +0 -57
- package/lib/Types/Socket.d.ts +0 -111
- package/lib/Types/State.d.ts +0 -27
- package/lib/Types/USync.d.ts +0 -25
- package/lib/Types/index.d.ts +0 -57
- package/lib/Utils/auth-utils.d.ts +0 -18
- package/lib/Utils/baileys-event-stream.d.ts +0 -16
- package/lib/Utils/business.d.ts +0 -22
- package/lib/Utils/chat-utils.d.ts +0 -71
- package/lib/Utils/crypto.d.ts +0 -41
- package/lib/Utils/decode-wa-message.d.ts +0 -19
- package/lib/Utils/event-buffer.d.ts +0 -35
- package/lib/Utils/generics.d.ts +0 -92
- package/lib/Utils/history.d.ts +0 -15
- package/lib/Utils/index.d.ts +0 -17
- package/lib/Utils/link-preview.d.ts +0 -21
- package/lib/Utils/logger.d.ts +0 -4
- package/lib/Utils/lt-hash.d.ts +0 -12
- package/lib/Utils/make-mutex.d.ts +0 -7
- package/lib/Utils/messages-media.d.ts +0 -116
- package/lib/Utils/messages.d.ts +0 -77
- package/lib/Utils/noise-handler.d.ts +0 -21
- package/lib/Utils/process-message.d.ts +0 -41
- package/lib/Utils/signal.d.ts +0 -32
- package/lib/Utils/use-multi-file-auth-state.d.ts +0 -13
- package/lib/Utils/validate-connection.d.ts +0 -11
- package/lib/WABinary/constants.d.ts +0 -27
- package/lib/WABinary/decode.d.ts +0 -7
- package/lib/WABinary/encode.d.ts +0 -3
- package/lib/WABinary/generic-utils.d.ts +0 -16
- package/lib/WABinary/index.d.ts +0 -5
- package/lib/WABinary/jid-utils.d.ts +0 -31
- package/lib/WABinary/types.d.ts +0 -18
- package/lib/WAM/BinaryInfo.d.ts +0 -17
- package/lib/WAM/constants.d.ts +0 -38
- package/lib/WAM/encode.d.ts +0 -3
- package/lib/WAM/index.d.ts +0 -3
- package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +0 -9
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +0 -22
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +0 -12
- package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +0 -12
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +0 -25
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +0 -8
- package/lib/WAUSync/Protocols/index.d.ts +0 -4
- package/lib/WAUSync/USyncQuery.d.ts +0 -28
- package/lib/WAUSync/USyncUser.d.ts +0 -12
- package/lib/WAUSync/index.d.ts +0 -3
- package/lib/index.d.ts +0 -12
- package/lib/index.js.bak +0 -48
- /package/lib/Socket/Client/{abstract-socket-client.js → types.js} +0 -0
|
@@ -1,44 +1,47 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
4
|
+
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.makeMessagesSocket = void 0;
|
|
7
|
+
|
|
7
8
|
const boom_1 = require("@hapi/boom");
|
|
8
|
-
const node_cache_1 = __importDefault(require("node-cache"));
|
|
9
|
+
const node_cache_1 = __importDefault(require("@cacheable/node-cache"));
|
|
10
|
+
const crypto_1 = require("crypto");
|
|
9
11
|
const WAProto_1 = require("../../WAProto");
|
|
10
12
|
const Defaults_1 = require("../Defaults");
|
|
11
|
-
const axios_1 = require("axios")
|
|
12
13
|
const Utils_1 = require("../Utils");
|
|
13
14
|
const link_preview_1 = require("../Utils/link-preview");
|
|
14
15
|
const WABinary_1 = require("../WABinary");
|
|
16
|
+
const WAUSync_1 = require("../WAUSync");
|
|
15
17
|
const newsletter_1 = require("./newsletter");
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
+
const izumarii = require("./setup");
|
|
19
|
+
|
|
18
20
|
const makeMessagesSocket = (config) => {
|
|
19
|
-
const {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
const { logger,
|
|
22
|
+
linkPreviewImageThumbnailWidth,
|
|
23
|
+
generateHighQualityLinkPreview,
|
|
24
|
+
options: axiosOptions,
|
|
25
|
+
patchMessageBeforeSending,
|
|
26
|
+
cachedGroupMetadata,
|
|
25
27
|
} = config;
|
|
28
|
+
|
|
26
29
|
const sock = (0, newsletter_1.makeNewsletterSocket)(config);
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
30
|
+
|
|
31
|
+
const {
|
|
32
|
+
ev,
|
|
33
|
+
authState,
|
|
34
|
+
processingMutex,
|
|
35
|
+
signalRepository,
|
|
36
|
+
upsertMessage,
|
|
37
|
+
query,
|
|
38
|
+
fetchPrivacySettings,
|
|
39
|
+
sendNode,
|
|
40
|
+
groupMetadata,
|
|
41
|
+
groupToggleEphemeral,
|
|
39
42
|
} = sock;
|
|
40
43
|
const userDevicesCache = config.userDevicesCache || new node_cache_1.default({
|
|
41
|
-
stdTTL: Defaults_1.DEFAULT_CACHE_TTLS.USER_DEVICES,
|
|
44
|
+
stdTTL: Defaults_1.DEFAULT_CACHE_TTLS.USER_DEVICES, // 5 minutes
|
|
42
45
|
useClones: false
|
|
43
46
|
});
|
|
44
47
|
let mediaConn;
|
|
@@ -74,7 +77,7 @@ const makeMessagesSocket = (config) => {
|
|
|
74
77
|
/**
|
|
75
78
|
* generic send receipt function
|
|
76
79
|
* used for receipts of phone call, read, delivery etc.
|
|
77
|
-
|
|
80
|
+
*/
|
|
78
81
|
const sendReceipt = async (jid, participant, messageIds, type) => {
|
|
79
82
|
const node = {
|
|
80
83
|
tag: 'receipt',
|
|
@@ -97,7 +100,7 @@ const makeMessagesSocket = (config) => {
|
|
|
97
100
|
}
|
|
98
101
|
}
|
|
99
102
|
if (type) {
|
|
100
|
-
node.attrs.type = (0, WABinary_1.
|
|
103
|
+
node.attrs.type = (0, WABinary_1.isJidNewsletter)(jid) ? 'read-self' : type;
|
|
101
104
|
}
|
|
102
105
|
const remainingMessageIds = messageIds.slice(1);
|
|
103
106
|
if (remainingMessageIds.length) {
|
|
@@ -136,66 +139,46 @@ const makeMessagesSocket = (config) => {
|
|
|
136
139
|
if (!useCache) {
|
|
137
140
|
logger.debug('not using cache for devices');
|
|
138
141
|
}
|
|
139
|
-
const
|
|
142
|
+
const toFetch = [];
|
|
140
143
|
jids = Array.from(new Set(jids));
|
|
141
144
|
for (let jid of jids) {
|
|
142
145
|
const user = (_a = (0, WABinary_1.jidDecode)(jid)) === null || _a === void 0 ? void 0 : _a.user;
|
|
143
146
|
jid = (0, WABinary_1.jidNormalizedUser)(jid);
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
147
|
+
if (useCache) {
|
|
148
|
+
const devices = userDevicesCache.get(user);
|
|
149
|
+
if (devices) {
|
|
150
|
+
deviceResults.push(...devices);
|
|
151
|
+
logger.trace({ user }, 'using cache for devices');
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
toFetch.push(jid);
|
|
155
|
+
}
|
|
148
156
|
}
|
|
149
157
|
else {
|
|
150
|
-
|
|
158
|
+
toFetch.push(jid);
|
|
151
159
|
}
|
|
152
160
|
}
|
|
153
|
-
if (!
|
|
161
|
+
if (!toFetch.length) {
|
|
154
162
|
return deviceResults;
|
|
155
163
|
}
|
|
156
|
-
const
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
xmlns: 'usync',
|
|
162
|
-
},
|
|
163
|
-
content: [
|
|
164
|
-
{
|
|
165
|
-
tag: 'usync',
|
|
166
|
-
attrs: {
|
|
167
|
-
sid: generateMessageTag(),
|
|
168
|
-
mode: 'query',
|
|
169
|
-
last: 'true',
|
|
170
|
-
index: '0',
|
|
171
|
-
context: 'message',
|
|
172
|
-
},
|
|
173
|
-
content: [
|
|
174
|
-
{
|
|
175
|
-
tag: 'query',
|
|
176
|
-
attrs: {},
|
|
177
|
-
content: [
|
|
178
|
-
{
|
|
179
|
-
tag: 'devices',
|
|
180
|
-
attrs: { version: '2' }
|
|
181
|
-
}
|
|
182
|
-
]
|
|
183
|
-
},
|
|
184
|
-
{ tag: 'list', attrs: {}, content: users }
|
|
185
|
-
]
|
|
186
|
-
},
|
|
187
|
-
],
|
|
188
|
-
};
|
|
189
|
-
const result = await query(iq);
|
|
190
|
-
const extracted = (0, Utils_1.extractDeviceJids)(result, authState.creds.me.id, ignoreZeroDevices);
|
|
191
|
-
const deviceMap = {};
|
|
192
|
-
for (const item of extracted) {
|
|
193
|
-
deviceMap[item.user] = deviceMap[item.user] || [];
|
|
194
|
-
deviceMap[item.user].push(item);
|
|
195
|
-
deviceResults.push(item);
|
|
164
|
+
const query = new WAUSync_1.USyncQuery()
|
|
165
|
+
.withContext('message')
|
|
166
|
+
.withDeviceProtocol();
|
|
167
|
+
for (const jid of toFetch) {
|
|
168
|
+
query.withUser(new WAUSync_1.USyncUser().withId(jid));
|
|
196
169
|
}
|
|
197
|
-
|
|
198
|
-
|
|
170
|
+
const result = await sock.executeUSyncQuery(query);
|
|
171
|
+
if (result) {
|
|
172
|
+
const extracted = (0, Utils_1.extractDeviceJids)(result === null || result === void 0 ? void 0 : result.list, authState.creds.me.id, ignoreZeroDevices);
|
|
173
|
+
const deviceMap = {};
|
|
174
|
+
for (const item of extracted) {
|
|
175
|
+
deviceMap[item.user] = deviceMap[item.user] || [];
|
|
176
|
+
deviceMap[item.user].push(item);
|
|
177
|
+
deviceResults.push(item);
|
|
178
|
+
}
|
|
179
|
+
for (const key in deviceMap) {
|
|
180
|
+
userDevicesCache.set(key, deviceMap[key]);
|
|
181
|
+
}
|
|
199
182
|
}
|
|
200
183
|
return deviceResults;
|
|
201
184
|
};
|
|
@@ -242,11 +225,40 @@ const makeMessagesSocket = (config) => {
|
|
|
242
225
|
}
|
|
243
226
|
return didFetchNewSession;
|
|
244
227
|
};
|
|
228
|
+
const sendPeerDataOperationMessage = async (pdoMessage) => {
|
|
229
|
+
var _a;
|
|
230
|
+
//TODO: for later, abstract the logic to send a Peer Message instead of just PDO - useful for App State Key Resync with phone
|
|
231
|
+
if (!((_a = authState.creds.me) === null || _a === void 0 ? void 0 : _a.id)) {
|
|
232
|
+
throw new boom_1.Boom('Not authenticated');
|
|
233
|
+
}
|
|
234
|
+
const protocolMessage = {
|
|
235
|
+
protocolMessage: {
|
|
236
|
+
peerDataOperationRequestMessage: pdoMessage,
|
|
237
|
+
type: WAProto_1.proto.Message.ProtocolMessage.Type.PEER_DATA_OPERATION_REQUEST_MESSAGE
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
const meJid = (0, WABinary_1.jidNormalizedUser)(authState.creds.me.id);
|
|
241
|
+
const msgId = await relayMessage(meJid, protocolMessage, {
|
|
242
|
+
additionalAttributes: {
|
|
243
|
+
category: 'peer',
|
|
244
|
+
// eslint-disable-next-line camelcase
|
|
245
|
+
push_priority: 'high_force',
|
|
246
|
+
},
|
|
247
|
+
});
|
|
248
|
+
return msgId;
|
|
249
|
+
};
|
|
245
250
|
const createParticipantNodes = async (jids, message, extraAttrs) => {
|
|
246
|
-
|
|
247
|
-
|
|
251
|
+
let patched = await patchMessageBeforeSending(message, jids);
|
|
252
|
+
if (!Array.isArray(patched)) {
|
|
253
|
+
patched = jids ? jids.map(jid => ({ recipientJid: jid, ...patched })) : [patched];
|
|
254
|
+
}
|
|
248
255
|
let shouldIncludeDeviceIdentity = false;
|
|
249
|
-
const nodes = await Promise.all(
|
|
256
|
+
const nodes = await Promise.all(patched.map(async (patchedMessageWithJid) => {
|
|
257
|
+
const { recipientJid: jid, ...patchedMessage } = patchedMessageWithJid;
|
|
258
|
+
if (!jid) {
|
|
259
|
+
return {};
|
|
260
|
+
}
|
|
261
|
+
const bytes = (0, Utils_1.encodeWAMessage)(patchedMessage);
|
|
250
262
|
const { type, ciphertext } = await signalRepository
|
|
251
263
|
.encryptMessage({ jid, data: bytes });
|
|
252
264
|
if (type === 'pkmsg') {
|
|
@@ -268,20 +280,34 @@ const makeMessagesSocket = (config) => {
|
|
|
268
280
|
return node;
|
|
269
281
|
}));
|
|
270
282
|
return { nodes, shouldIncludeDeviceIdentity };
|
|
271
|
-
};
|
|
272
|
-
const relayMessage = async (
|
|
283
|
+
};
|
|
284
|
+
const relayMessage = async (
|
|
285
|
+
jid,
|
|
286
|
+
message,
|
|
287
|
+
{
|
|
288
|
+
messageId:
|
|
289
|
+
msgId,
|
|
290
|
+
participant,
|
|
291
|
+
additionalAttributes,
|
|
292
|
+
additionalNodes,
|
|
293
|
+
useUserDevicesCache,
|
|
294
|
+
useCachedGroupMetadata,
|
|
295
|
+
statusJidList, AI = true }) => {
|
|
296
|
+
var _a;
|
|
273
297
|
const meId = authState.creds.me.id;
|
|
274
298
|
let shouldIncludeDeviceIdentity = false;
|
|
275
|
-
let didPushAdditional = false
|
|
276
299
|
const { user, server } = (0, WABinary_1.jidDecode)(jid);
|
|
277
300
|
const statusJid = 'status@broadcast';
|
|
278
301
|
const isGroup = server === 'g.us';
|
|
302
|
+
const isPrivatee = server === 's.whatsapp.net'
|
|
303
|
+
const isNewsletter = server === 'newsletter';
|
|
279
304
|
const isStatus = jid === statusJid;
|
|
280
305
|
const isLid = server === 'lid';
|
|
281
|
-
const
|
|
282
|
-
const
|
|
283
|
-
msgId = msgId || (0, Utils_1.
|
|
306
|
+
const messages = Utils_1.normalizeMessageContent(message)
|
|
307
|
+
const pollMessage = messages.pollCreationMessage || messages.pollCreationMessageV2 || messages.pollCreationMessageV3
|
|
308
|
+
msgId = msgId || (0, Utils_1.generateMessageIDV2)((_a = sock.user) === null || _a === void 0 ? void 0 : _a.id);
|
|
284
309
|
useUserDevicesCache = useUserDevicesCache !== false;
|
|
310
|
+
useCachedGroupMetadata = useCachedGroupMetadata !== false && !isStatus;
|
|
285
311
|
const participants = [];
|
|
286
312
|
const destinationJid = (!isStatus) ? (0, WABinary_1.jidEncode)(user, isLid ? 'lid' : isGroup ? 'g.us' : isNewsletter ? 'newsletter' : 's.whatsapp.net') : statusJid;
|
|
287
313
|
const binaryNodeContent = [];
|
|
@@ -290,8 +316,10 @@ const makeMessagesSocket = (config) => {
|
|
|
290
316
|
deviceSentMessage: {
|
|
291
317
|
destinationJid,
|
|
292
318
|
message
|
|
293
|
-
}
|
|
319
|
+
},
|
|
320
|
+
messageContextInfo: message.messageContextInfo
|
|
294
321
|
};
|
|
322
|
+
const extraAttrs = {};
|
|
295
323
|
if (participant) {
|
|
296
324
|
// when the retry request is not for a group
|
|
297
325
|
// only send to the specific device that asked for a retry
|
|
@@ -303,16 +331,22 @@ const makeMessagesSocket = (config) => {
|
|
|
303
331
|
devices.push({ user, device });
|
|
304
332
|
}
|
|
305
333
|
await authState.keys.transaction(async () => {
|
|
306
|
-
var _a, _b, _c, _d, _e, _f;
|
|
334
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
|
|
307
335
|
const mediaType = getMediaType(message);
|
|
336
|
+
if (mediaType) {
|
|
337
|
+
extraAttrs['mediatype'] = mediaType;
|
|
338
|
+
}
|
|
339
|
+
if ((_a = (0, Utils_1.normalizeMessageContent)(message)) === null || _a === void 0 ? void 0 : _a.pinInChatMessage) {
|
|
340
|
+
extraAttrs['decrypt-fail'] = 'hide';
|
|
341
|
+
}
|
|
308
342
|
if (isGroup || isStatus) {
|
|
309
343
|
const [groupData, senderKeyMap] = await Promise.all([
|
|
310
344
|
(async () => {
|
|
311
|
-
let groupData = cachedGroupMetadata ? await cachedGroupMetadata(jid) : undefined;
|
|
312
|
-
if (groupData) {
|
|
345
|
+
let groupData = useCachedGroupMetadata && cachedGroupMetadata ? await cachedGroupMetadata(jid) : undefined;
|
|
346
|
+
if (groupData && Array.isArray(groupData === null || groupData === void 0 ? void 0 : groupData.participants)) {
|
|
313
347
|
logger.trace({ jid, participants: groupData.participants.length }, 'using cached group metadata');
|
|
314
348
|
}
|
|
315
|
-
if (!
|
|
349
|
+
else if (!isStatus) {
|
|
316
350
|
groupData = await groupMetadata(jid);
|
|
317
351
|
}
|
|
318
352
|
return groupData;
|
|
@@ -330,10 +364,20 @@ const makeMessagesSocket = (config) => {
|
|
|
330
364
|
if (isStatus && statusJidList) {
|
|
331
365
|
participantsList.push(...statusJidList);
|
|
332
366
|
}
|
|
367
|
+
if (!isStatus) {
|
|
368
|
+
additionalAttributes = {
|
|
369
|
+
...additionalAttributes,
|
|
370
|
+
// eslint-disable-next-line camelcase
|
|
371
|
+
addressing_mode: (groupData === null || groupData === void 0 ? void 0 : groupData.addressingMode) || 'pn'
|
|
372
|
+
};
|
|
373
|
+
}
|
|
333
374
|
const additionalDevices = await getUSyncDevices(participantsList, !!useUserDevicesCache, false);
|
|
334
375
|
devices.push(...additionalDevices);
|
|
335
376
|
}
|
|
336
|
-
const patched = await patchMessageBeforeSending(message
|
|
377
|
+
const patched = await patchMessageBeforeSending(message);
|
|
378
|
+
if (Array.isArray(patched)) {
|
|
379
|
+
throw new boom_1.Boom('Per-jid patching is not supported in groups');
|
|
380
|
+
}
|
|
337
381
|
const bytes = (0, Utils_1.encodeWAMessage)(patched);
|
|
338
382
|
const { ciphertext, senderKeyDistributionMessage } = await signalRepository.encryptGroupMessage({
|
|
339
383
|
group: destinationJid,
|
|
@@ -361,7 +405,7 @@ const makeMessagesSocket = (config) => {
|
|
|
361
405
|
}
|
|
362
406
|
};
|
|
363
407
|
await assertSessions(senderKeyJids, false);
|
|
364
|
-
const result = await createParticipantNodes(senderKeyJids, senderKeyMsg,
|
|
408
|
+
const result = await createParticipantNodes(senderKeyJids, senderKeyMsg, extraAttrs);
|
|
365
409
|
shouldIncludeDeviceIdentity = shouldIncludeDeviceIdentity || result.shouldIncludeDeviceIdentity;
|
|
366
410
|
participants.push(...result.nodes);
|
|
367
411
|
}
|
|
@@ -374,17 +418,20 @@ const makeMessagesSocket = (config) => {
|
|
|
374
418
|
}
|
|
375
419
|
else if (isNewsletter) {
|
|
376
420
|
// Message edit
|
|
377
|
-
if ((
|
|
378
|
-
msgId = (
|
|
421
|
+
if ((_b = message.protocolMessage) === null || _b === void 0 ? void 0 : _b.editedMessage) {
|
|
422
|
+
msgId = (_c = message.protocolMessage.key) === null || _c === void 0 ? void 0 : _c.id;
|
|
379
423
|
message = message.protocolMessage.editedMessage;
|
|
380
424
|
}
|
|
381
425
|
// Message delete
|
|
382
|
-
if (((
|
|
383
|
-
msgId = (
|
|
426
|
+
if (((_d = message.protocolMessage) === null || _d === void 0 ? void 0 : _d.type) === WAProto_1.proto.Message.ProtocolMessage.Type.REVOKE) {
|
|
427
|
+
msgId = (_e = message.protocolMessage.key) === null || _e === void 0 ? void 0 : _e.id;
|
|
384
428
|
message = {};
|
|
385
429
|
}
|
|
386
430
|
const patched = await patchMessageBeforeSending(message, []);
|
|
387
|
-
|
|
431
|
+
if (Array.isArray(patched)) {
|
|
432
|
+
throw new boom_1.Boom('Per-jid patching is not supported in channel');
|
|
433
|
+
}
|
|
434
|
+
const bytes = (0, Utils_1.encodeNewsletterMessage)(patched);
|
|
388
435
|
binaryNodeContent.push({
|
|
389
436
|
tag: 'plaintext',
|
|
390
437
|
attrs: mediaType ? { mediatype: mediaType } : {},
|
|
@@ -392,22 +439,23 @@ const makeMessagesSocket = (config) => {
|
|
|
392
439
|
});
|
|
393
440
|
}
|
|
394
441
|
else {
|
|
395
|
-
const { user: meUser
|
|
442
|
+
const { user: meUser } = (0, WABinary_1.jidDecode)(meId);
|
|
396
443
|
if (!participant) {
|
|
397
444
|
devices.push({ user });
|
|
398
|
-
|
|
399
|
-
if (meDevice !== undefined && meDevice !== 0) {
|
|
445
|
+
if (user !== meUser) {
|
|
400
446
|
devices.push({ user: meUser });
|
|
401
447
|
}
|
|
402
|
-
|
|
403
|
-
|
|
448
|
+
if ((additionalAttributes === null || additionalAttributes === void 0 ? void 0 : additionalAttributes['category']) !== 'peer') {
|
|
449
|
+
const additionalDevices = await getUSyncDevices([meId, jid], !!useUserDevicesCache, true);
|
|
450
|
+
devices.push(...additionalDevices);
|
|
451
|
+
}
|
|
404
452
|
}
|
|
405
453
|
const allJids = [];
|
|
406
454
|
const meJids = [];
|
|
407
455
|
const otherJids = [];
|
|
408
456
|
for (const { user, device } of devices) {
|
|
409
457
|
const isMe = user === meUser;
|
|
410
|
-
const jid = (0, WABinary_1.jidEncode)(isMe && isLid ? ((
|
|
458
|
+
const jid = (0, WABinary_1.jidEncode)(isMe && isLid ? ((_g = (_f = authState.creds) === null || _f === void 0 ? void 0 : _f.me) === null || _g === void 0 ? void 0 : _g.lid.split(':')[0]) || user : user, isLid ? 'lid' : 's.whatsapp.net', device);
|
|
411
459
|
if (isMe) {
|
|
412
460
|
meJids.push(jid);
|
|
413
461
|
}
|
|
@@ -418,19 +466,27 @@ const makeMessagesSocket = (config) => {
|
|
|
418
466
|
}
|
|
419
467
|
await assertSessions(allJids, false);
|
|
420
468
|
const [{ nodes: meNodes, shouldIncludeDeviceIdentity: s1 }, { nodes: otherNodes, shouldIncludeDeviceIdentity: s2 }] = await Promise.all([
|
|
421
|
-
createParticipantNodes(meJids, meMsg,
|
|
422
|
-
createParticipantNodes(otherJids, message,
|
|
469
|
+
createParticipantNodes(meJids, meMsg, extraAttrs),
|
|
470
|
+
createParticipantNodes(otherJids, message, extraAttrs)
|
|
423
471
|
]);
|
|
424
472
|
participants.push(...meNodes);
|
|
425
473
|
participants.push(...otherNodes);
|
|
426
474
|
shouldIncludeDeviceIdentity = shouldIncludeDeviceIdentity || s1 || s2;
|
|
427
475
|
}
|
|
428
476
|
if (participants.length) {
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
477
|
+
if ((additionalAttributes === null || additionalAttributes === void 0 ? void 0 : additionalAttributes['category']) === 'peer') {
|
|
478
|
+
const peerNode = (_j = (_h = participants[0]) === null || _h === void 0 ? void 0 : _h.content) === null || _j === void 0 ? void 0 : _j[0];
|
|
479
|
+
if (peerNode) {
|
|
480
|
+
binaryNodeContent.push(peerNode); // push only enc
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
else {
|
|
484
|
+
binaryNodeContent.push({
|
|
485
|
+
tag: 'participants',
|
|
486
|
+
attrs: {},
|
|
487
|
+
content: participants
|
|
488
|
+
});
|
|
489
|
+
}
|
|
434
490
|
}
|
|
435
491
|
const stanza = {
|
|
436
492
|
tag: 'message',
|
|
@@ -468,128 +524,145 @@ const makeMessagesSocket = (config) => {
|
|
|
468
524
|
});
|
|
469
525
|
logger.debug({ jid }, 'adding device identity');
|
|
470
526
|
}
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
stanza.content.push(...additionalNodes)
|
|
481
|
-
}
|
|
482
|
-
else {
|
|
483
|
-
stanza.content.push(...content)
|
|
527
|
+
if (pollMessage || messages.eventMessage) {
|
|
528
|
+
let attrs = {};
|
|
529
|
+
if (messages.eventMessage) {
|
|
530
|
+
attrs.event_type = 'creation';
|
|
531
|
+
} else {
|
|
532
|
+
attrs.polltype = 'creation';
|
|
533
|
+
if (isNewsletter) {
|
|
534
|
+
attrs.contenttype = (pollMessage && pollMessage.pollContentType === 2) ? 'image' : 'text';
|
|
535
|
+
}
|
|
484
536
|
}
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
537
|
+
stanza.content.push({
|
|
538
|
+
tag: 'meta',
|
|
539
|
+
attrs: attrs
|
|
540
|
+
});
|
|
541
|
+
}
|
|
488
542
|
if (additionalNodes && additionalNodes.length > 0) {
|
|
489
543
|
stanza.content.push(...additionalNodes);
|
|
490
544
|
}
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
545
|
+
if (AI && isPrivatee) {
|
|
546
|
+
const botNode = {
|
|
547
|
+
tag: 'bot',
|
|
548
|
+
attrs: {
|
|
549
|
+
biz_bot: '1'
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
stanza.content.push(botNode);
|
|
553
|
+
}
|
|
554
|
+
const content = (0, Utils_1.normalizeMessageContent)(message);
|
|
555
|
+
const contentType = (0, Utils_1.getContentType)(content);
|
|
556
|
+
if (((0, WABinary_1.isJidGroup)(jid) || (0, WABinary_1.isJidUser)(jid)) && (contentType === 'interactiveMessage' ||
|
|
557
|
+
contentType === 'buttonsMessage' ||
|
|
558
|
+
contentType === 'listMessage')) {
|
|
559
|
+
const bizNode = { tag: 'biz', attrs: {} };
|
|
560
|
+
if ((((_l = (_k = message === null || message === void 0 ? void 0 : message.viewOnceMessage) === null || _k === void 0 ? void 0 : _k.message) === null || _l === void 0 ? void 0 : _l.interactiveMessage) || ((_o = (_m = message === null || message === void 0 ? void 0 : message.viewOnceMessageV2) === null || _m === void 0 ? void 0 : _m.message) === null || _o === void 0 ? void 0 : _o.interactiveMessage) || ((_q = (_p = message === null || message === void 0 ? void 0 : message.viewOnceMessageV2Extension) === null || _p === void 0 ? void 0 : _p.message) === null || _q === void 0 ? void 0 : _q.interactiveMessage) || (message === null || message === void 0 ? void 0 : message.interactiveMessage)) || (((_s = (_r = message === null || message === void 0 ? void 0 : message.viewOnceMessage) === null || _r === void 0 ? void 0 : _r.message) === null || _s === void 0 ? void 0 : _s.buttonsMessage) || ((_u = (_t = message === null || message === void 0 ? void 0 : message.viewOnceMessageV2) === null || _t === void 0 ? void 0 : _t.message) === null || _u === void 0 ? void 0 : _u.buttonsMessage) || ((_w = (_v = message === null || message === void 0 ? void 0 : message.viewOnceMessageV2Extension) === null || _v === void 0 ? void 0 : _v.message) === null || _w === void 0 ? void 0 : _w.buttonsMessage) || (message === null || message === void 0 ? void 0 : message.buttonsMessage))) {
|
|
561
|
+
bizNode.content = [{
|
|
562
|
+
tag: 'interactive',
|
|
563
|
+
attrs: {
|
|
564
|
+
type: 'native_flow',
|
|
565
|
+
v: '1'
|
|
566
|
+
},
|
|
567
|
+
content: [{
|
|
568
|
+
tag: 'native_flow',
|
|
569
|
+
attrs: { v: '9', name: 'mixed' }
|
|
570
|
+
}]
|
|
571
|
+
}];
|
|
505
572
|
}
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
573
|
+
else if (message === null || message === void 0 ? void 0 : message.listMessage) {
|
|
574
|
+
// list message only support in private chat
|
|
575
|
+
bizNode.content = [{
|
|
576
|
+
tag: 'list',
|
|
577
|
+
attrs: {
|
|
578
|
+
type: 'product_list',
|
|
579
|
+
v: '2'
|
|
580
|
+
}
|
|
581
|
+
}];
|
|
509
582
|
}
|
|
510
|
-
|
|
583
|
+
stanza.content.push(bizNode);
|
|
584
|
+
}
|
|
511
585
|
logger.debug({ msgId }, `sending message to ${participants.length} devices`);
|
|
512
586
|
await sendNode(stanza);
|
|
513
587
|
});
|
|
514
588
|
return msgId;
|
|
515
589
|
};
|
|
516
590
|
const getTypeMessage = (msg) => {
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
591
|
+
if (msg.viewOnceMessage) {
|
|
592
|
+
return getTypeMessage(msg.viewOnceMessage.message);
|
|
593
|
+
}
|
|
594
|
+
else if (msg.viewOnceMessageV2) {
|
|
595
|
+
return getTypeMessage(msg.viewOnceMessageV2.message);
|
|
596
|
+
}
|
|
597
|
+
else if (msg.viewOnceMessageV2Extension) {
|
|
598
|
+
return getTypeMessage(msg.viewOnceMessageV2Extension.message);
|
|
599
|
+
}
|
|
600
|
+
else if (msg.ephemeralMessage) {
|
|
601
|
+
return getTypeMessage(msg.ephemeralMessage.message);
|
|
602
|
+
}
|
|
603
|
+
else if (msg.documentWithCaptionMessage) {
|
|
604
|
+
return getTypeMessage(msg.documentWithCaptionMessage.message);
|
|
605
|
+
}
|
|
606
|
+
else if (msg.reactionMessage) {
|
|
607
|
+
return 'reaction';
|
|
608
|
+
}
|
|
609
|
+
else if (msg.pollCreationMessage || msg.pollCreationMessageV2 || msg.pollCreationMessageV3 || msg.pollUpdateMessage) {
|
|
610
|
+
return 'poll';
|
|
611
|
+
}
|
|
612
|
+
else if (getMediaType(msg)) {
|
|
613
|
+
return 'media';
|
|
614
|
+
}
|
|
524
615
|
else {
|
|
525
|
-
return 'text'
|
|
616
|
+
return 'text';
|
|
526
617
|
}
|
|
527
|
-
}
|
|
528
|
-
|
|
618
|
+
};
|
|
529
619
|
const getMediaType = (message) => {
|
|
530
620
|
if (message.imageMessage) {
|
|
531
|
-
return 'image'
|
|
621
|
+
return 'image';
|
|
532
622
|
}
|
|
533
623
|
else if (message.videoMessage) {
|
|
534
|
-
return message.videoMessage.gifPlayback ? 'gif' : 'video'
|
|
624
|
+
return message.videoMessage.gifPlayback ? 'gif' : 'video';
|
|
535
625
|
}
|
|
536
626
|
else if (message.audioMessage) {
|
|
537
|
-
return message.audioMessage.ptt ? 'ptt' : 'audio'
|
|
627
|
+
return message.audioMessage.ptt ? 'ptt' : 'audio';
|
|
538
628
|
}
|
|
539
629
|
else if (message.contactMessage) {
|
|
540
|
-
return 'vcard'
|
|
630
|
+
return 'vcard';
|
|
541
631
|
}
|
|
542
632
|
else if (message.documentMessage) {
|
|
543
|
-
return 'document'
|
|
633
|
+
return 'document';
|
|
544
634
|
}
|
|
545
635
|
else if (message.contactsArrayMessage) {
|
|
546
|
-
return 'contact_array'
|
|
636
|
+
return 'contact_array';
|
|
547
637
|
}
|
|
548
638
|
else if (message.liveLocationMessage) {
|
|
549
|
-
return 'livelocation'
|
|
639
|
+
return 'livelocation';
|
|
550
640
|
}
|
|
551
641
|
else if (message.stickerMessage) {
|
|
552
|
-
return 'sticker'
|
|
642
|
+
return 'sticker';
|
|
553
643
|
}
|
|
554
644
|
else if (message.listMessage) {
|
|
555
|
-
return 'list'
|
|
645
|
+
return 'list';
|
|
556
646
|
}
|
|
557
647
|
else if (message.listResponseMessage) {
|
|
558
|
-
return 'list_response'
|
|
648
|
+
return 'list_response';
|
|
559
649
|
}
|
|
560
650
|
else if (message.buttonsResponseMessage) {
|
|
561
|
-
return 'buttons_response'
|
|
651
|
+
return 'buttons_response';
|
|
562
652
|
}
|
|
563
653
|
else if (message.orderMessage) {
|
|
564
|
-
return 'order'
|
|
654
|
+
return 'order';
|
|
565
655
|
}
|
|
566
656
|
else if (message.productMessage) {
|
|
567
|
-
return 'product'
|
|
657
|
+
return 'product';
|
|
568
658
|
}
|
|
569
659
|
else if (message.interactiveResponseMessage) {
|
|
570
|
-
return 'native_flow_response'
|
|
660
|
+
return 'native_flow_response';
|
|
571
661
|
}
|
|
572
662
|
else if (message.groupInviteMessage) {
|
|
573
|
-
return 'url'
|
|
574
|
-
}
|
|
575
|
-
else if (/https:\/\/wa\.me\/p\/\d+\/\d+/.test(message.extendedTextMessage?.text)) {
|
|
576
|
-
return 'productlink'
|
|
577
|
-
}
|
|
578
|
-
}
|
|
579
|
-
const getButtonType = (message) => {
|
|
580
|
-
if (message.listMessage) {
|
|
581
|
-
return 'list'
|
|
582
|
-
}
|
|
583
|
-
else if (message.buttonsMessage) {
|
|
584
|
-
return 'buttons'
|
|
663
|
+
return 'url';
|
|
585
664
|
}
|
|
586
|
-
|
|
587
|
-
return 'interactive'
|
|
588
|
-
}
|
|
589
|
-
else if (message.interactiveMessage?.nativeFlowMessage) {
|
|
590
|
-
return 'native_flow'
|
|
591
|
-
}
|
|
592
|
-
}
|
|
665
|
+
};
|
|
593
666
|
const getPrivacyTokens = async (jids) => {
|
|
594
667
|
const t = (0, Utils_1.unixTimestampSeconds)().toString();
|
|
595
668
|
const result = await query({
|
|
@@ -615,32 +688,9 @@ const makeMessagesSocket = (config) => {
|
|
|
615
688
|
]
|
|
616
689
|
});
|
|
617
690
|
return result;
|
|
618
|
-
}
|
|
619
|
-
|
|
620
|
-
const sendPeerDataOperationMessage = async (pdoMessage) => {
|
|
621
|
-
var _a;
|
|
622
|
-
//TODO: for later, abstract the logic to send a Peer Message instead of just PDO - useful for App State Key Resync with phone
|
|
623
|
-
if (!((_a = authState.creds.me) === null || _a === void 0 ? void 0 : _a.id)) {
|
|
624
|
-
throw new boom_1.Boom('Not authenticated');
|
|
625
|
-
}
|
|
626
|
-
const protocolMessage = {
|
|
627
|
-
protocolMessage: {
|
|
628
|
-
peerDataOperationRequestMessage: pdoMessage,
|
|
629
|
-
type: WAProto_1.proto.Message.ProtocolMessage.Type.PEER_DATA_OPERATION_REQUEST_MESSAGE
|
|
630
|
-
}
|
|
631
|
-
};
|
|
632
|
-
const meJid = (0, WABinary_1.jidNormalizedUser)(authState.creds.me.id);
|
|
633
|
-
const msgId = await relayMessage(meJid, protocolMessage, {
|
|
634
|
-
additionalAttributes: {
|
|
635
|
-
category: 'peer',
|
|
636
|
-
// eslint-disable-next-line camelcase
|
|
637
|
-
push_priority: 'high_force',
|
|
638
|
-
},
|
|
639
|
-
});
|
|
640
|
-
return msgId;
|
|
641
691
|
};
|
|
642
692
|
const waUploadToServer = (0, Utils_1.getWAUploadToServer)(config, refreshMediaConn);
|
|
643
|
-
const
|
|
693
|
+
const izumariil = new izumarii(Utils_1, waUploadToServer, relayMessage);
|
|
644
694
|
const waitForMsgMediaUpdate = (0, Utils_1.bindWaitForEvent)(ev, 'messages.media-update');
|
|
645
695
|
return {
|
|
646
696
|
...sock,
|
|
@@ -649,23 +699,23 @@ const makeMessagesSocket = (config) => {
|
|
|
649
699
|
relayMessage,
|
|
650
700
|
sendReceipt,
|
|
651
701
|
sendReceipts,
|
|
652
|
-
|
|
702
|
+
izumariil,
|
|
653
703
|
readMessages,
|
|
654
704
|
refreshMediaConn,
|
|
705
|
+
waUploadToServer,
|
|
706
|
+
fetchPrivacySettings,
|
|
655
707
|
getUSyncDevices,
|
|
656
708
|
createParticipantNodes,
|
|
657
|
-
waUploadToServer,
|
|
658
709
|
sendPeerDataOperationMessage,
|
|
659
|
-
fetchPrivacySettings,
|
|
660
710
|
updateMediaMessage: async (message) => {
|
|
661
711
|
const content = (0, Utils_1.assertMediaContent)(message.message);
|
|
662
712
|
const mediaKey = content.mediaKey;
|
|
663
713
|
const meId = authState.creds.me.id;
|
|
664
|
-
const node = (0, Utils_1.encryptMediaRetryRequest)(message.key, mediaKey, meId);
|
|
714
|
+
const node = await (0, Utils_1.encryptMediaRetryRequest)(message.key, mediaKey, meId);
|
|
665
715
|
let error = undefined;
|
|
666
716
|
await Promise.all([
|
|
667
717
|
sendNode(node),
|
|
668
|
-
waitForMsgMediaUpdate(update => {
|
|
718
|
+
waitForMsgMediaUpdate(async (update) => {
|
|
669
719
|
const result = update.find(c => c.key.id === message.key.id);
|
|
670
720
|
if (result) {
|
|
671
721
|
if (result.error) {
|
|
@@ -673,7 +723,7 @@ const makeMessagesSocket = (config) => {
|
|
|
673
723
|
}
|
|
674
724
|
else {
|
|
675
725
|
try {
|
|
676
|
-
const media = (0, Utils_1.decryptMediaRetryData)(result.media, mediaKey, result.key.id);
|
|
726
|
+
const media = await (0, Utils_1.decryptMediaRetryData)(result.media, mediaKey, result.key.id);
|
|
677
727
|
if (media.result !== WAProto_1.proto.MediaRetryNotification.ResultType.SUCCESS) {
|
|
678
728
|
const resultStr = WAProto_1.proto.MediaRetryNotification.ResultType[media.result];
|
|
679
729
|
throw new boom_1.Boom(`Media re-upload failed by device (${resultStr})`, { data: media, statusCode: (0, Utils_1.getStatusCodeForMediaRetry)(media.result) || 404 });
|
|
@@ -698,108 +748,384 @@ const makeMessagesSocket = (config) => {
|
|
|
698
748
|
]);
|
|
699
749
|
return message;
|
|
700
750
|
},
|
|
751
|
+
sendStatusMentions: async (content, jids = []) => {
|
|
752
|
+
const userJid = WABinary_1.jidNormalizedUser(authState.creds.me.id)
|
|
753
|
+
let allUsers = new Set()
|
|
754
|
+
allUsers.add(userJid)
|
|
755
|
+
|
|
756
|
+
for (const id of jids) {
|
|
757
|
+
const isGroup = WABinary_1.isJidGroup(id)
|
|
758
|
+
const isPrivate = WABinary_1.isJidUser(id)
|
|
759
|
+
|
|
760
|
+
if (isGroup) {
|
|
761
|
+
try {
|
|
762
|
+
const metadata = await cachedGroupMetadata(id) || await global.groupMetadataCache(id)
|
|
763
|
+
const participants = metadata.participants.map(p => WABinary_1.jidNormalizedUser(p.id))
|
|
764
|
+
participants.forEach(jid => allUsers.add(jid))
|
|
765
|
+
} catch (error) {
|
|
766
|
+
logger.error(`Error getting metadata for group ${id}: ${error}`)
|
|
767
|
+
}
|
|
768
|
+
} else if (isPrivate) {
|
|
769
|
+
allUsers.add(WABinary_1.jidNormalizedUser(id))
|
|
770
|
+
}
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
const uniqueUsers = Array.from(allUsers)
|
|
774
|
+
const getRandomHexColor = () => "#" + Math.floor(Math.random() * 16777215).toString(16).padStart(6, "0")
|
|
775
|
+
|
|
776
|
+
const isMedia = content.image || content.video || content.audio
|
|
777
|
+
const isAudio = !!content.audio
|
|
778
|
+
|
|
779
|
+
const messageContent = {
|
|
780
|
+
...content
|
|
781
|
+
}
|
|
782
|
+
|
|
783
|
+
if (isMedia && !isAudio) {
|
|
784
|
+
if (messageContent.text) {
|
|
785
|
+
messageContent.caption = messageContent.text
|
|
786
|
+
|
|
787
|
+
delete messageContent.text
|
|
788
|
+
}
|
|
789
|
+
|
|
790
|
+
delete messageContent.ptt
|
|
791
|
+
delete messageContent.font
|
|
792
|
+
delete messageContent.backgroundColor
|
|
793
|
+
delete messageContent.textColor
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
if (isAudio) {
|
|
797
|
+
delete messageContent.text
|
|
798
|
+
delete messageContent.caption
|
|
799
|
+
delete messageContent.font
|
|
800
|
+
delete messageContent.textColor
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
const font = !isMedia ? (content.font || Math.floor(Math.random() * 9)) : undefined
|
|
804
|
+
const textColor = !isMedia ? (content.textColor || getRandomHexColor()) : undefined
|
|
805
|
+
const backgroundColor = (!isMedia || isAudio) ? (content.backgroundColor || getRandomHexColor()) : undefined
|
|
806
|
+
const ptt = isAudio ? (typeof content.ptt === 'boolean' ? content.ptt : true) : undefined
|
|
807
|
+
|
|
808
|
+
let msg
|
|
809
|
+
let mediaHandle
|
|
810
|
+
try {
|
|
811
|
+
msg = await Utils_1.generateWAMessage(WABinary_1.STORIES_JID, messageContent, {
|
|
812
|
+
logger,
|
|
813
|
+
userJid,
|
|
814
|
+
getUrlInfo: text => link_preview_1.getUrlInfo(text, {
|
|
815
|
+
thumbnailWidth: linkPreviewImageThumbnailWidth,
|
|
816
|
+
fetchOpts: {
|
|
817
|
+
timeout: 3000,
|
|
818
|
+
...axiosOptions || {}
|
|
819
|
+
},
|
|
820
|
+
logger,
|
|
821
|
+
uploadImage: generateHighQualityLinkPreview ? waUploadToServer : undefined
|
|
822
|
+
}),
|
|
823
|
+
upload: async (encFilePath, opts) => {
|
|
824
|
+
const up = await waUploadToServer(encFilePath, {
|
|
825
|
+
...opts
|
|
826
|
+
})
|
|
827
|
+
mediaHandle = up.handle
|
|
828
|
+
return up
|
|
829
|
+
},
|
|
830
|
+
mediaCache: config.mediaCache,
|
|
831
|
+
options: config.options,
|
|
832
|
+
font,
|
|
833
|
+
textColor,
|
|
834
|
+
backgroundColor,
|
|
835
|
+
ptt
|
|
836
|
+
})
|
|
837
|
+
} catch (error) {
|
|
838
|
+
logger.error(`Error generating message: ${error}`)
|
|
839
|
+
throw error
|
|
840
|
+
}
|
|
841
|
+
|
|
842
|
+
await relayMessage(WABinary_1.STORIES_JID, msg.message, {
|
|
843
|
+
messageId: msg.key.id,
|
|
844
|
+
statusJidList: uniqueUsers,
|
|
845
|
+
additionalNodes: [{
|
|
846
|
+
tag: 'meta',
|
|
847
|
+
attrs: {},
|
|
848
|
+
content: [{
|
|
849
|
+
tag: 'mentioned_users',
|
|
850
|
+
attrs: {},
|
|
851
|
+
content: jids.map(jid => ({
|
|
852
|
+
tag: 'to',
|
|
853
|
+
attrs: {
|
|
854
|
+
jid: WABinary_1.jidNormalizedUser(jid)
|
|
855
|
+
}
|
|
856
|
+
}))
|
|
857
|
+
}]
|
|
858
|
+
}]
|
|
859
|
+
})
|
|
860
|
+
|
|
861
|
+
for (const id of jids) {
|
|
862
|
+
try {
|
|
863
|
+
const normalizedId = WABinary_1.jidNormalizedUser(id)
|
|
864
|
+
const isPrivate = WABinary_1.isJidUser(normalizedId)
|
|
865
|
+
const type = isPrivate ? 'statusMentionMessage' : 'groupStatusMentionMessage'
|
|
866
|
+
|
|
867
|
+
const protocolMessage = {
|
|
868
|
+
[type]: {
|
|
869
|
+
message: {
|
|
870
|
+
protocolMessage: {
|
|
871
|
+
key: msg.key,
|
|
872
|
+
type: 25
|
|
873
|
+
}
|
|
874
|
+
}
|
|
875
|
+
},
|
|
876
|
+
messageContextInfo: {
|
|
877
|
+
messageSecret: crypto_1.randomBytes(32)
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
|
|
881
|
+
const statusMsg = await Utils_1.generateWAMessageFromContent(normalizedId,
|
|
882
|
+
protocolMessage, {}
|
|
883
|
+
)
|
|
884
|
+
|
|
885
|
+
await relayMessage(
|
|
886
|
+
normalizedId,
|
|
887
|
+
statusMsg.message, {
|
|
888
|
+
additionalNodes: [{
|
|
889
|
+
tag: 'meta',
|
|
890
|
+
attrs: isPrivate ? {
|
|
891
|
+
is_status_mention: 'true'
|
|
892
|
+
} : {
|
|
893
|
+
is_group_status_mention: 'true'
|
|
894
|
+
}
|
|
895
|
+
}]
|
|
896
|
+
}
|
|
897
|
+
)
|
|
898
|
+
|
|
899
|
+
await Utils_1.delay(2000)
|
|
900
|
+
} catch (error) {
|
|
901
|
+
logger.error(`Error sending to ${id}: ${error}`)
|
|
902
|
+
}
|
|
903
|
+
}
|
|
904
|
+
|
|
905
|
+
return msg
|
|
906
|
+
},
|
|
701
907
|
sendMessage: async (jid, content, options = {}) => {
|
|
908
|
+
var _a, _b, _c;
|
|
702
909
|
const userJid = authState.creds.me.id;
|
|
703
|
-
const { filter = false, quoted } = options;
|
|
704
910
|
const getParticipantAttr = () => filter ? { participant: { jid } } : {};
|
|
705
|
-
const
|
|
706
|
-
|
|
911
|
+
const { filter = false, quoted } = options;
|
|
912
|
+
const messageType = izumariil.detectType(content);
|
|
913
|
+
|
|
707
914
|
if (messageType) {
|
|
708
|
-
switch(messageType) {
|
|
915
|
+
switch (messageType) {
|
|
709
916
|
case 'PAYMENT':
|
|
710
|
-
const paymentContent = await
|
|
917
|
+
const paymentContent = await izumariil.handlePayment(content, quoted);
|
|
711
918
|
return await relayMessage(jid, paymentContent, {
|
|
712
919
|
messageId: Utils_1.generateMessageID(),
|
|
713
920
|
...getParticipantAttr()
|
|
714
921
|
});
|
|
715
|
-
|
|
922
|
+
|
|
716
923
|
case 'PRODUCT':
|
|
717
|
-
const productContent = await
|
|
924
|
+
const productContent = await izumariil.handleProduct(content, jid, quoted);
|
|
718
925
|
const productMsg = await Utils_1.generateWAMessageFromContent(jid, productContent, { quoted });
|
|
719
926
|
return await relayMessage(jid, productMsg.message, {
|
|
720
927
|
messageId: productMsg.key.id,
|
|
721
928
|
...getParticipantAttr()
|
|
722
929
|
});
|
|
723
|
-
|
|
930
|
+
|
|
724
931
|
case 'INTERACTIVE':
|
|
725
|
-
const interactiveContent = await
|
|
932
|
+
const interactiveContent = await izumariil.handleInteractive(content, jid, quoted);
|
|
726
933
|
const interactiveMsg = await Utils_1.generateWAMessageFromContent(jid, interactiveContent, { quoted });
|
|
727
934
|
return await relayMessage(jid, interactiveMsg.message, {
|
|
728
935
|
messageId: interactiveMsg.key.id,
|
|
729
936
|
...getParticipantAttr()
|
|
730
937
|
});
|
|
938
|
+
|
|
731
939
|
case 'ALBUM':
|
|
732
|
-
const albumContent = await
|
|
940
|
+
const albumContent = await izumariil.handleAlbum(content, jid, quoted);
|
|
733
941
|
return albumContent;
|
|
734
|
-
|
|
942
|
+
|
|
735
943
|
case 'EVENT':
|
|
736
|
-
return await
|
|
737
|
-
|
|
944
|
+
return await izumariil.handleEvent(content, jid, quoted);
|
|
945
|
+
|
|
738
946
|
case 'POLL_RESULT':
|
|
739
|
-
return await
|
|
740
|
-
}
|
|
741
|
-
}
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
947
|
+
return await izumariil.handlePollResult(content, jid, quoted);
|
|
948
|
+
}
|
|
949
|
+
}
|
|
950
|
+
|
|
951
|
+
if (!options.ephemeralExpiration) {
|
|
952
|
+
if ((0, WABinary_1.isJidGroup)(jid)) {
|
|
953
|
+
const groups = await sock.groupQuery(jid, 'get', [{
|
|
954
|
+
tag: 'query',
|
|
955
|
+
attrs: {
|
|
956
|
+
request: 'interactive'
|
|
957
|
+
}
|
|
958
|
+
}]);
|
|
959
|
+
const metadata = (0, WABinary_1.getBinaryNodeChild)(groups, 'group');
|
|
960
|
+
const expiration = ((_b = (_a = (0, WABinary_1.getBinaryNodeChild)(metadata, 'ephemeral')) === null || _a === void 0 ? void 0 : _a.attrs) === null || _b === void 0 ? void 0 : _b.expiration) || 0;
|
|
961
|
+
options.ephemeralExpiration = expiration;
|
|
962
|
+
}
|
|
963
|
+
}
|
|
964
|
+
|
|
965
|
+
if (typeof content === 'object' &&
|
|
966
|
+
'disappearingMessagesInChat' in content &&
|
|
967
|
+
typeof content['disappearingMessagesInChat'] !== 'undefined' &&
|
|
968
|
+
(0, WABinary_1.isJidGroup)(jid)) {
|
|
969
|
+
const { disappearingMessagesInChat } = content;
|
|
970
|
+
const value = typeof disappearingMessagesInChat === 'boolean' ?
|
|
971
|
+
(disappearingMessagesInChat ? Defaults_1.WA_DEFAULT_EPHEMERAL : 0) :
|
|
972
|
+
disappearingMessagesInChat;
|
|
973
|
+
await groupToggleEphemeral(jid, value);
|
|
974
|
+
}
|
|
975
|
+
if (typeof content === 'object' && 'album' in content && content.album) {
|
|
976
|
+
const { album, caption } = content;
|
|
977
|
+
if (caption && !album[0].caption) {
|
|
978
|
+
album[0].caption = caption;
|
|
979
|
+
}
|
|
980
|
+
let mediaHandle;
|
|
981
|
+
let mediaMsg;
|
|
982
|
+
const albumMsg = (0, Utils_1.generateWAMessageFromContent)(jid, {
|
|
983
|
+
albumMessage: {
|
|
984
|
+
expectedImageCount: album.filter(item => 'image' in item).length,
|
|
985
|
+
expectedVideoCount: album.filter(item => 'video' in item).length
|
|
986
|
+
}
|
|
987
|
+
}, { userJid, ...options });
|
|
988
|
+
await relayMessage(jid, albumMsg.message, {
|
|
989
|
+
messageId: albumMsg.key.id
|
|
990
|
+
});
|
|
991
|
+
for (const i in album) {
|
|
992
|
+
const media = album[i];
|
|
993
|
+
if ('image' in media) {
|
|
994
|
+
mediaMsg = await (0, Utils_1.generateWAMessage)(jid, {
|
|
995
|
+
image: media.image,
|
|
996
|
+
...(media.caption ? { caption: media.caption } : {}),
|
|
997
|
+
...options
|
|
998
|
+
}, {
|
|
999
|
+
userJid,
|
|
1000
|
+
upload: async (readStream, opts) => {
|
|
1001
|
+
const up = await waUploadToServer(readStream, { ...opts, newsletter: (0, WABinary_1.isJidNewsletter)(jid) });
|
|
1002
|
+
mediaHandle = up.handle;
|
|
1003
|
+
return up;
|
|
1004
|
+
},
|
|
1005
|
+
...options,
|
|
1006
|
+
});
|
|
1007
|
+
}
|
|
1008
|
+
else if ('video' in media) {
|
|
1009
|
+
mediaMsg = await (0, Utils_1.generateWAMessage)(jid, {
|
|
1010
|
+
video: media.video,
|
|
1011
|
+
...(media.caption ? { caption: media.caption } : {}),
|
|
1012
|
+
...(media.gifPlayback !== undefined ? { gifPlayback: media.gifPlayback } : {}),
|
|
1013
|
+
...options
|
|
1014
|
+
}, {
|
|
1015
|
+
userJid,
|
|
1016
|
+
upload: async (readStream, opts) => {
|
|
1017
|
+
const up = await waUploadToServer(readStream, { ...opts, newsletter: (0, WABinary_1.isJidNewsletter)(jid) });
|
|
1018
|
+
mediaHandle = up.handle;
|
|
1019
|
+
return up;
|
|
1020
|
+
},
|
|
1021
|
+
...options,
|
|
1022
|
+
});
|
|
1023
|
+
}
|
|
1024
|
+
if (mediaMsg) {
|
|
1025
|
+
mediaMsg.message.messageContextInfo = {
|
|
1026
|
+
messageSecret: (0, crypto_1.randomBytes)(32),
|
|
1027
|
+
messageAssociation: {
|
|
1028
|
+
associationType: 1,
|
|
1029
|
+
parentMessageKey: albumMsg.key
|
|
1030
|
+
}
|
|
1031
|
+
};
|
|
1032
|
+
}
|
|
1033
|
+
await relayMessage(jid, mediaMsg.message, {
|
|
1034
|
+
messageId: mediaMsg.key.id
|
|
1035
|
+
});
|
|
1036
|
+
await new Promise(resolve => setTimeout(resolve, 800));
|
|
1037
|
+
}
|
|
1038
|
+
return albumMsg;
|
|
1039
|
+
}
|
|
1040
|
+
else {
|
|
1041
|
+
let mediaHandle;
|
|
1042
|
+
const fullMsg = await (0, Utils_1.generateWAMessage)(jid, content, {
|
|
752
1043
|
logger,
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
1044
|
+
userJid,
|
|
1045
|
+
getUrlInfo: text => (0, link_preview_1.getUrlInfo)(text, {
|
|
1046
|
+
thumbnailWidth: linkPreviewImageThumbnailWidth,
|
|
1047
|
+
fetchOpts: {
|
|
1048
|
+
timeout: 3000,
|
|
1049
|
+
...axiosOptions || {}
|
|
1050
|
+
},
|
|
1051
|
+
logger,
|
|
1052
|
+
uploadImage: generateHighQualityLinkPreview
|
|
1053
|
+
? waUploadToServer
|
|
1054
|
+
: undefined
|
|
1055
|
+
}),
|
|
1056
|
+
getProfilePicUrl: sock.profilePictureUrl,
|
|
1057
|
+
upload: async (readStream, opts) => {
|
|
1058
|
+
const up = await waUploadToServer(readStream, { ...opts, newsletter: (0, WABinary_1.isJidNewsletter)(jid) });
|
|
1059
|
+
mediaHandle = up.handle;
|
|
1060
|
+
return up;
|
|
1061
|
+
},
|
|
1062
|
+
mediaCache: config.mediaCache,
|
|
1063
|
+
options: config.options,
|
|
1064
|
+
messageId: (0, Utils_1.generateMessageIDV2)((_c = sock.user) === null || _c === void 0 ? void 0 : _c.id),
|
|
1065
|
+
...options,
|
|
1066
|
+
});
|
|
1067
|
+
const isDeleteMsg = 'delete' in content && !!content.delete;
|
|
1068
|
+
const isEditMsg = 'edit' in content && !!content.edit;
|
|
1069
|
+
const isPinMsg = 'pin' in content && !!content.pin;
|
|
1070
|
+
const isKeepMsg = 'keep' in content && content.keep;
|
|
1071
|
+
const isPollMessage = 'poll' in content && !!content.poll;
|
|
1072
|
+
const isAiMsg = 'ai' in content && !!content.ai;
|
|
1073
|
+
const additionalAttributes = {};
|
|
1074
|
+
const additionalNodes = [];
|
|
1075
|
+
// required for delete
|
|
1076
|
+
if (isDeleteMsg) {
|
|
1077
|
+
// if the chat is a group, and I am not the author, then delete the message as an admin
|
|
1078
|
+
if (((0, WABinary_1.isJidGroup)(content.delete.remoteJid) && !content.delete.fromMe) || (0, WABinary_1.isJidNewsletter)(jid)) {
|
|
1079
|
+
additionalAttributes.edit = '8';
|
|
1080
|
+
}
|
|
1081
|
+
else {
|
|
1082
|
+
additionalAttributes.edit = '7';
|
|
1083
|
+
}
|
|
1084
|
+
// required for edit message
|
|
1085
|
+
}
|
|
1086
|
+
else if (isEditMsg) {
|
|
1087
|
+
additionalAttributes.edit = (0, WABinary_1.isJidNewsletter)(jid) ? '3' : '1';
|
|
1088
|
+
// required for pin message
|
|
1089
|
+
}
|
|
1090
|
+
else if (isPinMsg) {
|
|
1091
|
+
additionalAttributes.edit = '2';
|
|
1092
|
+
// required for keep message
|
|
1093
|
+
}
|
|
1094
|
+
else if (isKeepMsg) {
|
|
1095
|
+
additionalAttributes.edit = '6';
|
|
1096
|
+
// required for polling message
|
|
1097
|
+
}
|
|
1098
|
+
else if (isPollMessage) {
|
|
1099
|
+
additionalNodes.push({
|
|
1100
|
+
tag: 'meta',
|
|
1101
|
+
attrs: {
|
|
1102
|
+
polltype: 'creation'
|
|
1103
|
+
},
|
|
759
1104
|
});
|
|
760
|
-
|
|
761
|
-
}
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
...options
|
|
765
|
-
});
|
|
766
|
-
|
|
767
|
-
const isDeleteMsg = 'delete' in content && !!content.delete;
|
|
768
|
-
const isEditMsg = 'edit' in content && !!content.edit;
|
|
769
|
-
const isAiMsg = 'ai' in content && !!content.ai;
|
|
770
|
-
|
|
771
|
-
const additionalAttributes = {};
|
|
772
|
-
const additionalNodes = [];
|
|
773
|
-
|
|
774
|
-
if (isDeleteMsg) {
|
|
775
|
-
const fromMe = content.delete?.fromMe;
|
|
776
|
-
const isGroup = WABinary_1.isJidGroup(content.delete?.remoteJid);
|
|
777
|
-
additionalAttributes.edit = (isGroup && !fromMe) || WABinary_1.isJidNewsLetter(jid) ? '8' : '7';
|
|
778
|
-
} else if (isEditMsg) {
|
|
779
|
-
additionalAttributes.edit = WABinary_1.isJidNewsLetter(jid) ? '3' : '1';
|
|
780
|
-
} else if (isAiMsg) {
|
|
781
|
-
additionalNodes.push({
|
|
1105
|
+
// required to display AI icon on message
|
|
1106
|
+
}
|
|
1107
|
+
else if (isAiMsg) {
|
|
1108
|
+
additionalNodes.push({
|
|
782
1109
|
attrs: {
|
|
783
1110
|
biz_bot: '1'
|
|
784
1111
|
}, tag: "bot"
|
|
785
1112
|
});
|
|
1113
|
+
}
|
|
1114
|
+
if (mediaHandle) {
|
|
1115
|
+
additionalAttributes['media_id'] = mediaHandle;
|
|
1116
|
+
}
|
|
1117
|
+
if ('cachedGroupMetadata' in options) {
|
|
1118
|
+
console.warn('cachedGroupMetadata in sendMessage are deprecated, now cachedGroupMetadata is part of the socket config.');
|
|
1119
|
+
}
|
|
1120
|
+
await relayMessage(jid, fullMsg.message, { messageId: fullMsg.key.id, useCachedGroupMetadata: options.useCachedGroupMetadata, additionalAttributes, additionalNodes: isAiMsg ? additionalNodes : options.additionalNodes, statusJidList: options.statusJidList });
|
|
1121
|
+
if (config.emitOwnEvents) {
|
|
1122
|
+
process.nextTick(() => {
|
|
1123
|
+
processingMutex.mutex(() => (upsertMessage(fullMsg, 'append')));
|
|
1124
|
+
});
|
|
1125
|
+
}
|
|
1126
|
+
return fullMsg;
|
|
786
1127
|
}
|
|
787
|
-
|
|
788
|
-
await relayMessage(jid, fullMsg.message, {
|
|
789
|
-
messageId: fullMsg.key.id,
|
|
790
|
-
cachedGroupMetadata: options.cachedGroupMetadata,
|
|
791
|
-
additionalNodes: isAiMsg ? additionalNodes : options.additionalNodes,
|
|
792
|
-
additionalAttributes,
|
|
793
|
-
statusJidList: options.statusJidList
|
|
794
|
-
});
|
|
795
|
-
|
|
796
|
-
if (config.emitOwnEvents) {
|
|
797
|
-
process.nextTick(() => {
|
|
798
|
-
processingMutex.mutex(() => upsertMessage(fullMsg, 'append'));
|
|
799
|
-
});
|
|
800
|
-
}
|
|
801
|
-
return fullMsg;
|
|
802
1128
|
}
|
|
803
|
-
}
|
|
1129
|
+
};
|
|
804
1130
|
};
|
|
805
1131
|
exports.makeMessagesSocket = makeMessagesSocket;
|