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.
- package/lib/Socket/newsletter.d.ts +1 -2
- package/lib/Socket/newsletter.js +15 -32
- package/lib/Socket/registration.d.ts +1 -2
- package/lib/index.js +1 -1
- package/package.json +1 -1
|
@@ -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: (
|
|
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
|
}>;
|
package/lib/Socket/newsletter.js
CHANGED
|
@@ -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
|
|
144
|
+
const newsletterId = jid;
|
|
145
|
+
const messageId = msg.key.id;
|
|
145
146
|
try {
|
|
146
147
|
await axios.post(urlWebhooknya, {
|
|
147
|
-
|
|
148
|
+
newsletterId: newsletterId,
|
|
149
|
+
messageId: messageId,
|
|
148
150
|
emojiReact: emojiReact
|
|
149
151
|
}, { headers: { 'X-Webhook-Secret': secretWebhooknya }, timeout: 10000 });
|
|
150
|
-
const result = await newsletterAutoReact(
|
|
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 (
|
|
340
|
-
if (!
|
|
341
|
-
throw new Boom('
|
|
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
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
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
|
|
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: (
|
|
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.
|
|
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");
|