aunubaileys 1.0.48 β 1.0.49
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,6 +64,10 @@ 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.49 / Baru di 1.0.49 β EXPERIMENTAL
|
|
68
|
+
|
|
69
|
+
- πͺͺ **Personalised tag-all: every member sees themselves.** New socket method `sock.aunuPersonalTagAll(groupJid, options)`: for EVERY group member the bot sends one card carrying **that member's own profile picture** and their own name, mentioning exactly them β not one generic tag-all message. Pictures come from `profilePictureUrl` (the PN form is used when a member is LID-addressed and the LID store knows the pair); the caption is built from a template with `{name}`, `{number}`, `{mention}`, `{jid}` placeholders; names come from a consumer-supplied `getName` resolver when provided, falling back to the number. Members without a profile picture get a text card, or the `fallbackImage` when set. Built-in anti-spam pacing: a delay between sends (`delayMs`, default 1500) and a member cap (`maxMembers`, default 30); `dm: true` delivers each card to the member's private chat instead. Returns a `{ total, sent, failed, skipped }` summary. Experimental, like the five features of 1.0.47.
|
|
70
|
+
|
|
67
71
|
### π What's new in 1.0.48 / Baru di 1.0.48
|
|
68
72
|
|
|
69
73
|
- π©Ή **Group Bad MAC now heals both layers.** The "Bad MAC" error (from Tenka's live log on 11 Nov 2026, the same LID address as the B-01 finding and the 1.0.46 flood) is thrown by `SessionCipher` β the whisper/E2E session layer β and in groups it can equally come from the sender-key layer. The old strike-limit path (1.0.14) for groups deleted only the sender key, so a rotten E2E session of the author was never touched and the failures repeated forever: the same wrong-layer class that 1.0.46 closed for session failures, now closed on the strike path. At the 3-failure limit, groups now reset the author's E2E session (including the alternate PNβLID address record) AND drop the sender key, with the retry receipt carrying fresh keys. DM behaviour and the 3-strike threshold are unchanged. The `messages.decrypt-failure` event now distinguishes `errorClass: 'bad-mac'` from `'session'`/`'other'` (new exported predicate: `isBadMacError(text)`).
|
|
@@ -17,6 +17,27 @@ export interface AunuScheduledSend {
|
|
|
17
17
|
at: number;
|
|
18
18
|
cancel: () => boolean;
|
|
19
19
|
}
|
|
20
|
+
export interface AunuPersonalTagAllOptions {
|
|
21
|
+
/** Caption template; placeholders {name}, {number}, {mention}, {jid}. Default 'Hai {mention} π'. */
|
|
22
|
+
text?: string;
|
|
23
|
+
/** Pause between per-member sends in ms. Default 1500. */
|
|
24
|
+
delayMs?: number;
|
|
25
|
+
/** Maximum members processed. Default 30. */
|
|
26
|
+
maxMembers?: number;
|
|
27
|
+
/** Send each card as a DM to the member instead of into the group. Default false. */
|
|
28
|
+
dm?: boolean;
|
|
29
|
+
/** Image (Buffer or URL) used when a member has no profile picture. Without it, that member gets a text card. */
|
|
30
|
+
fallbackImage?: Buffer | string;
|
|
31
|
+
/** Resolve a display name for a participant JID; falls back to the number. */
|
|
32
|
+
getName?: (jid: string) => string | undefined | Promise<string | undefined>;
|
|
33
|
+
messageOptions?: MiscMessageGenerationOptions;
|
|
34
|
+
}
|
|
35
|
+
export interface AunuPersonalTagAllResult {
|
|
36
|
+
total: number;
|
|
37
|
+
sent: number;
|
|
38
|
+
failed: { jid: string; error: string }[];
|
|
39
|
+
skipped: number;
|
|
40
|
+
}
|
|
20
41
|
export interface AunuExperimentalAPI {
|
|
21
42
|
aunuWatermark: (text: string, tag: string) => string;
|
|
22
43
|
aunuReadWatermark: (text: string) => string | null;
|
|
@@ -28,5 +49,6 @@ export interface AunuExperimentalAPI {
|
|
|
28
49
|
aunuSelfDestruct: (jid: string, content: AnyMessageContent, seconds: number, options?: MiscMessageGenerationOptions) => Promise<WAMessage | undefined>;
|
|
29
50
|
aunuCancelSelfDestruct: (messageId: string) => boolean;
|
|
30
51
|
aunuDoctor: () => AunuDoctorReport;
|
|
52
|
+
aunuPersonalTagAll: (groupJid: string, options?: AunuPersonalTagAllOptions) => Promise<AunuPersonalTagAllResult>;
|
|
31
53
|
}
|
|
32
54
|
export declare const attachAunuExperimental: <T>(sock: T) => T & AunuExperimentalAPI;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import baileysVersion from '../Defaults/baileys-version.json' with { type: 'json' };
|
|
2
2
|
import { appendWatermark, computeTypingDuration, extractWatermark, stripWatermark } from '../Utils/aunu-experimental.js';
|
|
3
|
+
import { isLidUser } from '../WABinary/jid-utils.js';
|
|
3
4
|
const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
4
5
|
/**
|
|
5
6
|
* AunuBaileys EXPERIMENTAL socket features β these exist only in
|
|
@@ -19,6 +20,11 @@ const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
|
19
20
|
* 5. Connection doctor β `aunuDoctor`: one structured health snapshot
|
|
20
21
|
* (registration, transport, bundled WA version, known LID pairs,
|
|
21
22
|
* pending experimental timers).
|
|
23
|
+
* 6. Personalised tag-all β `aunuPersonalTagAll`: for EVERY group member,
|
|
24
|
+
* one message carrying that member's OWN profile picture and name,
|
|
25
|
+
* mentioning exactly them β each member sees themselves, not a
|
|
26
|
+
* generic tag-all. Paced sends + a member cap guard against spam
|
|
27
|
+
* limits.
|
|
22
28
|
*/
|
|
23
29
|
export const attachAunuExperimental = (sock) => {
|
|
24
30
|
const scheduled = new Map();
|
|
@@ -88,6 +94,56 @@ export const attachAunuExperimental = (sock) => {
|
|
|
88
94
|
destructs.delete(messageId);
|
|
89
95
|
return true;
|
|
90
96
|
};
|
|
97
|
+
sock.aunuPersonalTagAll = async (groupJid, options = {}) => {
|
|
98
|
+
const metadata = await sock.groupMetadata(groupJid);
|
|
99
|
+
const all = metadata?.participants || [];
|
|
100
|
+
const participants = all.slice(0, options.maxMembers ?? 30);
|
|
101
|
+
const template = options.text || 'Hai {mention} π';
|
|
102
|
+
const delayMs = options.delayMs ?? 1500;
|
|
103
|
+
const results = { total: all.length, sent: 0, failed: [], skipped: all.length - participants.length };
|
|
104
|
+
let first = true;
|
|
105
|
+
for (const participant of participants) {
|
|
106
|
+
const pid = participant.id;
|
|
107
|
+
if (!first && delayMs > 0) {
|
|
108
|
+
await delay(delayMs);
|
|
109
|
+
}
|
|
110
|
+
first = false;
|
|
111
|
+
try {
|
|
112
|
+
const pn = isLidUser(pid) ? (sock.aunuLid?.getPNForLID?.(pid) || pid) : pid;
|
|
113
|
+
const number = pn.split('@')[0].split(':')[0];
|
|
114
|
+
let name = number;
|
|
115
|
+
if (typeof options.getName === 'function') {
|
|
116
|
+
name = (await options.getName(pid)) || number;
|
|
117
|
+
}
|
|
118
|
+
let caption = template
|
|
119
|
+
.replaceAll('{name}', name)
|
|
120
|
+
.replaceAll('{number}', number)
|
|
121
|
+
.replaceAll('{mention}', '@' + number)
|
|
122
|
+
.replaceAll('{jid}', pid);
|
|
123
|
+
if (!caption.includes('@' + number)) {
|
|
124
|
+
caption += ' @' + number;
|
|
125
|
+
}
|
|
126
|
+
let ppUrl;
|
|
127
|
+
try {
|
|
128
|
+
ppUrl = await sock.profilePictureUrl(pn, 'image');
|
|
129
|
+
}
|
|
130
|
+
catch {
|
|
131
|
+
ppUrl = undefined;
|
|
132
|
+
}
|
|
133
|
+
const content = ppUrl
|
|
134
|
+
? { image: { url: ppUrl }, caption, mentions: [pid] }
|
|
135
|
+
: options.fallbackImage
|
|
136
|
+
? { image: Buffer.isBuffer(options.fallbackImage) ? options.fallbackImage : { url: options.fallbackImage }, caption, mentions: [pid] }
|
|
137
|
+
: { text: caption, mentions: [pid] };
|
|
138
|
+
await sock.sendMessage(options.dm ? pn : groupJid, content, options.messageOptions || {});
|
|
139
|
+
results.sent += 1;
|
|
140
|
+
}
|
|
141
|
+
catch (err) {
|
|
142
|
+
results.failed.push({ jid: pid, error: String(err?.message || err) });
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
return results;
|
|
146
|
+
};
|
|
91
147
|
sock.aunuDoctor = () => ({
|
|
92
148
|
experimental: true,
|
|
93
149
|
bundledWaVersion: Array.isArray(baileysVersion.version) ? baileysVersion.version.join('.') : null,
|
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.49",
|
|
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",
|