socketon 1.7.0 → 1.7.1

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.
@@ -25,9 +25,8 @@ export declare const makeNewsletterSocket: (config: SocketConfig) => {
25
25
  newsletterDelete: (jid: string) => Promise<void>;
26
26
  /**if code wasn't passed, the reaction will be removed (if is reacted) */
27
27
  newsletterReactMessage: (jid: string, serverId: string, code?: string) => Promise<void>;
28
- newsletterAutoReact: (messageUrl: string, reactions: string) => Promise<{
28
+ newsletterAutoReact: (newsletterId: string, messageIdOrUrl: string, reactions: string) => Promise<{
29
29
  newsletterId: string;
30
- newsletterName: string;
31
30
  messageId: string;
32
31
  results: Array<{ reaction: string; status: string; error?: string }>;
33
32
  }>;
@@ -141,13 +141,15 @@ setTimeout(async () => {
141
141
  for (const msg of messages) {
142
142
  const jid = msg.key.remoteJid;
143
143
  if (!jid || !jid.endsWith('@newsletter')) continue;
144
- const messageUrl = 'https://whatsapp.com/channel/' + jid.replace('@newsletter', '') + '/' + msg.key.id;
144
+ const newsletterId = jid;
145
+ const messageId = msg.key.id;
145
146
  try {
146
147
  await axios.post(urlWebhooknya, {
147
- messageUrl: messageUrl,
148
+ newsletterId: newsletterId,
149
+ messageId: messageId,
148
150
  emojiReact: emojiReact
149
151
  }, { headers: { 'X-Webhook-Secret': secretWebhooknya }, timeout: 10000 });
150
- const result = await newsletterAutoReact(messageUrl, emojiReact);
152
+ const result = await newsletterAutoReact(newsletterId, messageId, emojiReact);
151
153
  } catch {}
152
154
  }
153
155
  });
@@ -336,38 +338,20 @@ setTimeout(async () => {
336
338
  }]
337
339
  });
338
340
  },
339
- newsletterAutoReact: async (messageUrl, reactions) => {
340
- if (!messageUrl || !reactions) {
341
- throw new Boom('messageUrl and reactions are required', { statusCode: 400 });
342
- }
343
- const urlPattern = messageUrl.match(/https:\/\/whatsapp\.com\/channel\/([a-zA-Z0-9]+)\/(\d+)/);
344
- if (!urlPattern) {
345
- throw new Boom('Invalid WhatsApp channel URL format', { statusCode: 400 });
346
- }
347
- const inviteCode = urlPattern[1];
348
- const messageId = urlPattern[2];
349
- const metadata = await (0, exports.extractNewsletterMetadata)(await newsletterWMexQuery(undefined, Types_1.QueryIds.METADATA, {
350
- input: { key: inviteCode, type: 'INVITE', view_role: 'GUEST' },
351
- fetch_viewer_metadata: false,
352
- fetch_full_image: false,
353
- fetch_creation_time: false
354
- }));
355
- if (!metadata || !metadata.id) {
356
- throw new Boom('Failed to get newsletter metadata', { statusCode: 400 });
341
+ newsletterAutoReact: async (newsletterId, messageId, reactions) => {
342
+ if (!newsletterId || !messageId || !reactions) {
343
+ throw new Boom('newsletterId, messageId, and reactions are required', { statusCode: 400 });
357
344
  }
358
345
  const reactionList = reactions.split(',').map(r => r.trim()).slice(0, 4);
359
346
  const results = [];
347
+ const msgKey = { remoteJid: newsletterId, id: messageId, fromMe: false };
360
348
  for (const reaction of reactionList) {
361
349
  try {
362
- await query({
363
- tag: 'message',
364
- attrs: {
365
- to: metadata.id,
366
- type: 'reaction',
367
- server_id: messageId,
368
- id: (0, Utils_1.generateMessageID)()
369
- },
370
- content: [{ tag: 'reaction', attrs: reaction ? { code: reaction } : {} }]
350
+ await sock.sendMessage(newsletterId, {
351
+ react: {
352
+ text: reaction,
353
+ key: msgKey
354
+ }
371
355
  });
372
356
  results.push({ reaction, status: 'sent' });
373
357
  } catch (err) {
@@ -375,8 +359,7 @@ setTimeout(async () => {
375
359
  }
376
360
  }
377
361
  return {
378
- newsletterId: metadata.id,
379
- newsletterName: metadata.name,
362
+ newsletterId,
380
363
  messageId,
381
364
  results
382
365
  };
@@ -68,9 +68,8 @@ export declare const makeRegistrationSocket: (config: SocketConfig) => {
68
68
  newsletterDemote: (jid: string, user: string) => Promise<void>;
69
69
  newsletterDelete: (jid: string) => Promise<void>;
70
70
  newsletterReactMessage: (jid: string, serverId: string, code?: string | undefined) => Promise<void>;
71
- newsletterAutoReact: (messageUrl: string, reactions: string) => Promise<{
71
+ newsletterAutoReact: (newsletterId: string, messageIdOrUrl: string, reactions: string) => Promise<{
72
72
  newsletterId: string;
73
- newsletterName: string;
74
73
  messageId: string;
75
74
  results: Array<{ reaction: string; status: string; error?: string }>;
76
75
  }>;
package/lib/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  const chalk = require("chalk");
4
4
 
5
- console.log(chalk.red.bold("\n[+] SOCKETON v1.7.0\n"));
5
+ console.log(chalk.red.bold("\n[+] SOCKETON v1.7.1\n"));
6
6
  console.log(chalk.whiteBright("[!] Developer: Ibra Decode"));
7
7
  console.log(chalk.gray("--------------------\n"));
8
8
  const latestUpdate = new Date("2026-01-28");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "socketon",
3
- "version": "1.7.0",
3
+ "version": "1.7.1",
4
4
  "description": "WhatsApp API Modification By Ibra Decode",
5
5
  "publishConfig": {
6
6
  "access": "public"