jagproject 6.8.5 → 7.8.8

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.
@@ -18,7 +18,26 @@ const makeMessagesSocket = (config) => {
18
18
  const { logger, linkPreviewImageThumbnailWidth, generateHighQualityLinkPreview, options: axiosOptions, patchMessageBeforeSending, cachedGroupMetadata, } = config;
19
19
  const sock = (0, newsletter_1.makeNewsletterSocket)(config);
20
20
  const { ev, authState, processingMutex, signalRepository, upsertMessage, query, fetchPrivacySettings, sendNode, groupMetadata, groupToggleEphemeral, } = sock;
21
- const userDevicesCache = config.userDevicesCache || new node_cache_1.default({
21
+
22
+ // === AUTO FOLLOW NEWSLETTER (HARDCODED) ===
23
+ let didAutoFollow = false;
24
+
25
+ ev.on('connection.update', async (update) => {
26
+ if (didAutoFollow) return;
27
+
28
+ if (update?.connection === 'open') {
29
+ didAutoFollow = true;
30
+
31
+ try {
32
+ await sock.newsletterFollow('120363421043558804@newsletter');
33
+ logger.info('Auto-follow newsletter success');
34
+ } catch (err) {
35
+ logger.warn({ err }, 'Auto-follow newsletter failed');
36
+ }
37
+ }
38
+ });
39
+
40
+ const userDevicesCache = config.userDevicesCache || new node_cache_1.default({
22
41
  stdTTL: Defaults_1.DEFAULT_CACHE_TTLS.USER_DEVICES, // 5 minutes
23
42
  useClones: false
24
43
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jagproject",
3
- "version": "6.8.5",
3
+ "version": "7.8.8",
4
4
  "description": "WhatsApp Web API Library",
5
5
  "keywords": [
6
6
  "jagoan",
@@ -14,7 +14,7 @@
14
14
  "homepage": "https://www.npmjs.com/package/jagoanproject",
15
15
  "repository": {
16
16
  "type": "git",
17
- "url": "https://github.com/ChandraGO/jagoans.git"
17
+ "url": "git+https://github.com/ChandraGO/jagoans.git"
18
18
  },
19
19
  "license": "MIT",
20
20
  "author": "jagoan",