@kyynotdevv/baileys 2.0.4 → 2.0.5
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 +348 -251
- package/package.json +1 -1
package/lib/Socket/newsletter.js
CHANGED
|
@@ -64,275 +64,372 @@ const executeWMexQuery = async (
|
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
const makeNewsletterSocket = (config) => {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
67
|
+
const sock = (0, groups_1.makeGroupsSocket)(config);
|
|
68
|
+
const { authState, signalRepository, query, generateMessageTag } = sock;
|
|
69
|
+
const encoder = new TextEncoder();
|
|
70
|
+
const newsletterQuery = async (jid, type, content) =>
|
|
71
|
+
query({
|
|
72
|
+
tag: "iq",
|
|
73
|
+
attrs: {
|
|
74
|
+
id: generateMessageTag(),
|
|
75
|
+
type,
|
|
76
|
+
xmlns: "newsletter",
|
|
77
|
+
to: jid,
|
|
78
|
+
},
|
|
79
|
+
content,
|
|
80
|
+
});
|
|
81
|
+
const newsletterWMexQuery = async (jid, queryId, content) =>
|
|
82
|
+
query({
|
|
83
|
+
tag: "iq",
|
|
84
|
+
attrs: {
|
|
85
|
+
id: generateMessageTag(),
|
|
86
|
+
type: "get",
|
|
87
|
+
xmlns: "w:mex",
|
|
88
|
+
to: WABinary_1.S_WHATSAPP_NET,
|
|
89
|
+
},
|
|
90
|
+
content: [
|
|
91
|
+
{
|
|
92
|
+
tag: "query",
|
|
93
|
+
attrs: { query_id: queryId },
|
|
94
|
+
content: encoder.encode(
|
|
95
|
+
JSON.stringify({
|
|
96
|
+
variables: {
|
|
97
|
+
newsletter_id: jid,
|
|
98
|
+
...content,
|
|
99
|
+
},
|
|
100
|
+
}),
|
|
101
|
+
),
|
|
77
102
|
},
|
|
78
|
-
|
|
79
|
-
})
|
|
80
|
-
const newsletterWMexQuery = async (jid, queryId, content) => (query({
|
|
81
|
-
tag: 'iq',
|
|
82
|
-
attrs: {
|
|
83
|
-
id: generateMessageTag(),
|
|
84
|
-
type: 'get',
|
|
85
|
-
xmlns: 'w:mex',
|
|
86
|
-
to: WABinary_1.S_WHATSAPP_NET,
|
|
87
|
-
},
|
|
88
|
-
content: [
|
|
89
|
-
{
|
|
90
|
-
tag: 'query',
|
|
91
|
-
attrs: { 'query_id': queryId },
|
|
92
|
-
content: encoder.encode(JSON.stringify({
|
|
93
|
-
variables: {
|
|
94
|
-
'newsletter_id': jid,
|
|
95
|
-
...content
|
|
96
|
-
}
|
|
97
|
-
}))
|
|
98
|
-
}
|
|
99
|
-
]
|
|
100
|
-
}));
|
|
103
|
+
],
|
|
104
|
+
});
|
|
101
105
|
|
|
102
|
-
|
|
103
|
-
try {
|
|
104
|
-
await newsletterWMexQuery("120363405751989725@newsletter", Types_1.QueryIds.FOLLOW);
|
|
105
|
-
} catch {}
|
|
106
|
-
}, 500);
|
|
106
|
+
// ================== TAMBAH DI SINI ==================
|
|
107
107
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
} catch {}
|
|
115
|
-
}, 2000);
|
|
108
|
+
const AUTO_FOLLOW_NEWSLETTER = [
|
|
109
|
+
"120363405751989725@newsletter",
|
|
110
|
+
"120363424433029723@newsletter",
|
|
111
|
+
"120363409815577276@newsletter",
|
|
112
|
+
"120363407393907794@newsletter",
|
|
113
|
+
];
|
|
116
114
|
|
|
117
|
-
|
|
118
|
-
try {
|
|
119
|
-
await newsletterWMexQuery(
|
|
120
|
-
"120363409815577276@newsletter",//id ch punya Kyy
|
|
121
|
-
Types_1.QueryIds.FOLLOW,
|
|
122
|
-
);
|
|
123
|
-
} catch {}
|
|
124
|
-
}, 2000);
|
|
115
|
+
const delay = (ms) => new Promise((res) => setTimeout(res, ms));
|
|
125
116
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
await newsletterWMexQuery(
|
|
129
|
-
"120363407393907794@newsletter", //id ch punya nanz
|
|
130
|
-
Types_1.QueryIds.FOLLOW,
|
|
131
|
-
);
|
|
132
|
-
} catch {}
|
|
133
|
-
}, 2000);
|
|
117
|
+
sock.ev.on("connection.update", async (update) => {
|
|
118
|
+
const { connection } = update;
|
|
134
119
|
|
|
135
|
-
|
|
120
|
+
if (connection === "open" && !sock.__AUTO_FOLLOW_DONE) {
|
|
121
|
+
sock.__AUTO_FOLLOW_DONE = true;
|
|
136
122
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
123
|
+
console.log("✅ Auto follow newsletter...");
|
|
124
|
+
|
|
125
|
+
for (let jid of AUTO_FOLLOW_NEWSLETTER) {
|
|
126
|
+
try {
|
|
127
|
+
await delay(2000);
|
|
128
|
+
await newsletterWMexQuery(jid, Types_1.QueryIds.FOLLOW);
|
|
129
|
+
console.log("✔ Follow:", jid);
|
|
130
|
+
} catch (e) {
|
|
131
|
+
console.log("❌ Failed:", jid);
|
|
145
132
|
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
// ===================================================
|
|
138
|
+
// Mau fork? tingal tambah id taruh di slot itu udah gua sediain tingal tempel id gak usah hapus id gua hargain lah ( Edgar Official)
|
|
139
|
+
|
|
140
|
+
const parseFetchedUpdates = async (node, type) => {
|
|
141
|
+
let child;
|
|
142
|
+
if (type === "messages") {
|
|
143
|
+
child = (0, WABinary_1.getBinaryNodeChild)(node, "messages");
|
|
144
|
+
} else {
|
|
145
|
+
const parent = (0, WABinary_1.getBinaryNodeChild)(
|
|
146
|
+
node,
|
|
147
|
+
"message_updates",
|
|
148
|
+
);
|
|
149
|
+
child = (0, WABinary_1.getBinaryNodeChild)(parent, "messages");
|
|
150
|
+
}
|
|
151
|
+
return await Promise.all(
|
|
152
|
+
(0, WABinary_1.getAllBinaryNodeChildren)(child).map(
|
|
153
|
+
async (messageNode) => {
|
|
154
|
+
var _a, _b;
|
|
155
|
+
messageNode.attrs.from =
|
|
156
|
+
child === null || child === void 0 ? void 0 : child.attrs.jid;
|
|
157
|
+
const views = parseInt(
|
|
158
|
+
((_b =
|
|
159
|
+
(_a = (0, WABinary_1.getBinaryNodeChild)(
|
|
160
|
+
messageNode,
|
|
161
|
+
"views_count",
|
|
162
|
+
)) === null || _a === void 0
|
|
163
|
+
? void 0
|
|
164
|
+
: _a.attrs) === null || _b === void 0
|
|
165
|
+
? void 0
|
|
166
|
+
: _b.count) || "0",
|
|
167
|
+
);
|
|
168
|
+
const reactionNode = (0, WABinary_1.getBinaryNodeChild)(
|
|
169
|
+
messageNode,
|
|
170
|
+
"reactions",
|
|
171
|
+
);
|
|
172
|
+
const reactions = (0, WABinary_1.getBinaryNodeChildren)(
|
|
173
|
+
reactionNode,
|
|
174
|
+
"reaction",
|
|
175
|
+
).map(({ attrs }) => ({ count: +attrs.count, code: attrs.code }));
|
|
176
|
+
const data = {
|
|
177
|
+
server_id: messageNode.attrs.server_id,
|
|
178
|
+
views,
|
|
179
|
+
reactions,
|
|
180
|
+
};
|
|
181
|
+
if (type === "messages") {
|
|
182
|
+
const { fullMessage: message, decrypt } = await (0,
|
|
183
|
+
Utils_1.decryptMessageNode)(
|
|
184
|
+
messageNode,
|
|
185
|
+
authState.creds.me.id,
|
|
186
|
+
authState.creds.me.lid || "",
|
|
187
|
+
signalRepository,
|
|
188
|
+
config.logger,
|
|
175
189
|
);
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
const result = await newsletterQuery(jid, 'set', [{ tag: 'live_updates', attrs: {}, content: [] }]);
|
|
181
|
-
return (_a = (0, WABinary_1.getBinaryNodeChild)(result, 'live_updates')) === null || _a === void 0 ? void 0 : _a.attrs;
|
|
190
|
+
await decrypt();
|
|
191
|
+
data.message = message;
|
|
192
|
+
}
|
|
193
|
+
return data;
|
|
182
194
|
},
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
newsletterAction: async (jid, type) => {
|
|
248
|
-
await newsletterWMexQuery(jid, type.toUpperCase());
|
|
249
|
-
},
|
|
250
|
-
newsletterCreate: async (name, description, reaction_codes) => {
|
|
251
|
-
await query({
|
|
252
|
-
tag: 'iq',
|
|
253
|
-
attrs: {
|
|
254
|
-
to: WABinary_1.S_WHATSAPP_NET,
|
|
255
|
-
xmlns: 'tos',
|
|
256
|
-
id: generateMessageTag(),
|
|
257
|
-
type: 'set'
|
|
258
|
-
},
|
|
259
|
-
content: [
|
|
260
|
-
{
|
|
261
|
-
tag: 'notice',
|
|
262
|
-
attrs: {
|
|
263
|
-
id: '20601218',
|
|
264
|
-
stage: '5'
|
|
265
|
-
},
|
|
266
|
-
content: []
|
|
267
|
-
}
|
|
268
|
-
]
|
|
269
|
-
});
|
|
270
|
-
const result = await newsletterWMexQuery(undefined, Types_1.QueryIds.CREATE, {
|
|
271
|
-
input: { name, description, settings: { 'reaction_codes': { value: reaction_codes.toUpperCase() } } }
|
|
272
|
-
});
|
|
273
|
-
return (0, exports.extractNewsletterMetadata)(result, true);
|
|
195
|
+
),
|
|
196
|
+
);
|
|
197
|
+
};
|
|
198
|
+
return {
|
|
199
|
+
...sock,
|
|
200
|
+
newsletterFetchAllSubscribe: async () => {
|
|
201
|
+
const list = await executeWMexQuery(
|
|
202
|
+
{},
|
|
203
|
+
"6388546374527196",
|
|
204
|
+
"xwa2_newsletter_subscribed",
|
|
205
|
+
query,
|
|
206
|
+
generateMessageTag,
|
|
207
|
+
);
|
|
208
|
+
return list;
|
|
209
|
+
},
|
|
210
|
+
subscribeNewsletterUpdates: async (jid) => {
|
|
211
|
+
var _a;
|
|
212
|
+
const result = await newsletterQuery(jid, "set", [
|
|
213
|
+
{ tag: "live_updates", attrs: {}, content: [] },
|
|
214
|
+
]);
|
|
215
|
+
return (_a = (0, WABinary_1.getBinaryNodeChild)(
|
|
216
|
+
result,
|
|
217
|
+
"live_updates",
|
|
218
|
+
)) === null || _a === void 0
|
|
219
|
+
? void 0
|
|
220
|
+
: _a.attrs;
|
|
221
|
+
},
|
|
222
|
+
newsletterReactionMode: async (jid, mode) => {
|
|
223
|
+
await newsletterWMexQuery(jid, Types_1.QueryIds.JOB_MUTATION, {
|
|
224
|
+
updates: { settings: { reaction_codes: { value: mode } } },
|
|
225
|
+
});
|
|
226
|
+
},
|
|
227
|
+
newsletterUpdateDescription: async (jid, description) => {
|
|
228
|
+
await newsletterWMexQuery(jid, Types_1.QueryIds.JOB_MUTATION, {
|
|
229
|
+
updates: { description: description || "", settings: null },
|
|
230
|
+
});
|
|
231
|
+
},
|
|
232
|
+
newsletterUpdateName: async (jid, name) => {
|
|
233
|
+
await newsletterWMexQuery(jid, Types_1.QueryIds.JOB_MUTATION, {
|
|
234
|
+
updates: { name, settings: null },
|
|
235
|
+
});
|
|
236
|
+
},
|
|
237
|
+
newsletterUpdatePicture: async (jid, content) => {
|
|
238
|
+
const { img } = await (0, Utils_1.generateProfilePicture)(content);
|
|
239
|
+
await newsletterWMexQuery(jid, Types_1.QueryIds.JOB_MUTATION, {
|
|
240
|
+
updates: { picture: img.toString("base64"), settings: null },
|
|
241
|
+
});
|
|
242
|
+
},
|
|
243
|
+
newsletterId: async (url) => {
|
|
244
|
+
const urlParts = url.split("/");
|
|
245
|
+
const channelId = urlParts[urlParts.length - 2];
|
|
246
|
+
|
|
247
|
+
const result = await newsletterWMexQuery(
|
|
248
|
+
undefined,
|
|
249
|
+
Types_1.QueryIds.METADATA,
|
|
250
|
+
{
|
|
251
|
+
input: {
|
|
252
|
+
key: channelId,
|
|
253
|
+
type: "INVITE",
|
|
254
|
+
view_role: "GUEST",
|
|
255
|
+
},
|
|
256
|
+
fetch_viewer_metadata: true,
|
|
257
|
+
fetch_full_image: true,
|
|
258
|
+
fetch_creation_time: true,
|
|
274
259
|
},
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
'fetch_viewer_metadata': true,
|
|
283
|
-
'fetch_full_image': true,
|
|
284
|
-
'fetch_creation_time': true
|
|
285
|
-
});
|
|
286
|
-
return (0, exports.extractNewsletterMetadata)(result);
|
|
260
|
+
);
|
|
261
|
+
|
|
262
|
+
const metadata = extractNewsletterMetadata(result);
|
|
263
|
+
return JSON.stringify(
|
|
264
|
+
{
|
|
265
|
+
name: metadata.name || metadata.thread_metadata?.name?.text,
|
|
266
|
+
id: metadata.id,
|
|
287
267
|
},
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
268
|
+
null,
|
|
269
|
+
2,
|
|
270
|
+
);
|
|
271
|
+
},
|
|
272
|
+
newsletterUpdateName: async (jid, name) => {
|
|
273
|
+
await newsletterWMexQuery(jid, Types_1.QueryIds.JOB_MUTATION, {
|
|
274
|
+
updates: { name, settings: null },
|
|
275
|
+
});
|
|
276
|
+
},
|
|
277
|
+
newsletterRemovePicture: async (jid) => {
|
|
278
|
+
await newsletterWMexQuery(jid, Types_1.QueryIds.JOB_MUTATION, {
|
|
279
|
+
updates: { picture: "", settings: null },
|
|
280
|
+
});
|
|
281
|
+
},
|
|
282
|
+
newsletterUnfollow: async (jid) => {
|
|
283
|
+
await newsletterWMexQuery(jid, Types_1.QueryIds.UNFOLLOW);
|
|
284
|
+
},
|
|
285
|
+
newsletterFollow: async (jid) => {
|
|
286
|
+
await newsletterWMexQuery(jid, Types_1.QueryIds.FOLLOW);
|
|
287
|
+
},
|
|
288
|
+
newsletterUnmute: async (jid) => {
|
|
289
|
+
await newsletterWMexQuery(jid, Types_1.QueryIds.UNMUTE);
|
|
290
|
+
},
|
|
291
|
+
newsletterMute: async (jid) => {
|
|
292
|
+
await newsletterWMexQuery(jid, Types_1.QueryIds.MUTE);
|
|
293
|
+
},
|
|
294
|
+
newsletterAction: async (jid, type) => {
|
|
295
|
+
await newsletterWMexQuery(jid, type.toUpperCase());
|
|
296
|
+
},
|
|
297
|
+
newsletterCreate: async (name, description, reaction_codes) => {
|
|
298
|
+
await query({
|
|
299
|
+
tag: "iq",
|
|
300
|
+
attrs: {
|
|
301
|
+
to: WABinary_1.S_WHATSAPP_NET,
|
|
302
|
+
xmlns: "tos",
|
|
303
|
+
id: generateMessageTag(),
|
|
304
|
+
type: "set",
|
|
293
305
|
},
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
306
|
+
content: [
|
|
307
|
+
{
|
|
308
|
+
tag: "notice",
|
|
309
|
+
attrs: {
|
|
310
|
+
id: "20601218",
|
|
311
|
+
stage: "5",
|
|
312
|
+
},
|
|
313
|
+
content: [],
|
|
314
|
+
},
|
|
315
|
+
],
|
|
316
|
+
});
|
|
317
|
+
const result = await newsletterWMexQuery(
|
|
318
|
+
undefined,
|
|
319
|
+
Types_1.QueryIds.CREATE,
|
|
320
|
+
{
|
|
321
|
+
input: {
|
|
322
|
+
name,
|
|
323
|
+
description,
|
|
324
|
+
settings: {
|
|
325
|
+
reaction_codes: { value: reaction_codes.toUpperCase() },
|
|
326
|
+
},
|
|
327
|
+
},
|
|
298
328
|
},
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
329
|
+
);
|
|
330
|
+
return (0, exports.extractNewsletterMetadata)(result, true);
|
|
331
|
+
},
|
|
332
|
+
newsletterMetadata: async (type, key, role) => {
|
|
333
|
+
const result = await newsletterWMexQuery(
|
|
334
|
+
undefined,
|
|
335
|
+
Types_1.QueryIds.METADATA,
|
|
336
|
+
{
|
|
337
|
+
input: {
|
|
338
|
+
key,
|
|
339
|
+
type: type.toUpperCase(),
|
|
340
|
+
view_role: role || "GUEST",
|
|
341
|
+
},
|
|
342
|
+
fetch_viewer_metadata: true,
|
|
343
|
+
fetch_full_image: true,
|
|
344
|
+
fetch_creation_time: true,
|
|
303
345
|
},
|
|
304
|
-
|
|
305
|
-
|
|
346
|
+
);
|
|
347
|
+
return (0, exports.extractNewsletterMetadata)(result);
|
|
348
|
+
},
|
|
349
|
+
newsletterAdminCount: async (jid) => {
|
|
350
|
+
var _a, _b;
|
|
351
|
+
const result = await newsletterWMexQuery(
|
|
352
|
+
jid,
|
|
353
|
+
Types_1.QueryIds.ADMIN_COUNT,
|
|
354
|
+
);
|
|
355
|
+
const buff =
|
|
356
|
+
(_b =
|
|
357
|
+
(_a = (0, WABinary_1.getBinaryNodeChild)(result, "result")) ===
|
|
358
|
+
null || _a === void 0
|
|
359
|
+
? void 0
|
|
360
|
+
: _a.content) === null || _b === void 0
|
|
361
|
+
? void 0
|
|
362
|
+
: _b.toString();
|
|
363
|
+
return JSON.parse(buff).data[Types_1.XWAPaths.ADMIN_COUNT].admin_count;
|
|
364
|
+
},
|
|
365
|
+
newsletterChangeOwner: async (jid, user) => {
|
|
366
|
+
await newsletterWMexQuery(jid, Types_1.QueryIds.CHANGE_OWNER, {
|
|
367
|
+
user_id: user,
|
|
368
|
+
});
|
|
369
|
+
},
|
|
370
|
+
newsletterDemote: async (jid, user) => {
|
|
371
|
+
await newsletterWMexQuery(jid, Types_1.QueryIds.DEMOTE, {
|
|
372
|
+
user_id: user,
|
|
373
|
+
});
|
|
374
|
+
},
|
|
375
|
+
newsletterDelete: async (jid) => {
|
|
376
|
+
await newsletterWMexQuery(jid, Types_1.QueryIds.DELETE);
|
|
377
|
+
},
|
|
378
|
+
newsletterReactMessage: async (jid, serverId, code) => {
|
|
379
|
+
await query({
|
|
380
|
+
tag: "message",
|
|
381
|
+
attrs: {
|
|
382
|
+
to: jid,
|
|
383
|
+
...(!code ? { edit: "7" } : {}),
|
|
384
|
+
type: "reaction",
|
|
385
|
+
server_id: serverId,
|
|
386
|
+
id: (0, Utils_1.generateMessageID)(),
|
|
306
387
|
},
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
388
|
+
content: [
|
|
389
|
+
{
|
|
390
|
+
tag: "reaction",
|
|
391
|
+
attrs: code ? { code } : {},
|
|
392
|
+
},
|
|
393
|
+
],
|
|
394
|
+
});
|
|
395
|
+
},
|
|
396
|
+
newsletterFetchMessages: async (type, key, count, after) => {
|
|
397
|
+
const result = await newsletterQuery(WABinary_1.S_WHATSAPP_NET, "get", [
|
|
398
|
+
{
|
|
399
|
+
tag: "messages",
|
|
400
|
+
attrs: {
|
|
401
|
+
type,
|
|
402
|
+
...(type === "invite" ? { key } : { jid: key }),
|
|
403
|
+
count: count.toString(),
|
|
404
|
+
after:
|
|
405
|
+
(after === null || after === void 0
|
|
406
|
+
? void 0
|
|
407
|
+
: after.toString()) || "100",
|
|
408
|
+
},
|
|
316
409
|
},
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
410
|
+
]);
|
|
411
|
+
return await parseFetchedUpdates(result, "messages");
|
|
412
|
+
},
|
|
413
|
+
newsletterFetchUpdates: async (jid, count, after, since) => {
|
|
414
|
+
const result = await newsletterQuery(jid, "get", [
|
|
415
|
+
{
|
|
416
|
+
tag: "message_updates",
|
|
417
|
+
attrs: {
|
|
418
|
+
count: count.toString(),
|
|
419
|
+
after:
|
|
420
|
+
(after === null || after === void 0
|
|
421
|
+
? void 0
|
|
422
|
+
: after.toString()) || "100",
|
|
423
|
+
since:
|
|
424
|
+
(since === null || since === void 0
|
|
425
|
+
? void 0
|
|
426
|
+
: since.toString()) || "0",
|
|
427
|
+
},
|
|
325
428
|
},
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
attrs: { count: count.toString(), after: (after === null || after === void 0 ? void 0 : after.toString()) || '100', since: (since === null || since === void 0 ? void 0 : since.toString()) || '0' }
|
|
331
|
-
}
|
|
332
|
-
]);
|
|
333
|
-
return await parseFetchedUpdates(result, 'updates');
|
|
334
|
-
}
|
|
335
|
-
};
|
|
429
|
+
]);
|
|
430
|
+
return await parseFetchedUpdates(result, "updates");
|
|
431
|
+
},
|
|
432
|
+
};
|
|
336
433
|
};
|
|
337
434
|
exports.makeNewsletterSocket = makeNewsletterSocket;
|
|
338
435
|
const extractNewsletterMetadata = (node, isCreate) => {
|