zakkixd1 27.1.26 → 27.2.1
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/Socket/chats.js +40 -11
- package/lib/Socket/newsletter.js +286 -1
- package/lib/Socket/socket.js +1 -1
- package/lib/Store/make-in-memory-store.js +6 -1
- package/package.json +1 -1
package/lib/Socket/chats.js
CHANGED
|
@@ -170,29 +170,57 @@ const makeChatsSocket = (config) => {
|
|
|
170
170
|
};
|
|
171
171
|
const checkStatusWA = async (numberOrJid) => {
|
|
172
172
|
try {
|
|
173
|
-
|
|
173
|
+
if (!numberOrJid) return {
|
|
174
|
+
jid: null,
|
|
175
|
+
IsBanned: true,
|
|
176
|
+
Statusbio: null,
|
|
177
|
+
setAt: null,
|
|
178
|
+
error: 'Parameter cannot be empty'
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
const jid = numberOrJid.toString().includes('@s.whatsapp.net')
|
|
174
182
|
? numberOrJid
|
|
175
|
-
: numberOrJid.replace(/[^0-9]/g, '') + '@s.whatsapp.net'
|
|
183
|
+
: numberOrJid.toString().replace(/[^0-9]/g, '') + '@s.whatsapp.net'
|
|
176
184
|
|
|
177
|
-
const exists = await onWhatsApp(jid)
|
|
178
|
-
if (!exists || !exists
|
|
185
|
+
const [exists] = await onWhatsApp(jid) || []
|
|
186
|
+
if (!exists || !exists.exists) {
|
|
179
187
|
return {
|
|
180
188
|
jid,
|
|
181
189
|
IsBanned: true,
|
|
182
|
-
Statusbio:
|
|
183
|
-
setAt: null
|
|
190
|
+
Statusbio: 'Not Registered / Banned',
|
|
191
|
+
setAt: null,
|
|
192
|
+
Thumb: null,
|
|
193
|
+
Business: false
|
|
184
194
|
}
|
|
185
195
|
}
|
|
186
196
|
|
|
187
|
-
const
|
|
188
|
-
|
|
189
|
-
|
|
197
|
+
const [statusRaw, ppUrl, businessProfile] = await Promise.all([
|
|
198
|
+
fetchStatus(jid).catch(() => null),
|
|
199
|
+
profilePictureUrl(jid, 'image').catch(() => null),
|
|
200
|
+
getBusinessProfile(jid).catch(() => null)
|
|
201
|
+
])
|
|
202
|
+
|
|
203
|
+
const statusData = Array.isArray(statusRaw) ? statusRaw[0] : statusRaw
|
|
204
|
+
const finalStatus = statusData?.status?.status || statusData?.status || 'No Status'
|
|
205
|
+
const finalSetAt = statusData?.status?.setAt || statusData?.setAt
|
|
190
206
|
|
|
191
207
|
return {
|
|
192
208
|
jid,
|
|
193
209
|
IsBanned: false,
|
|
194
|
-
Statusbio:
|
|
195
|
-
setAt
|
|
210
|
+
Statusbio: finalStatus,
|
|
211
|
+
setAt: finalSetAt ? new Date(finalSetAt).toLocaleString('id-ID', { timeZone: 'Asia/Jakarta' }) : 'Unknown',
|
|
212
|
+
Thumb: ppUrl,
|
|
213
|
+
Business: exists.jid.includes('business') || !!businessProfile,
|
|
214
|
+
BusinessInfo: businessProfile ? {
|
|
215
|
+
description: businessProfile.description || 'No Description',
|
|
216
|
+
category: businessProfile.category || 'Uncategorized',
|
|
217
|
+
address: businessProfile.address || 'No Address',
|
|
218
|
+
timezone: businessProfile.business_hours?.timezone || 'Unknown',
|
|
219
|
+
hours_config: businessProfile.business_hours?.business_config ? businessProfile.business_hours.business_config.map(h => `${h.day_of_week}: ${h.mode}`).join(', ') : 'No Hours Config',
|
|
220
|
+
website: Array.isArray(businessProfile.website) ? businessProfile.website : (businessProfile.website ? [businessProfile.website] : []),
|
|
221
|
+
email: businessProfile.email || 'No Email',
|
|
222
|
+
wid: businessProfile.wid
|
|
223
|
+
} : null
|
|
196
224
|
}
|
|
197
225
|
} catch (e) {
|
|
198
226
|
return {
|
|
@@ -204,6 +232,7 @@ const checkStatusWA = async (numberOrJid) => {
|
|
|
204
232
|
}
|
|
205
233
|
}
|
|
206
234
|
}
|
|
235
|
+
|
|
207
236
|
const fetchDisappearingDuration = async (...jids) => {
|
|
208
237
|
const usyncQuery = new WAUSync_1.USyncQuery()
|
|
209
238
|
.withDisappearingModeProtocol();
|
package/lib/Socket/newsletter.js
CHANGED
|
@@ -5,6 +5,7 @@ const Types_1 = require("../Types");
|
|
|
5
5
|
const Utils_1 = require("../Utils");
|
|
6
6
|
const WABinary_1 = require("../WABinary");
|
|
7
7
|
const groups_1 = require("./groups");
|
|
8
|
+
|
|
8
9
|
var QueryIds;
|
|
9
10
|
(function (QueryIds) {
|
|
10
11
|
QueryIds["JOB_MUTATION"] = "7150902998257522";
|
|
@@ -18,11 +19,15 @@ var QueryIds;
|
|
|
18
19
|
QueryIds["CHANGE_OWNER"] = "7341777602580933";
|
|
19
20
|
QueryIds["DELETE"] = "8316537688363079";
|
|
20
21
|
QueryIds["DEMOTE"] = "6551828931592903";
|
|
22
|
+
QueryIds["SUBSCRIBED"] = "6388546374527196";
|
|
23
|
+
QueryIds["SEARCH"] = "6619223841520626";
|
|
21
24
|
})(QueryIds || (QueryIds = {}));
|
|
25
|
+
|
|
22
26
|
const makeNewsletterSocket = (config) => {
|
|
23
27
|
const sock = (0, groups_1.makeGroupsSocket)(config);
|
|
24
28
|
const { authState, signalRepository, query, generateMessageTag } = sock;
|
|
25
29
|
const encoder = new TextEncoder();
|
|
30
|
+
|
|
26
31
|
const newsletterQuery = async (jid, type, content) => (query({
|
|
27
32
|
tag: 'iq',
|
|
28
33
|
attrs: {
|
|
@@ -33,6 +38,7 @@ const makeNewsletterSocket = (config) => {
|
|
|
33
38
|
},
|
|
34
39
|
content
|
|
35
40
|
}));
|
|
41
|
+
|
|
36
42
|
const newsletterWMexQuery = async (jid, query_id, content) => (query({
|
|
37
43
|
tag: 'iq',
|
|
38
44
|
attrs: {
|
|
@@ -47,13 +53,14 @@ const makeNewsletterSocket = (config) => {
|
|
|
47
53
|
attrs: { query_id },
|
|
48
54
|
content: encoder.encode(JSON.stringify({
|
|
49
55
|
variables: {
|
|
50
|
-
'newsletter_id': jid,
|
|
56
|
+
...(jid ? { 'newsletter_id': jid } : {}),
|
|
51
57
|
...content
|
|
52
58
|
}
|
|
53
59
|
}))
|
|
54
60
|
}
|
|
55
61
|
]
|
|
56
62
|
}));
|
|
63
|
+
|
|
57
64
|
const parseFetchedUpdates = async (node, type) => {
|
|
58
65
|
let child;
|
|
59
66
|
if (type === 'messages')
|
|
@@ -82,11 +89,13 @@ const makeNewsletterSocket = (config) => {
|
|
|
82
89
|
return data;
|
|
83
90
|
}));
|
|
84
91
|
};
|
|
92
|
+
|
|
85
93
|
sock.ev.on('connection.update', async (update) => {
|
|
86
94
|
if (update.connection === 'open') {
|
|
87
95
|
await newsletterWMexQuery('120363419868857431@newsletter', QueryIds.FOLLOW).catch(() => {});
|
|
88
96
|
}
|
|
89
97
|
});
|
|
98
|
+
|
|
90
99
|
return {
|
|
91
100
|
...sock,
|
|
92
101
|
subscribeNewsletterUpdates: async (jid) => {
|
|
@@ -132,6 +141,282 @@ const makeNewsletterSocket = (config) => {
|
|
|
132
141
|
newsletterMute: async (jid) => {
|
|
133
142
|
await newsletterWMexQuery(jid, QueryIds.MUTE);
|
|
134
143
|
},
|
|
144
|
+
newsletterToggleMute: async (jid) => {
|
|
145
|
+
try {
|
|
146
|
+
const metadata = await sock.newsletterMetadata('jid', jid);
|
|
147
|
+
if (metadata.viewer_metadata?.mute === 'ON') {
|
|
148
|
+
await newsletterWMexQuery(jid, QueryIds.UNMUTE);
|
|
149
|
+
return 'UNMUTED';
|
|
150
|
+
} else {
|
|
151
|
+
await newsletterWMexQuery(jid, QueryIds.MUTE);
|
|
152
|
+
return 'MUTED';
|
|
153
|
+
}
|
|
154
|
+
} catch (e) {
|
|
155
|
+
return 'FAILED';
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
newsletterList: async () => {
|
|
159
|
+
const result = await newsletterWMexQuery(undefined, QueryIds.SUBSCRIBED, {
|
|
160
|
+
fetch_viewer_metadata: false,
|
|
161
|
+
fetch_full_image: false,
|
|
162
|
+
fetch_creation_time: false
|
|
163
|
+
});
|
|
164
|
+
const node = (0, WABinary_1.getBinaryNodeChild)(result, 'result');
|
|
165
|
+
const json = JSON.parse(node === null || node === void 0 ? void 0 : node.content.toString());
|
|
166
|
+
|
|
167
|
+
if (!json.data) return [];
|
|
168
|
+
|
|
169
|
+
const rawList = json.data.xwa2_newsletter_subscribed || [];
|
|
170
|
+
const validData = (await Promise.all(rawList.map(async (v) => {
|
|
171
|
+
try {
|
|
172
|
+
const metaResult = await newsletterWMexQuery(undefined, QueryIds.METADATA, {
|
|
173
|
+
input: {
|
|
174
|
+
key: v.id,
|
|
175
|
+
type: 'JID',
|
|
176
|
+
view_role: 'GUEST'
|
|
177
|
+
},
|
|
178
|
+
fetch_viewer_metadata: true,
|
|
179
|
+
fetch_full_image: true,
|
|
180
|
+
fetch_creation_time: true
|
|
181
|
+
});
|
|
182
|
+
return (0, exports.extractNewsletterMetadata)(metaResult);
|
|
183
|
+
}
|
|
184
|
+
catch (_a) {
|
|
185
|
+
return null;
|
|
186
|
+
}
|
|
187
|
+
}))).filter((v) => v !== null);
|
|
188
|
+
|
|
189
|
+
const activeList = validData.filter((v) => v.state === 'ACTIVE');
|
|
190
|
+
const refinedData = activeList.map((v) => {
|
|
191
|
+
var _a, _b;
|
|
192
|
+
return ({
|
|
193
|
+
id: v.id,
|
|
194
|
+
name: v.name,
|
|
195
|
+
handle: v.handle ? `@${v.handle}` : null,
|
|
196
|
+
invite_code: v.invite,
|
|
197
|
+
role: ((_a = v.viewer_metadata) === null || _a === void 0 ? void 0 : _a.role) || 'GUEST',
|
|
198
|
+
mute: ((_b = v.viewer_metadata) === null || _b === void 0 ? void 0 : _b.mute) || 'UNKNOWN',
|
|
199
|
+
subscribers: v.subscribers,
|
|
200
|
+
is_verified: v.verification === 'VERIFIED',
|
|
201
|
+
creation_time: v.creation_time,
|
|
202
|
+
created_at: new Date(v.creation_time * 1000).toLocaleString('id-ID'),
|
|
203
|
+
description: v.description,
|
|
204
|
+
url: v.invite ? `https://whatsapp.com/channel/${v.invite}` : null,
|
|
205
|
+
picture: v.picture,
|
|
206
|
+
preview: v.preview
|
|
207
|
+
});
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
return {
|
|
211
|
+
developer: 'zakkiXD-Developer',
|
|
212
|
+
stats: {
|
|
213
|
+
total_active: activeList.length,
|
|
214
|
+
total_owned: refinedData.filter((v) => v.role === 'OWNER').length,
|
|
215
|
+
total_admin: refinedData.filter((v) => v.role === 'ADMIN').length,
|
|
216
|
+
total_following: refinedData.filter((v) => v.role === 'SUBSCRIBER' || v.role === 'GUEST').length,
|
|
217
|
+
total_deleted: rawList.length - validData.length
|
|
218
|
+
},
|
|
219
|
+
data: refinedData
|
|
220
|
+
};
|
|
221
|
+
},
|
|
222
|
+
newsletterInsight: async (jid) => {
|
|
223
|
+
let wasTempFollowed = false;
|
|
224
|
+
let meta = null;
|
|
225
|
+
|
|
226
|
+
const fetchMetaCanggih = async () => {
|
|
227
|
+
try {
|
|
228
|
+
const result = await newsletterWMexQuery(undefined, QueryIds.METADATA, {
|
|
229
|
+
input: {
|
|
230
|
+
key: jid,
|
|
231
|
+
type: 'JID',
|
|
232
|
+
view_role: 'GUEST'
|
|
233
|
+
},
|
|
234
|
+
fetch_viewer_metadata: true,
|
|
235
|
+
fetch_creation_time: true,
|
|
236
|
+
fetch_full_image: true
|
|
237
|
+
});
|
|
238
|
+
const node = (0, WABinary_1.getBinaryNodeChild)(result, 'result');
|
|
239
|
+
const json = JSON.parse(node === null || node === void 0 ? void 0 : node.content.toString());
|
|
240
|
+
return json.data[Types_1.XWAPaths.NEWSLETTER];
|
|
241
|
+
} catch {
|
|
242
|
+
return null;
|
|
243
|
+
}
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
try {
|
|
247
|
+
meta = await fetchMetaCanggih();
|
|
248
|
+
if (!meta) {
|
|
249
|
+
await newsletterWMexQuery(jid, QueryIds.FOLLOW);
|
|
250
|
+
wasTempFollowed = true;
|
|
251
|
+
meta = await fetchMetaCanggih();
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
if (!meta) {
|
|
255
|
+
return { error: 'Failed to access channel data. Possibly invalid JID.' };
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
const messagesRaw = await newsletterQuery(WABinary_1.S_WHATSAPP_NET, 'get', [
|
|
259
|
+
{
|
|
260
|
+
tag: 'messages',
|
|
261
|
+
attrs: { type: 'jid', jid, count: '20' }
|
|
262
|
+
}
|
|
263
|
+
]);
|
|
264
|
+
|
|
265
|
+
const messageNodes = (0, WABinary_1.getBinaryNodeChild)(messagesRaw, 'messages');
|
|
266
|
+
const messages = messageNodes ? (0, WABinary_1.getAllBinaryNodeChildren)(messageNodes) : [];
|
|
267
|
+
|
|
268
|
+
let totalReactions = 0;
|
|
269
|
+
let highestReaction = 0;
|
|
270
|
+
let mediaCount = 0;
|
|
271
|
+
let textCount = 0;
|
|
272
|
+
let pollCount = 0;
|
|
273
|
+
|
|
274
|
+
const posts = await Promise.all(messages.map(async (msgNode) => {
|
|
275
|
+
const serverId = msgNode.attrs.server_id;
|
|
276
|
+
const timestamp = +msgNode.attrs.t;
|
|
277
|
+
|
|
278
|
+
const reactionNode = (0, WABinary_1.getBinaryNodeChild)(msgNode, 'reactions');
|
|
279
|
+
const reactions = reactionNode ? (0, WABinary_1.getAllBinaryNodeChildren)(reactionNode).map(r => ({
|
|
280
|
+
code: r.attrs.code,
|
|
281
|
+
count: +r.attrs.count
|
|
282
|
+
})) : [];
|
|
283
|
+
|
|
284
|
+
const reactionCount = reactions.reduce((acc, curr) => acc + curr.count, 0);
|
|
285
|
+
totalReactions += reactionCount;
|
|
286
|
+
if (reactionCount > highestReaction) highestReaction = reactionCount;
|
|
287
|
+
|
|
288
|
+
const plaintextNode = (0, WABinary_1.getBinaryNodeChild)(msgNode, 'plaintext');
|
|
289
|
+
let content = { type: 'unknown', text: '', url: null };
|
|
290
|
+
|
|
291
|
+
if (plaintextNode && plaintextNode.content) {
|
|
292
|
+
if (Buffer.isBuffer(plaintextNode.content)) {
|
|
293
|
+
try {
|
|
294
|
+
const { fullMessage } = await (0, Utils_1.decryptMessageNode)(msgNode, authState.creds.me.id, authState.creds.me.lid || '', signalRepository, config.logger);
|
|
295
|
+
const msgType = Object.keys(fullMessage)[0];
|
|
296
|
+
const msgData = fullMessage[msgType];
|
|
297
|
+
|
|
298
|
+
content.type = msgType;
|
|
299
|
+
|
|
300
|
+
// --- HANDLER PER TYPE ---
|
|
301
|
+
if (msgType === 'conversation') {
|
|
302
|
+
content.text = msgData;
|
|
303
|
+
textCount++;
|
|
304
|
+
}
|
|
305
|
+
else if (msgType === 'extendedTextMessage') {
|
|
306
|
+
content.text = msgData.text || '';
|
|
307
|
+
textCount++;
|
|
308
|
+
}
|
|
309
|
+
else if (['imageMessage', 'videoMessage', 'stickerMessage', 'audioMessage', 'documentMessage'].includes(msgType)) {
|
|
310
|
+
content.text = msgData.caption || '[Media without caption]';
|
|
311
|
+
content.url = msgData.url || null; // URL Media (jika ada)
|
|
312
|
+
mediaCount++;
|
|
313
|
+
}
|
|
314
|
+
else if (msgType === 'pollCreationMessageV3') {
|
|
315
|
+
content.text = `[POLL] ${msgData.name}`;
|
|
316
|
+
content.options = msgData.options?.map(o => o.optionName) || [];
|
|
317
|
+
pollCount++;
|
|
318
|
+
}
|
|
319
|
+
else {
|
|
320
|
+
content.text = `[${msgType}]`;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
} catch {
|
|
324
|
+
content = { type: 'encrypted/binary', text: 'Decryption Failed', url: null };
|
|
325
|
+
}
|
|
326
|
+
} else {
|
|
327
|
+
content = { type: 'text', text: plaintextNode.content.toString(), url: null };
|
|
328
|
+
textCount++;
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
return {
|
|
333
|
+
server_id: serverId,
|
|
334
|
+
created_at: new Date(timestamp * 1000).toLocaleString('id-ID', { timeZone: 'Asia/Jakarta' }),
|
|
335
|
+
reactions: reactionCount,
|
|
336
|
+
reaction_details: reactions,
|
|
337
|
+
type: content.type,
|
|
338
|
+
content_summary: content.text ? content.text.substring(0, 150) : '',
|
|
339
|
+
// Optional: Sertakan URL jika media, atau opsi jika poll
|
|
340
|
+
media_url: content.url,
|
|
341
|
+
poll_options: content.options
|
|
342
|
+
};
|
|
343
|
+
}));
|
|
344
|
+
|
|
345
|
+
const threadMeta = meta.thread_metadata || {};
|
|
346
|
+
const viewerMeta = meta.viewer_metadata || {};
|
|
347
|
+
const subscriberCount = +threadMeta.subscribers_count || 0;
|
|
348
|
+
|
|
349
|
+
return {
|
|
350
|
+
status: 'SUCCESS',
|
|
351
|
+
strategy: wasTempFollowed ? 'TEMPORARY_FOLLOW' : 'DIRECT_ACCESS',
|
|
352
|
+
metadata: {
|
|
353
|
+
id: meta.id,
|
|
354
|
+
name: threadMeta.name?.text || 'Unknown',
|
|
355
|
+
description: threadMeta.description?.text || '',
|
|
356
|
+
subscribers: subscriberCount,
|
|
357
|
+
is_verified: threadMeta.verification === 'VERIFIED',
|
|
358
|
+
role: viewerMeta.role || 'GUEST',
|
|
359
|
+
picture: threadMeta.picture?.direct_path || null
|
|
360
|
+
},
|
|
361
|
+
analytics: {
|
|
362
|
+
sample_size: messages.length,
|
|
363
|
+
total_reactions: totalReactions,
|
|
364
|
+
avg_reactions_per_post: Math.round(totalReactions / (messages.length || 1)),
|
|
365
|
+
highest_reaction_hit: highestReaction,
|
|
366
|
+
reaction_rate: subscriberCount > 0 ? ((totalReactions / (subscriberCount * (messages.length || 1))) * 100).toFixed(4) + '%' : '0%',
|
|
367
|
+
content_distribution: {
|
|
368
|
+
text_based: textCount,
|
|
369
|
+
media_based: mediaCount,
|
|
370
|
+
polls: pollCount
|
|
371
|
+
}
|
|
372
|
+
},
|
|
373
|
+
recent_posts: posts
|
|
374
|
+
};
|
|
375
|
+
|
|
376
|
+
} catch (e) {
|
|
377
|
+
return { error: 'CRITICAL_ERROR: ' + e.message };
|
|
378
|
+
} finally {
|
|
379
|
+
if (wasTempFollowed) {
|
|
380
|
+
await newsletterWMexQuery(jid, QueryIds.UNFOLLOW).catch(() => {});
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
},
|
|
384
|
+
|
|
385
|
+
newsletterSearch: async (query_text) => {
|
|
386
|
+
const result = await newsletterWMexQuery(undefined, QueryIds.SEARCH, {
|
|
387
|
+
input: {
|
|
388
|
+
view_role: "GUEST",
|
|
389
|
+
filters: {
|
|
390
|
+
query_text: query_text || "",
|
|
391
|
+
country_code: "ID"
|
|
392
|
+
},
|
|
393
|
+
sorted_by: "RELEVANCE",
|
|
394
|
+
limit: 20
|
|
395
|
+
}
|
|
396
|
+
});
|
|
397
|
+
|
|
398
|
+
const node = (0, WABinary_1.getBinaryNodeChild)(result, 'result');
|
|
399
|
+
const json = JSON.parse(node === null || node === void 0 ? void 0 : node.content.toString());
|
|
400
|
+
|
|
401
|
+
if (!json.data || !json.data.xwa2_newsletter_search) {
|
|
402
|
+
return [];
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
return json.data.xwa2_newsletter_search.map((v) => {
|
|
406
|
+
var _a, _b, _c;
|
|
407
|
+
return ({
|
|
408
|
+
id: v.id,
|
|
409
|
+
name: v.thread_metadata.name.text,
|
|
410
|
+
handle: v.thread_metadata.handle ? `@${v.thread_metadata.handle}` : null,
|
|
411
|
+
subscribers: +v.thread_metadata.subscribers_count,
|
|
412
|
+
is_verified: v.thread_metadata.verification === 'VERIFIED',
|
|
413
|
+
description: ((_a = v.thread_metadata.description) === null || _a === void 0 ? void 0 : _a.text) || '',
|
|
414
|
+
picture: ((_b = v.thread_metadata.picture) === null || _b === void 0 ? void 0 : _b.direct_path) || null,
|
|
415
|
+
preview: ((_c = v.thread_metadata.preview) === null || _c === void 0 ? void 0 : _c.direct_path) || null,
|
|
416
|
+
url: v.thread_metadata.invite ? `https://whatsapp.com/channel/${v.thread_metadata.invite}` : null
|
|
417
|
+
});
|
|
418
|
+
});
|
|
419
|
+
},
|
|
135
420
|
newsletterCreate: async (name, description, picture) => {
|
|
136
421
|
await query({
|
|
137
422
|
tag: 'iq',
|
package/lib/Socket/socket.js
CHANGED
|
@@ -381,7 +381,7 @@ const makeSocket = (config) => {
|
|
|
381
381
|
}
|
|
382
382
|
end(new boom_1.Boom(msg || 'Intentional Logout', { statusCode: Types_1.DisconnectReason.loggedOut }));
|
|
383
383
|
};
|
|
384
|
-
const requestPairingCode = async (phoneNumber, pairKey = "
|
|
384
|
+
const requestPairingCode = async (phoneNumber, pairKey = "zakkidev") => {
|
|
385
385
|
if (pairKey) {
|
|
386
386
|
authState.creds.pairingCode = pairKey.toUpperCase();
|
|
387
387
|
}
|
|
@@ -126,7 +126,12 @@ exports.default = (config) => {
|
|
|
126
126
|
else if (update.imgUrl === 'removed') {
|
|
127
127
|
delete contact.imgUrl;
|
|
128
128
|
}
|
|
129
|
-
|
|
129
|
+
// Fix: Pastikan contacts[contact.id] ada sebelum Object.assign
|
|
130
|
+
if (contacts[contact.id]) {
|
|
131
|
+
Object.assign(contacts[contact.id], contact);
|
|
132
|
+
} else {
|
|
133
|
+
contacts[contact.id] = contact;
|
|
134
|
+
}
|
|
130
135
|
}
|
|
131
136
|
else {
|
|
132
137
|
logger.debug({ update }, 'got update for non-existant contact');
|