nodejs-insta-private-api-mqtt 1.3.38 → 1.3.40
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.
|
@@ -5,6 +5,7 @@ const constants_1 = require("../../constants");
|
|
|
5
5
|
const shared_1 = require("../../shared");
|
|
6
6
|
const Chance = require("chance");
|
|
7
7
|
const thrift_1 = require("../../thrift");
|
|
8
|
+
|
|
8
9
|
class DirectCommands {
|
|
9
10
|
constructor(client) {
|
|
10
11
|
this.directDebug = (0, shared_1.debugChannel)('realtime', 'direct');
|
|
@@ -181,6 +182,232 @@ class DirectCommands {
|
|
|
181
182
|
},
|
|
182
183
|
});
|
|
183
184
|
}
|
|
185
|
+
async sendLink({ link, text, threadId, clientContext }) {
|
|
186
|
+
return this.sendItem({
|
|
187
|
+
itemType: 'link',
|
|
188
|
+
threadId,
|
|
189
|
+
clientContext,
|
|
190
|
+
data: {
|
|
191
|
+
link_text: text || '',
|
|
192
|
+
link_urls: JSON.stringify([link]),
|
|
193
|
+
},
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
async sendAnimatedMedia({ id, isSticker, threadId, clientContext }) {
|
|
197
|
+
return this.sendItem({
|
|
198
|
+
itemType: 'animated_media',
|
|
199
|
+
threadId,
|
|
200
|
+
clientContext,
|
|
201
|
+
data: {
|
|
202
|
+
id: id,
|
|
203
|
+
is_sticker: isSticker || false,
|
|
204
|
+
},
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
async sendVoice({ uploadId, waveform, waveformSamplingFrequencyHz, threadId, clientContext }) {
|
|
208
|
+
return this.sendItem({
|
|
209
|
+
itemType: 'voice_media',
|
|
210
|
+
threadId,
|
|
211
|
+
clientContext,
|
|
212
|
+
data: {
|
|
213
|
+
upload_id: uploadId,
|
|
214
|
+
waveform: waveform,
|
|
215
|
+
waveform_sampling_frequency_hz: waveformSamplingFrequencyHz || 10,
|
|
216
|
+
},
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
async removeReaction({ itemId, threadId, clientContext }) {
|
|
220
|
+
return this.sendItem({
|
|
221
|
+
itemType: 'reaction',
|
|
222
|
+
threadId,
|
|
223
|
+
clientContext,
|
|
224
|
+
data: {
|
|
225
|
+
item_id: itemId,
|
|
226
|
+
node_type: 'item',
|
|
227
|
+
reaction_type: 'like',
|
|
228
|
+
reaction_status: 'deleted',
|
|
229
|
+
},
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
async deleteMessage(threadId, itemId) {
|
|
233
|
+
return this.sendCommand({
|
|
234
|
+
action: 'delete_item',
|
|
235
|
+
threadId,
|
|
236
|
+
clientContext: this.chance.guid({ version: 4 }),
|
|
237
|
+
data: {
|
|
238
|
+
item_id: itemId,
|
|
239
|
+
},
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
async editMessage(threadId, itemId, newText) {
|
|
243
|
+
return this.sendCommand({
|
|
244
|
+
action: 'edit_item',
|
|
245
|
+
threadId,
|
|
246
|
+
clientContext: this.chance.guid({ version: 4 }),
|
|
247
|
+
data: {
|
|
248
|
+
item_id: itemId,
|
|
249
|
+
text: newText,
|
|
250
|
+
},
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
async replyToMessage(threadId, messageId, replyText) {
|
|
254
|
+
return this.sendItem({
|
|
255
|
+
itemType: 'text',
|
|
256
|
+
threadId,
|
|
257
|
+
clientContext: this.chance.guid({ version: 4 }),
|
|
258
|
+
data: {
|
|
259
|
+
text: replyText,
|
|
260
|
+
replied_to_item_id: messageId,
|
|
261
|
+
},
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
async addMemberToThread(threadId, userId) {
|
|
265
|
+
return this.sendCommand({
|
|
266
|
+
action: 'add_users',
|
|
267
|
+
threadId,
|
|
268
|
+
clientContext: this.chance.guid({ version: 4 }),
|
|
269
|
+
data: {
|
|
270
|
+
user_ids: Array.isArray(userId) ? userId : [userId],
|
|
271
|
+
},
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
async removeMemberFromThread(threadId, userId) {
|
|
275
|
+
return this.sendCommand({
|
|
276
|
+
action: 'remove_users',
|
|
277
|
+
threadId,
|
|
278
|
+
clientContext: this.chance.guid({ version: 4 }),
|
|
279
|
+
data: {
|
|
280
|
+
user_ids: Array.isArray(userId) ? userId : [userId],
|
|
281
|
+
},
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
async leaveThread(threadId) {
|
|
285
|
+
return this.sendCommand({
|
|
286
|
+
action: 'leave',
|
|
287
|
+
threadId,
|
|
288
|
+
clientContext: this.chance.guid({ version: 4 }),
|
|
289
|
+
data: {},
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
async muteThread(threadId, muteUntil = null) {
|
|
293
|
+
return this.sendCommand({
|
|
294
|
+
action: 'mute',
|
|
295
|
+
threadId,
|
|
296
|
+
clientContext: this.chance.guid({ version: 4 }),
|
|
297
|
+
data: {
|
|
298
|
+
mute_until: muteUntil,
|
|
299
|
+
},
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
async unmuteThread(threadId) {
|
|
303
|
+
return this.sendCommand({
|
|
304
|
+
action: 'unmute',
|
|
305
|
+
threadId,
|
|
306
|
+
clientContext: this.chance.guid({ version: 4 }),
|
|
307
|
+
data: {},
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
async updateThreadTitle(threadId, title) {
|
|
311
|
+
return this.sendCommand({
|
|
312
|
+
action: 'update_title',
|
|
313
|
+
threadId,
|
|
314
|
+
clientContext: this.chance.guid({ version: 4 }),
|
|
315
|
+
data: {
|
|
316
|
+
title: title,
|
|
317
|
+
},
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
async approveThread(threadId) {
|
|
321
|
+
return this.sendCommand({
|
|
322
|
+
action: 'approve',
|
|
323
|
+
threadId,
|
|
324
|
+
clientContext: this.chance.guid({ version: 4 }),
|
|
325
|
+
data: {},
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
async declineThread(threadId) {
|
|
329
|
+
return this.sendCommand({
|
|
330
|
+
action: 'decline',
|
|
331
|
+
threadId,
|
|
332
|
+
clientContext: this.chance.guid({ version: 4 }),
|
|
333
|
+
data: {},
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
async blockUserInThread(threadId, userId) {
|
|
337
|
+
return this.sendCommand({
|
|
338
|
+
action: 'block',
|
|
339
|
+
threadId,
|
|
340
|
+
clientContext: this.chance.guid({ version: 4 }),
|
|
341
|
+
data: {
|
|
342
|
+
user_id: userId,
|
|
343
|
+
},
|
|
344
|
+
});
|
|
345
|
+
}
|
|
346
|
+
async reportThread(threadId, reason) {
|
|
347
|
+
return this.sendCommand({
|
|
348
|
+
action: 'report',
|
|
349
|
+
threadId,
|
|
350
|
+
clientContext: this.chance.guid({ version: 4 }),
|
|
351
|
+
data: {
|
|
352
|
+
reason: reason || 'spam',
|
|
353
|
+
},
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
async sendDisappearingPhoto({ uploadId, threadId, viewMode = 'once', clientContext }) {
|
|
357
|
+
return this.sendItem({
|
|
358
|
+
itemType: 'expiring_media_message',
|
|
359
|
+
threadId,
|
|
360
|
+
clientContext,
|
|
361
|
+
data: {
|
|
362
|
+
upload_id: uploadId,
|
|
363
|
+
view_mode: viewMode,
|
|
364
|
+
allow_replay: viewMode === 'replayable',
|
|
365
|
+
},
|
|
366
|
+
});
|
|
367
|
+
}
|
|
368
|
+
async sendDisappearingVideo({ uploadId, threadId, viewMode = 'once', clientContext }) {
|
|
369
|
+
return this.sendItem({
|
|
370
|
+
itemType: 'expiring_media_message',
|
|
371
|
+
threadId,
|
|
372
|
+
clientContext,
|
|
373
|
+
data: {
|
|
374
|
+
upload_id: uploadId,
|
|
375
|
+
view_mode: viewMode,
|
|
376
|
+
allow_replay: viewMode === 'replayable',
|
|
377
|
+
media_type: 2,
|
|
378
|
+
},
|
|
379
|
+
});
|
|
380
|
+
}
|
|
381
|
+
async markVisualMessageSeen({ threadId, itemId, clientContext }) {
|
|
382
|
+
return this.sendCommand({
|
|
383
|
+
action: 'mark_visual_item_seen',
|
|
384
|
+
threadId,
|
|
385
|
+
clientContext: clientContext || this.chance.guid({ version: 4 }),
|
|
386
|
+
data: {
|
|
387
|
+
item_id: itemId,
|
|
388
|
+
},
|
|
389
|
+
});
|
|
390
|
+
}
|
|
391
|
+
async sendScreenshotNotification({ threadId, itemId, clientContext }) {
|
|
392
|
+
return this.sendCommand({
|
|
393
|
+
action: 'screenshot_notification',
|
|
394
|
+
threadId,
|
|
395
|
+
clientContext: clientContext || this.chance.guid({ version: 4 }),
|
|
396
|
+
data: {
|
|
397
|
+
item_id: itemId,
|
|
398
|
+
},
|
|
399
|
+
});
|
|
400
|
+
}
|
|
401
|
+
async sendReplayNotification({ threadId, itemId, clientContext }) {
|
|
402
|
+
return this.sendCommand({
|
|
403
|
+
action: 'replay_notification',
|
|
404
|
+
threadId,
|
|
405
|
+
clientContext: clientContext || this.chance.guid({ version: 4 }),
|
|
406
|
+
data: {
|
|
407
|
+
item_id: itemId,
|
|
408
|
+
},
|
|
409
|
+
});
|
|
410
|
+
}
|
|
184
411
|
}
|
|
185
412
|
exports.DirectCommands = DirectCommands;
|
|
186
|
-
//# sourceMappingURL=direct.commands.js.map
|
|
413
|
+
//# sourceMappingURL=direct.commands.js.map
|