aunubaileys 1.0.53 โ 1.0.55
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/README.md
CHANGED
|
@@ -64,9 +64,17 @@ Everything else is pure upstream. When upstream moves, we rebase the patch layer
|
|
|
64
64
|
|
|
65
65
|
|
|
66
66
|
|
|
67
|
+
### ๐งช What's new in 1.0.55 / Baru di 1.0.55 โ EXPERIMENTAL
|
|
68
|
+
|
|
69
|
+
- ๐ป **`aunuVanish`** โ send any content with a **custom per-message disappearing timer**: `sock.aunuVanish(jid, content, '5m')` (raw seconds or `'30s'`/`'5m'`/`'2h'`/`'7d'`; the parser is exported as `parseVanishDuration`). This is WhatsApp's native expiry โ the receiving client removes the message **without a trace** when the timer ends. It is NOT delete-for-everyone: no "this message was deleted" tombstone. Enforcement is by the receiving client, exactly like built-in disappearing messages. The experimental API is now 16 methods. This release also ships the rewritten npm description + keywords.
|
|
70
|
+
|
|
71
|
+
### โ๏ธ What's new in 1.0.54 / Baru di 1.0.54
|
|
72
|
+
|
|
73
|
+
- **Pruning.** `aunuCountdown` and `aunuSplitText` (added in 1.0.53) are **removed**: the AunuBaileys experimental line keeps only the rare features, and those two were generic utilities. The experimental API is back to **15 methods**; `aunuSideText`, `aunuGhostMention` and `aunuFakeForward` stay.
|
|
74
|
+
|
|
67
75
|
### ๐งช What's new in 1.0.53 / Baru di 1.0.53 โ EXPERIMENTAL
|
|
68
76
|
|
|
69
|
-
- ๐ **
|
|
77
|
+
- ๐ **Three new experimental features.** **`aunuSideText`** โ text with a small picture **at the side**: a name/title beside the picture and the chat under the name (the preview layout group menus use); the picture can be someone's real profile picture (`profileOf`), your own image, the built-in grey **"deleted account"** avatar (`deletedProfile: true`), or no picture at all. **`aunuGhostMention`** โ mention every group member invisibly: everyone is notified, the text shows no @ pile-up. **`aunuFakeForward`** โ the forwarded look (high forwarding score, optional channel attribution). New exported utils: `getDeletedProfileImage()` (the embedded deleted-account avatar PNG) and `buildSideTextAdReply()`. (This release also briefly carried `aunuCountdown`/`aunuSplitText`, removed again in 1.0.54.)
|
|
70
78
|
|
|
71
79
|
### ๐งช What's new in 1.0.52 / Baru di 1.0.52 โ EXPERIMENTAL
|
|
72
80
|
|
|
@@ -114,7 +114,6 @@ export interface AunuExperimentalAPI {
|
|
|
114
114
|
aunuSideText: (jid: string, options: AunuSideTextOptions) => Promise<any>;
|
|
115
115
|
aunuGhostMention: (jid: string, content: Record<string, unknown>, options?: MiscMessageGenerationOptions) => Promise<any>;
|
|
116
116
|
aunuFakeForward: (jid: string, content: Record<string, unknown>, options?: { score?: number; channelName?: string; channelJid?: string; serverMessageId?: number; messageOptions?: MiscMessageGenerationOptions }) => Promise<any>;
|
|
117
|
-
|
|
118
|
-
aunuSplitText: (jid: string, text: string, options?: { maxChars?: number; messageOptions?: MiscMessageGenerationOptions }) => Promise<any[]>;
|
|
117
|
+
aunuVanish: (jid: string, content: AnyMessageContent, duration: number | string, options?: MiscMessageGenerationOptions) => Promise<any>;
|
|
119
118
|
}
|
|
120
119
|
export declare const attachAunuExperimental: <T>(sock: T) => T & AunuExperimentalAPI;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import baileysVersion from '../Defaults/baileys-version.json' with { type: 'json' };
|
|
2
|
-
import { appendWatermark, buildSideTextAdReply, computeTypingDuration, encodeWatermark, extractWatermark, getDeletedProfileImage, stripWatermark } from '../Utils/aunu-experimental.js';
|
|
2
|
+
import { appendWatermark, buildSideTextAdReply, computeTypingDuration, encodeWatermark, extractWatermark, getDeletedProfileImage, parseVanishDuration, stripWatermark } from '../Utils/aunu-experimental.js';
|
|
3
3
|
import { isLidUser } from '../WABinary/jid-utils.js';
|
|
4
4
|
import { prepareWAMessageMedia } from '../Utils/messages.js';
|
|
5
5
|
import { randomBytes } from 'crypto';
|
|
@@ -50,10 +50,8 @@ const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
|
50
50
|
* invisibly (notifications fire, no @ text shows).
|
|
51
51
|
* 15. Fake forward โ `aunuFakeForward`: the forwarded look with a high
|
|
52
52
|
* score and optional channel attribution.
|
|
53
|
-
* 16.
|
|
54
|
-
*
|
|
55
|
-
* 17. Split text โ `aunuSplitText`: a long text as a self-quoting
|
|
56
|
-
* chain of messages.
|
|
53
|
+
* 16. Vanish โ `aunuVanish`: send with a custom per-message
|
|
54
|
+
* disappearing timer (native expiry, no tombstone).
|
|
57
55
|
*/
|
|
58
56
|
export const attachAunuExperimental = (sock) => {
|
|
59
57
|
const scheduled = new Map();
|
|
@@ -364,65 +362,18 @@ export const attachAunuExperimental = (sock) => {
|
|
|
364
362
|
return sock.sendMessage(jid, { ...content, contextInfo }, options.messageOptions);
|
|
365
363
|
};
|
|
366
364
|
/**
|
|
367
|
-
* EXPERIMENTAL (1.0.
|
|
368
|
-
*
|
|
365
|
+
* EXPERIMENTAL (1.0.55): vanish โ send any content with a CUSTOM
|
|
366
|
+
* per-message disappearing timer, using WhatsApp's native expiry
|
|
367
|
+
* (the message is stamped with an expiration and the receiving
|
|
368
|
+
* client removes it without a trace when the timer ends โ this is
|
|
369
|
+
* NOT a delete-for-everyone revoke and leaves no tombstone).
|
|
370
|
+
* `duration`: seconds, or '30s'/'5m'/'2h'/'7d'. Enforcement is by
|
|
371
|
+
* the receiving client, exactly like built-in disappearing
|
|
372
|
+
* messages; modded clients may ignore it.
|
|
369
373
|
*/
|
|
370
|
-
sock.
|
|
371
|
-
const
|
|
372
|
-
|
|
373
|
-
const format = options.format ?? ((n) => `\u23F3 ${n}`);
|
|
374
|
-
let msg = await sock.sendMessage(jid, { text: format(from) }, options.messageOptions);
|
|
375
|
-
const key = msg.key;
|
|
376
|
-
for (let n = from - 1; n >= 0; n--) {
|
|
377
|
-
await delay(intervalMs);
|
|
378
|
-
msg = await sock.sendMessage(jid, { text: format(n), edit: key }, options.messageOptions);
|
|
379
|
-
}
|
|
380
|
-
if (options.finalText != null) {
|
|
381
|
-
await delay(intervalMs);
|
|
382
|
-
msg = await sock.sendMessage(jid, { text: options.finalText, edit: key }, options.messageOptions);
|
|
383
|
-
}
|
|
384
|
-
return msg;
|
|
385
|
-
};
|
|
386
|
-
/**
|
|
387
|
-
* EXPERIMENTAL (1.0.53): split text โ a long text is sent as a chain
|
|
388
|
-
* of messages, each quoting the previous one, split on paragraph
|
|
389
|
-
* boundaries where possible.
|
|
390
|
-
*/
|
|
391
|
-
sock.aunuSplitText = async (jid, text, options = {}) => {
|
|
392
|
-
const maxChars = options.maxChars ?? 1000;
|
|
393
|
-
const chunks = [];
|
|
394
|
-
let current = '';
|
|
395
|
-
for (const para of String(text).split(/\n\n+/)) {
|
|
396
|
-
const pieces = [];
|
|
397
|
-
let rest = para;
|
|
398
|
-
while (rest.length > maxChars) {
|
|
399
|
-
let cut = rest.lastIndexOf(' ', maxChars);
|
|
400
|
-
if (cut < maxChars * 0.5)
|
|
401
|
-
cut = maxChars;
|
|
402
|
-
pieces.push(rest.slice(0, cut));
|
|
403
|
-
rest = rest.slice(cut).trimStart();
|
|
404
|
-
}
|
|
405
|
-
if (rest)
|
|
406
|
-
pieces.push(rest);
|
|
407
|
-
for (const piece of pieces) {
|
|
408
|
-
if (current && (current.length + 2 + piece.length) > maxChars) {
|
|
409
|
-
chunks.push(current);
|
|
410
|
-
current = piece;
|
|
411
|
-
}
|
|
412
|
-
else
|
|
413
|
-
current = current ? current + '\n\n' + piece : piece;
|
|
414
|
-
}
|
|
415
|
-
}
|
|
416
|
-
if (current)
|
|
417
|
-
chunks.push(current);
|
|
418
|
-
const sent = [];
|
|
419
|
-
let prev;
|
|
420
|
-
for (const chunk of chunks) {
|
|
421
|
-
const msg = await sock.sendMessage(jid, { text: chunk }, prev ? { ...options.messageOptions, quoted: prev } : options.messageOptions);
|
|
422
|
-
sent.push(msg);
|
|
423
|
-
prev = msg;
|
|
424
|
-
}
|
|
425
|
-
return sent;
|
|
374
|
+
sock.aunuVanish = async (jid, content, duration, options = {}) => {
|
|
375
|
+
const seconds = parseVanishDuration(duration);
|
|
376
|
+
return sock.sendMessage(jid, content, { ...options, ephemeralExpiration: seconds });
|
|
426
377
|
};
|
|
427
378
|
return sock;
|
|
428
379
|
};
|
|
@@ -47,6 +47,27 @@ export const buildSideTextAdReply = ({ title, body, thumbnail, url } = {}) => {
|
|
|
47
47
|
}
|
|
48
48
|
return ad;
|
|
49
49
|
};
|
|
50
|
+
/**
|
|
51
|
+
* EXPERIMENTAL (1.0.55): parse a vanish duration into seconds. Accepts a
|
|
52
|
+
* number (seconds) or a string with an s/m/h/d suffix ('30s', '5m',
|
|
53
|
+
* '2h', '7d'); a bare numeric string means seconds. Throws on anything
|
|
54
|
+
* else and on non-positive values.
|
|
55
|
+
*/
|
|
56
|
+
export const parseVanishDuration = (duration) => {
|
|
57
|
+
if (typeof duration === 'number') {
|
|
58
|
+
if (!Number.isFinite(duration) || duration < 1)
|
|
59
|
+
throw new Error('aunuVanish: duration must be at least 1 second');
|
|
60
|
+
return Math.floor(duration);
|
|
61
|
+
}
|
|
62
|
+
const match = /^\s*(\d+)\s*(s|m|h|d)?\s*$/i.exec(String(duration));
|
|
63
|
+
if (!match)
|
|
64
|
+
throw new Error(`aunuVanish: cannot parse duration ${JSON.stringify(duration)} (use seconds or '30s'/'5m'/'2h'/'7d')`);
|
|
65
|
+
const mult = { s: 1, m: 60, h: 3600, d: 86400 }[(match[2] || 's').toLowerCase()];
|
|
66
|
+
const seconds = parseInt(match[1], 10) * mult;
|
|
67
|
+
if (seconds < 1)
|
|
68
|
+
throw new Error('aunuVanish: duration must be at least 1 second');
|
|
69
|
+
return seconds;
|
|
70
|
+
};
|
|
50
71
|
export const encodeWatermark = (payload) => {
|
|
51
72
|
if (!payload) {
|
|
52
73
|
return '';
|
package/package.json
CHANGED
|
@@ -1,23 +1,34 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aunubaileys",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.
|
|
5
|
-
"description": "AunuBaileys \u2014
|
|
4
|
+
"version": "1.0.55",
|
|
5
|
+
"description": "AunuBaileys \u2014 the self-healing WhatsApp Web API for Node.js. Bad MAC and \"2000 messages into the future\" errors repair themselves, LID and phone-number identities stay in sync, anti-ban is built in, pairing codes are custom \u2014 plus 15 experimental features no other Baileys fork ships: invisible watermarks, per-person tag-all cards, side-profile text, ghost mentions and more. ESM, CJS and full TypeScript types.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"whatsapp",
|
|
8
8
|
"whatsapp-web",
|
|
9
|
+
"whatsapp-api",
|
|
9
10
|
"whatsapp-bot",
|
|
11
|
+
"whatsapp-automation",
|
|
12
|
+
"whatsapp-channel",
|
|
10
13
|
"baileys",
|
|
11
14
|
"aunubaileys",
|
|
12
15
|
"aunucore",
|
|
13
16
|
"bot",
|
|
14
17
|
"chatbot",
|
|
15
|
-
"websocket",
|
|
16
18
|
"multi-device",
|
|
17
19
|
"pairing-code",
|
|
18
|
-
"
|
|
20
|
+
"websocket",
|
|
21
|
+
"nodejs",
|
|
22
|
+
"javascript",
|
|
23
|
+
"typescript",
|
|
24
|
+
"esm",
|
|
25
|
+
"lid",
|
|
26
|
+
"anti-ban",
|
|
27
|
+
"newsletter",
|
|
28
|
+
"sticker",
|
|
19
29
|
"automation",
|
|
20
|
-
"
|
|
30
|
+
"api",
|
|
31
|
+
"unofficial"
|
|
21
32
|
],
|
|
22
33
|
"homepage": "https://docsjs.aunucore.eu.cc",
|
|
23
34
|
"repository": {
|