aunubaileys 1.0.52 → 1.0.54
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
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
[](https://www.npmjs.com/package/aunubaileys)
|
|
9
9
|
[](https://github.com/WhiskeySockets/Baileys)
|
|
10
10
|
[](./LICENSE)
|
|
11
|
-
[](https://github.com/AunuCore/AunuBaileys-lib/stargazers)
|
|
12
|
+
[](https://github.com/AunuCore/AunuBaileys-lib/forks)
|
|
13
13
|
|
|
14
14
|
**Full upstream power — with the soul that community forks used to have.**
|
|
15
15
|
The in-memory store is back, legacy exports are back, and every upstream update flows straight in.
|
|
@@ -64,6 +64,14 @@ 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.54 / Baru di 1.0.54
|
|
68
|
+
|
|
69
|
+
- **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.
|
|
70
|
+
|
|
71
|
+
### 🧪 What's new in 1.0.53 / Baru di 1.0.53 — EXPERIMENTAL
|
|
72
|
+
|
|
73
|
+
- 📇 **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.)
|
|
74
|
+
|
|
67
75
|
### 🧪 What's new in 1.0.52 / Baru di 1.0.52 — EXPERIMENTAL
|
|
68
76
|
|
|
69
77
|
- 👍 **`aunuCard` gains like/dislike buttons.** The new `likeDislike: true` option appends two quick-reply buttons under the card — **👍 Suka** (id `aunu_like`) and **👎 Tidak Suka** (id `aunu_dislike`) — after any custom buttons. The ids are overridable via `likeId`/`dislikeId`; taps return to the bot as button replies carrying those ids, so votes can be counted. Without the option, card behaviour is exactly as in 1.0.50.
|
|
@@ -75,6 +75,24 @@ export interface AunuFakeQuoteOptions {
|
|
|
75
75
|
id?: string;
|
|
76
76
|
quotedMessage?: Record<string, unknown>;
|
|
77
77
|
}
|
|
78
|
+
export interface AunuSideTextOptions {
|
|
79
|
+
/** The chat text (required). */
|
|
80
|
+
text: string;
|
|
81
|
+
/** Name/title beside the picture. `name` is an alias. */
|
|
82
|
+
title?: string;
|
|
83
|
+
name?: string;
|
|
84
|
+
/** Line under the title; defaults to the text itself. */
|
|
85
|
+
body?: string;
|
|
86
|
+
/** Side picture as raw bytes... */
|
|
87
|
+
image?: Buffer | { url: string };
|
|
88
|
+
/** ...or fetch this JID's real profile picture... */
|
|
89
|
+
profileOf?: string;
|
|
90
|
+
/** ...or use the built-in "deleted account" grey avatar... */
|
|
91
|
+
deletedProfile?: boolean;
|
|
92
|
+
/** Optional link opened when the preview block is tapped. Never substituted when omitted. */
|
|
93
|
+
url?: string;
|
|
94
|
+
messageOptions?: MiscMessageGenerationOptions;
|
|
95
|
+
}
|
|
78
96
|
export interface AunuExperimentalAPI {
|
|
79
97
|
aunuWatermark: (text: string, tag: string) => string;
|
|
80
98
|
aunuReadWatermark: (text: string) => string | null;
|
|
@@ -93,5 +111,8 @@ export interface AunuExperimentalAPI {
|
|
|
93
111
|
aunuReactSequence: (jid: string, key: Record<string, unknown>, emojis: string | string[], options?: { intervalMs?: number; messageOptions?: MiscMessageGenerationOptions }) => Promise<number>;
|
|
94
112
|
aunuPostStatus: (text: string, options?: { backgroundColor?: string; font?: number } & MiscMessageGenerationOptions) => Promise<any>;
|
|
95
113
|
aunuPersonalCard: (jid: string | null, targetJid: string, options?: AunuPersonalTagAllOptions) => Promise<any>;
|
|
114
|
+
aunuSideText: (jid: string, options: AunuSideTextOptions) => Promise<any>;
|
|
115
|
+
aunuGhostMention: (jid: string, content: Record<string, unknown>, options?: MiscMessageGenerationOptions) => Promise<any>;
|
|
116
|
+
aunuFakeForward: (jid: string, content: Record<string, unknown>, options?: { score?: number; channelName?: string; channelJid?: string; serverMessageId?: number; messageOptions?: MiscMessageGenerationOptions }) => Promise<any>;
|
|
96
117
|
}
|
|
97
118
|
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, computeTypingDuration, extractWatermark, stripWatermark } from '../Utils/aunu-experimental.js';
|
|
2
|
+
import { appendWatermark, buildSideTextAdReply, computeTypingDuration, encodeWatermark, extractWatermark, getDeletedProfileImage, 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';
|
|
@@ -42,6 +42,14 @@ const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
|
42
42
|
* 12. Personal card — `aunuPersonalCard`: the one-person form of
|
|
43
43
|
* aunuPersonalTagAll (own profile picture + name card for one target,
|
|
44
44
|
* into a chat or as a DM).
|
|
45
|
+
* 13. Side-profile text — `aunuSideText`: text with a small picture at
|
|
46
|
+
* the side, a name beside it and the chat under the name; the
|
|
47
|
+
* picture can be a real profile picture, the built-in "deleted
|
|
48
|
+
* account" avatar, or absent entirely.
|
|
49
|
+
* 14. Ghost mention — `aunuGhostMention`: mention every group member
|
|
50
|
+
* invisibly (notifications fire, no @ text shows).
|
|
51
|
+
* 15. Fake forward — `aunuFakeForward`: the forwarded look with a high
|
|
52
|
+
* score and optional channel attribution.
|
|
45
53
|
*/
|
|
46
54
|
export const attachAunuExperimental = (sock) => {
|
|
47
55
|
const scheduled = new Map();
|
|
@@ -286,6 +294,71 @@ export const attachAunuExperimental = (sock) => {
|
|
|
286
294
|
selfDestructPending: destructs.size,
|
|
287
295
|
generatedAt: new Date().toISOString(),
|
|
288
296
|
});
|
|
297
|
+
/**
|
|
298
|
+
* EXPERIMENTAL (1.0.53): side-profile text. Sends a text message whose
|
|
299
|
+
* preview block shows a small picture AT THE SIDE, a name/title next
|
|
300
|
+
* to it, and the chat text under the name — the layout group menus
|
|
301
|
+
* use. Picture variants: `image` (Buffer or { url }), `profileOf`
|
|
302
|
+
* (a JID whose real profile picture is fetched), `deletedProfile:
|
|
303
|
+
* true` (the built-in grey "deleted account" avatar), or no picture
|
|
304
|
+
* at all. Client rendering of the preview is version-dependent.
|
|
305
|
+
*/
|
|
306
|
+
sock.aunuSideText = async (jid, options = {}) => {
|
|
307
|
+
const { text, title, name, body, url, messageOptions } = options;
|
|
308
|
+
if (!text)
|
|
309
|
+
throw new Error('aunuSideText: options.text is required');
|
|
310
|
+
let thumbnail = null;
|
|
311
|
+
if (options.deletedProfile)
|
|
312
|
+
thumbnail = getDeletedProfileImage();
|
|
313
|
+
else if (Buffer.isBuffer(options.image))
|
|
314
|
+
thumbnail = options.image;
|
|
315
|
+
else if (options.profileOf) {
|
|
316
|
+
try {
|
|
317
|
+
const ppUrl = await sock.profilePictureUrl(options.profileOf, 'image');
|
|
318
|
+
if (ppUrl)
|
|
319
|
+
thumbnail = Buffer.from(await (await fetch(ppUrl)).arrayBuffer());
|
|
320
|
+
}
|
|
321
|
+
catch { /* no picture — the text simply goes without one */ }
|
|
322
|
+
}
|
|
323
|
+
else if (options.image?.url)
|
|
324
|
+
thumbnail = Buffer.from(await (await fetch(options.image.url)).arrayBuffer());
|
|
325
|
+
const externalAdReply = buildSideTextAdReply({ title: title ?? name ?? '', body: body ?? text, thumbnail, url });
|
|
326
|
+
return sock.sendMessage(jid, { text, contextInfo: { externalAdReply } }, messageOptions);
|
|
327
|
+
};
|
|
328
|
+
/**
|
|
329
|
+
* EXPERIMENTAL (1.0.53): ghost mention — mention EVERY group member
|
|
330
|
+
* in the message's mention list without any visible @ text, so all
|
|
331
|
+
* members are notified while the text stays clean.
|
|
332
|
+
*/
|
|
333
|
+
sock.aunuGhostMention = async (jid, content, options = {}) => {
|
|
334
|
+
if (!String(jid).endsWith('@g.us'))
|
|
335
|
+
throw new Error('aunuGhostMention: jid must be a group JID');
|
|
336
|
+
const metadata = await sock.groupMetadata(jid);
|
|
337
|
+
const ids = (metadata?.participants || []).map((p) => p.id).filter(Boolean);
|
|
338
|
+
const mentions = [...new Set([...(content?.mentions || []), ...ids])];
|
|
339
|
+
return sock.sendMessage(jid, { ...content, mentions }, options);
|
|
340
|
+
};
|
|
341
|
+
/**
|
|
342
|
+
* EXPERIMENTAL (1.0.53): fake forward — the message carries the
|
|
343
|
+
* forwarded look: `isForwarded` with a high forwarding score, and
|
|
344
|
+
* optionally a channel attribution line (name + JID).
|
|
345
|
+
*/
|
|
346
|
+
sock.aunuFakeForward = async (jid, content, options = {}) => {
|
|
347
|
+
const contextInfo = {
|
|
348
|
+
...(content?.contextInfo || {}),
|
|
349
|
+
isForwarded: true,
|
|
350
|
+
forwardingScore: options.score ?? 999,
|
|
351
|
+
};
|
|
352
|
+
if (options.channelName) {
|
|
353
|
+
contextInfo.forwardedNewsletterMessageInfo = {
|
|
354
|
+
newsletterJid: options.channelJid ?? '120363000000000000@newsletter',
|
|
355
|
+
newsletterName: options.channelName,
|
|
356
|
+
contentType: 1,
|
|
357
|
+
serverMessageId: options.serverMessageId ?? 1,
|
|
358
|
+
};
|
|
359
|
+
}
|
|
360
|
+
return sock.sendMessage(jid, { ...content, contextInfo }, options.messageOptions);
|
|
361
|
+
};
|
|
289
362
|
return sock;
|
|
290
363
|
};
|
|
291
364
|
//# sourceMappingURL=aunu-experimental.js.map
|
|
@@ -17,6 +17,36 @@ const textDecoder = new TextDecoder();
|
|
|
17
17
|
* Encode a short string as an invisible zero-width sequence. Returns an
|
|
18
18
|
* empty string for an empty payload.
|
|
19
19
|
*/
|
|
20
|
+
/**
|
|
21
|
+
* EXPERIMENTAL (AunuBaileys-only): a small embedded PNG of the WhatsApp
|
|
22
|
+
* "deleted account" avatar — a grey silhouette on light grey, drawn
|
|
23
|
+
* programmatically (96x96, 375 bytes). Used by `aunuSideText` for the
|
|
24
|
+
* deleted-profile side picture; exported so bots can reuse the look.
|
|
25
|
+
*/
|
|
26
|
+
export const DELETED_PROFILE_PNG_BASE64 = 'iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAIAAABt+uBvAAABPklEQVR4nO3aTWpCQRCFUVfvTHB1mSSLcZiAoETr56oHvgVUH3ryut7h6/tHNzqsTxAeIECAAAEKDhAgQIAABQcIECBAgIIDBAgQIEB/Op7O6zNkAR1P59t9LtBdmgSmHaB/0ewyLQA9rLNiNA30pM680ShQic6wEaAYoEKdSSNAGUDlOmNGgAABAvTuQE06M0ZuECBAgAAB8i0GKMxobGZASUDepCeMhqe1F4sEeoBpa0i7+Xiga6/1GaKB0gIECBAgQMEBAgQIEKDgAAEC9FlAnjt+IfLfW201koBKaOaZ/GG2CtRKM8PUCDSm02rUBTSs02fUArSi02RUD7So02FUDLSuU25UCbTu0mFUBrQu0mQEaARo3aLPCBCgdaB1hVYjQIAAAXploPXzdxu5QYAAAQL03kDJRs8fDdCdLjutlqODlBNDAAAAAElFTkSuQmCC';
|
|
27
|
+
export const getDeletedProfileImage = () => Buffer.from(DELETED_PROFILE_PNG_BASE64, 'base64');
|
|
28
|
+
/**
|
|
29
|
+
* EXPERIMENTAL: build the `externalAdReply` object behind `aunuSideText` —
|
|
30
|
+
* a preview block with the picture at the side, the title where a name
|
|
31
|
+
* sits, and the body text under the title. URLs are strictly
|
|
32
|
+
* caller-supplied; nothing is ever substituted.
|
|
33
|
+
*/
|
|
34
|
+
export const buildSideTextAdReply = ({ title, body, thumbnail, url } = {}) => {
|
|
35
|
+
const ad = {
|
|
36
|
+
title: title ?? '',
|
|
37
|
+
body: body ?? '',
|
|
38
|
+
mediaType: thumbnail ? 1 : 0,
|
|
39
|
+
renderLargerThumbnail: false,
|
|
40
|
+
showAdAttribution: false,
|
|
41
|
+
};
|
|
42
|
+
if (thumbnail)
|
|
43
|
+
ad.thumbnail = thumbnail;
|
|
44
|
+
if (url) {
|
|
45
|
+
ad.mediaUrl = url;
|
|
46
|
+
ad.sourceUrl = url;
|
|
47
|
+
}
|
|
48
|
+
return ad;
|
|
49
|
+
};
|
|
20
50
|
export const encodeWatermark = (payload) => {
|
|
21
51
|
if (!payload) {
|
|
22
52
|
return '';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aunubaileys",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.54",
|
|
5
5
|
"description": "AunuBaileys \u2014 a WhatsApp Web API for bots that never sleep. Full upstream power with the beloved in-memory store restored and pairing that just works. Forged by AunuCore.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"whatsapp",
|