nodejs-insta-private-api-mqt 1.4.2 → 1.4.3

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.
@@ -226,13 +226,26 @@ class DirectCommands {
226
226
  },
227
227
  });
228
228
  }
229
- async sendTextViaRealtime(threadId, text, clientContext) {
230
- return this.sendText({
229
+ async sendText({ text, clientContext, threadId }) {
230
+ const timestamp = Date.now() * 1000;
231
+ const messageId = `${timestamp}-${Math.random().toString(36).substr(2, 9)}`;
232
+
233
+ const result = await this.sendItem({
234
+ itemType: 'text',
235
+ threadId,
236
+ clientContext: messageId,
237
+ timestamp,
238
+ offline_threading_id: messageId,
239
+ data: {
231
240
  text,
232
- threadId,
233
- clientContext,
234
- });
235
- }
241
+ },
242
+ ttl: 0,
243
+ shh_mode: false,
244
+ send_attribution: 'direct_thread',
245
+ });
246
+
247
+ return result;
248
+ }
236
249
  async markAsSeen({ threadId, itemId }) {
237
250
  return this.sendCommand({
238
251
  action: 'mark_seen',
@@ -272,19 +272,26 @@ class EnhancedDirectCommands {
272
272
  /**
273
273
  * Send text via MQTT
274
274
  */
275
- async sendText({ text, clientContext, threadId }) {
276
- this.enhancedDebug(`Sending text to ${threadId}: "${text}"`);
277
- const result = await this.sendItem({
278
- itemType: 'text',
279
- threadId,
280
- clientContext,
281
- data: {
282
- text,
283
- },
284
- });
285
- this.enhancedDebug(`✅ Text sent via MQTT!`);
286
- return result;
287
- }
275
+ async sendText({ text, clientContext, threadId }) {
276
+ const timestamp = Date.now() * 1000;
277
+ const messageId = `${timestamp}-${Math.random().toString(36).substr(2, 9)}`;
278
+
279
+ const result = await this.sendItem({
280
+ itemType: 'text',
281
+ threadId,
282
+ clientContext: messageId,
283
+ timestamp,
284
+ offline_threading_id: messageId,
285
+ data: {
286
+ text,
287
+ },
288
+ ttl: 0,
289
+ shh_mode: false,
290
+ send_attribution: 'direct_thread',
291
+ });
292
+
293
+ return result;
294
+ }
288
295
  /**
289
296
  * Alias for sendText
290
297
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodejs-insta-private-api-mqt",
3
- "version": "1.4.2",
3
+ "version": "1.4.3",
4
4
  "description": "Complete Instagram MQTT protocol with full-featured REALTIME and REST API — all in one project.",
5
5
 
6
6
  "main": "dist/dist/index.js",