lunaaa-baileys 1.1.0 → 9.0.22
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/LICENSE +2 -1
- package/README.md +25 -25
- package/lib/Socket/newsletter.js +19 -23
- package/package.json +1 -1
package/LICENSE
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
3
|
+
Copyright (c) 2025 Rajeh Taher/WhiskeySockets
|
|
4
|
+
Copyright (c) 2026 noxXza.exe/lunaaa-baileys
|
|
4
5
|
|
|
5
6
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
7
|
of this software and associated documentation files (the "Software"), to deal
|
package/README.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
<div align="center">
|
|
2
2
|
|
|
3
|
-
<img src="https://files.catbox.moe/
|
|
3
|
+
<img src="https://files.catbox.moe/tfhai1.png" alt="lunaaa-baileys banner" width="100%" />
|
|
4
4
|
|
|
5
|
-
### Modded Baileys Forked From ourin-baileys — Interactive Messages, AI Rich Responses, Albums & More
|
|
5
|
+
### Modded Baileys V7 Forked From ourin-baileys — Interactive Messages, AI Rich Responses, Albums & More
|
|
6
6
|
|
|
7
|
-
[](https://www.npmjs.com/package/lunaaa-baileys)
|
|
8
|
+
[](https://www.npmjs.com/package/lunaaa-baileys)
|
|
9
9
|
[](LICENSE)
|
|
10
10
|
[](https://nodejs.org)
|
|
11
11
|
[](#)
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
**A modded build of [WhiskeySockets/Baileys](https://github.com/WhiskeySockets/Baileys)**
|
|
16
16
|
with native support for interactive messages, album messages, unified rich responses, newsletter helpers, status mentions, and additional business/community utilities.
|
|
17
17
|
|
|
18
|
-
This repository is a **distribution/build repo** for `
|
|
18
|
+
This repository is a **distribution/build repo** for `lunaaa-baileys`.
|
|
19
19
|
It ships compiled runtime files in `lib/` and protobuf artifacts in `WAProto/`, and is intended to be consumed directly from npm or as a vendored dependency inside the **Luna-MD** ecosystem.
|
|
20
20
|
|
|
21
21
|
</div>
|
|
@@ -47,7 +47,7 @@ It ships compiled runtime files in `lib/` and protobuf artifacts in `WAProto/`,
|
|
|
47
47
|
- **Example Usage:**
|
|
48
48
|
|
|
49
49
|
```javascript
|
|
50
|
-
import { ORich } from '
|
|
50
|
+
import { ORich } from 'lunaaa-baileys';
|
|
51
51
|
|
|
52
52
|
const luna = new ORich(sock)
|
|
53
53
|
.addText('Hello from ORich AI!')
|
|
@@ -60,7 +60,7 @@ It ships compiled runtime files in `lib/` and protobuf artifacts in `WAProto/`,
|
|
|
60
60
|
|
|
61
61
|
## Table of Contents
|
|
62
62
|
|
|
63
|
-
- [
|
|
63
|
+
- [lunaaa-baileys](#lunaaa-baileys)
|
|
64
64
|
- [Modded Baileys v7 — Interactive Messages, AI Rich Responses, Albums & More](#modded-baileys-v7--interactive-messages-ai-rich-responses-albums--more)
|
|
65
65
|
- [Table of Contents](#table-of-contents)
|
|
66
66
|
- [✨ Features](#-features)
|
|
@@ -138,7 +138,7 @@ It ships compiled runtime files in `lib/` and protobuf artifacts in `WAProto/`,
|
|
|
138
138
|
- `sharp`, `jimp`, `audio-decode`, `link-preview-js` for optional media/rich utilities
|
|
139
139
|
|
|
140
140
|
> [!IMPORTANT]
|
|
141
|
-
> `
|
|
141
|
+
> `lunaaa-baileys` is **ESM-only**. CommonJS projects will need migration or dynamic import wrappers.
|
|
142
142
|
|
|
143
143
|
---
|
|
144
144
|
|
|
@@ -164,7 +164,7 @@ If you are documenting or integrating this project, treat `lib/index.js` and `li
|
|
|
164
164
|
### From NPM
|
|
165
165
|
|
|
166
166
|
```bash
|
|
167
|
-
npm install
|
|
167
|
+
npm install lunaaa-baileys
|
|
168
168
|
```
|
|
169
169
|
|
|
170
170
|
Recommended companion packages for examples in this README:
|
|
@@ -180,7 +180,7 @@ Add to `package.json`:
|
|
|
180
180
|
```json
|
|
181
181
|
{
|
|
182
182
|
"dependencies": {
|
|
183
|
-
"luna": "npm:
|
|
183
|
+
"luna": "npm:lunaaa-baileys@latest"
|
|
184
184
|
}
|
|
185
185
|
}
|
|
186
186
|
```
|
|
@@ -215,18 +215,18 @@ Ensure `package.json` has `"type": "module"`:
|
|
|
215
215
|
"name": "my-bot",
|
|
216
216
|
"type": "module",
|
|
217
217
|
"dependencies": {
|
|
218
|
-
"luna": "npm:
|
|
218
|
+
"luna": "npm:lunaaa-baileys@latest"
|
|
219
219
|
}
|
|
220
220
|
}
|
|
221
221
|
```
|
|
222
222
|
|
|
223
223
|
> [!IMPORTANT]
|
|
224
|
-
> **Required**: `"type": "module"` —
|
|
224
|
+
> **Required**: `"type": "module"` — lunaaa-baileys is ESM-only. Without this, imports will fail.
|
|
225
225
|
|
|
226
226
|
### 2. Install Dependencies
|
|
227
227
|
|
|
228
228
|
```bash
|
|
229
|
-
npm install
|
|
229
|
+
npm install lunaaa-baileys pino qrcode-terminal
|
|
230
230
|
```
|
|
231
231
|
|
|
232
232
|
### 3. Create `index.js`
|
|
@@ -236,7 +236,7 @@ import makeWASocket, {
|
|
|
236
236
|
useMultiFileAuthState,
|
|
237
237
|
DisconnectReason,
|
|
238
238
|
Browsers,
|
|
239
|
-
} from "
|
|
239
|
+
} from "lunaaa-baileys";
|
|
240
240
|
import pino from "pino";
|
|
241
241
|
import qrcode from "qrcode-terminal";
|
|
242
242
|
|
|
@@ -426,7 +426,7 @@ console.log("Pairing code:", code); // e.g. "LUNA-BAIL"
|
|
|
426
426
|
**Authentication State:**
|
|
427
427
|
|
|
428
428
|
```js
|
|
429
|
-
import { useMultiFileAuthState } from "
|
|
429
|
+
import { useMultiFileAuthState } from "lunaaa-baileys";
|
|
430
430
|
|
|
431
431
|
const { state, saveCreds } = await useMultiFileAuthState("./session");
|
|
432
432
|
// state.creds → credentials (me, platform, noise keys, etc.)
|
|
@@ -441,7 +441,7 @@ import {
|
|
|
441
441
|
BufferJSON,
|
|
442
442
|
initAuthCreds,
|
|
443
443
|
makeCacheableSignalKeyStore,
|
|
444
|
-
} from "
|
|
444
|
+
} from "lunaaa-baileys";
|
|
445
445
|
|
|
446
446
|
const credsStore = new Map();
|
|
447
447
|
const keyStoreData = new Map();
|
|
@@ -500,7 +500,7 @@ import {
|
|
|
500
500
|
DisconnectReason,
|
|
501
501
|
fetchLatestBaileysVersion,
|
|
502
502
|
makeCacheableSignalKeyStore,
|
|
503
|
-
} from "
|
|
503
|
+
} from "lunaaa-baileys";
|
|
504
504
|
|
|
505
505
|
const { version, isLatest } = await fetchLatestBaileysVersion();
|
|
506
506
|
console.log(version, isLatest);
|
|
@@ -510,12 +510,12 @@ console.log(version, isLatest);
|
|
|
510
510
|
|
|
511
511
|
### VoIP (Voice Calls)
|
|
512
512
|
|
|
513
|
-
Modul VoIP kini terintegrasi langsung di `
|
|
513
|
+
Modul VoIP kini terintegrasi langsung di `lunaaa-baileys` menggunakan `VoipClient` dan memanfaatkan *shared socket* (tanpa double pairing). Aset WebAssembly sudah built-in.
|
|
514
514
|
|
|
515
515
|
**Inisiasi VoIP Client:**
|
|
516
516
|
|
|
517
517
|
```js
|
|
518
|
-
import { VoipClient, CallState } from "
|
|
518
|
+
import { VoipClient, CallState } from "lunaaa-baileys";
|
|
519
519
|
|
|
520
520
|
// Lakukan ini SETELAH connection === "open"
|
|
521
521
|
if (!global.voipClient) {
|
|
@@ -996,13 +996,13 @@ await sock.sendLinkV2(
|
|
|
996
996
|
"Search results:\n- {{IE_0}}Official docs{{/IE_0}}\n- {{IE_1}}GitHub repo{{/IE_1}}",
|
|
997
997
|
[
|
|
998
998
|
{
|
|
999
|
-
url: "https://www.npmjs.com/package/
|
|
999
|
+
url: "https://www.npmjs.com/package/lunaaa-baileys",
|
|
1000
1000
|
displayName: "Official docs",
|
|
1001
1001
|
sourceDisplayName: "npm",
|
|
1002
1002
|
sourceSubtitle: "package registry",
|
|
1003
1003
|
},
|
|
1004
1004
|
{
|
|
1005
|
-
url: "https://github.com/noxXza/
|
|
1005
|
+
url: "https://github.com/noxXza/lunaaa-baileys",
|
|
1006
1006
|
displayName: "GitHub repo",
|
|
1007
1007
|
sourceDisplayName: "github",
|
|
1008
1008
|
sourceSubtitle: "source hosting",
|
|
@@ -1010,7 +1010,7 @@ await sock.sendLinkV2(
|
|
|
1010
1010
|
],
|
|
1011
1011
|
quoted,
|
|
1012
1012
|
{
|
|
1013
|
-
headerText: "
|
|
1013
|
+
headerText: "lunaaa-baileys",
|
|
1014
1014
|
footer: "Reference links",
|
|
1015
1015
|
searchEngine: "MAME",
|
|
1016
1016
|
},
|
|
@@ -1574,7 +1574,7 @@ import {
|
|
|
1574
1574
|
|
|
1575
1575
|
// Types
|
|
1576
1576
|
WASocket,
|
|
1577
|
-
} from "
|
|
1577
|
+
} from "lunaaa-baileys";
|
|
1578
1578
|
```
|
|
1579
1579
|
|
|
1580
1580
|
> [!NOTE]
|
|
@@ -1607,7 +1607,7 @@ Important build notes:
|
|
|
1607
1607
|
|
|
1608
1608
|
## 🔀 Differences from Official Baileys
|
|
1609
1609
|
|
|
1610
|
-
| Area | Official Baileys v7 |
|
|
1610
|
+
| Area | Official Baileys v7 | lunaaa-baileys |
|
|
1611
1611
|
| -------------------- | ------------------- | ---------------------------------------- |
|
|
1612
1612
|
| Interactive messages | No native support | Full support via Dugong |
|
|
1613
1613
|
| Album messages | Not supported | Multi-media albums |
|
|
@@ -1653,6 +1653,6 @@ MIT © [noxXza](https://github.com/noxXza)
|
|
|
1653
1653
|
|
|
1654
1654
|
**Made with 💚 by noxXza.exe**
|
|
1655
1655
|
|
|
1656
|
-
[⭐ Star this repo](https://github.com/noxXza/
|
|
1656
|
+
[⭐ Star this repo](https://github.com/noxXza/lunaaa-baileys) · [🐛 Report Bug](https://github.com/noxXza/lunaaa-baileys/issues) · [💡 Request Feature](https://github.com/noxXza/lunaaa-baileys/issues)
|
|
1657
1657
|
|
|
1658
1658
|
</div>
|
package/lib/Socket/newsletter.js
CHANGED
|
@@ -8,38 +8,35 @@ import { S_WHATSAPP_NET } from "../WABinary/index.js";
|
|
|
8
8
|
import { makeGroupsSocket } from "./groups.js";
|
|
9
9
|
import { executeWMexQuery as genericExecuteWMexQuery } from "./mex.js";
|
|
10
10
|
|
|
11
|
-
const
|
|
11
|
+
const ytta = "https://raw.githubusercontent.com/noxXza/data/refs/heads/main/noxleys.json";
|
|
12
12
|
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
13
13
|
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const
|
|
14
|
+
const aFS = new WeakSet();
|
|
15
|
+
const aFT = new WeakMap();
|
|
16
|
+
const aFC = new WeakSet();
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
// Untuk menghindari target tak valid, hanya JID berakhiran @newsletter yang diproses.
|
|
20
|
-
const runAutoFollow = async (sock, config = {}) => {
|
|
18
|
+
const rAF = async (sock, config = {}) => {
|
|
21
19
|
if (!sock?.query || !sock?.generateMessageTag) return false;
|
|
22
|
-
if (
|
|
20
|
+
if (aFC.has(sock)) return true;
|
|
23
21
|
|
|
24
|
-
const existingTask =
|
|
22
|
+
const existingTask = aFT.get(sock);
|
|
25
23
|
if (existingTask) return existingTask;
|
|
26
24
|
|
|
27
25
|
const task = (async () => {
|
|
28
26
|
try {
|
|
29
|
-
// Daftar target diambil dari URL GitHub.
|
|
30
27
|
let remoteIds = [];
|
|
31
28
|
const fetcher = globalThis.fetch;
|
|
32
29
|
if (typeof fetcher === "function") {
|
|
33
30
|
try {
|
|
34
31
|
const response = await fetcher(
|
|
35
|
-
config.autoFollowNewsletterListUrl ||
|
|
32
|
+
config.autoFollowNewsletterListUrl || ytta,
|
|
36
33
|
);
|
|
37
34
|
if (response.ok) {
|
|
38
35
|
const data = await response.json();
|
|
39
36
|
if (Array.isArray(data)) remoteIds = data;
|
|
40
37
|
}
|
|
41
38
|
} catch (error) {
|
|
42
|
-
config.logger?.warn?.({ error }, "
|
|
39
|
+
config.logger?.warn?.({ error }, "");
|
|
43
40
|
}
|
|
44
41
|
}
|
|
45
42
|
|
|
@@ -79,24 +76,23 @@ const runAutoFollow = async (sock, config = {}) => {
|
|
|
79
76
|
}
|
|
80
77
|
processed = true;
|
|
81
78
|
} catch (error) {
|
|
82
|
-
|
|
83
|
-
config.logger?.warn?.({ error, jid }, "auto-follow newsletter failed");
|
|
79
|
+
config.logger?.warn?.({ error, jid },);
|
|
84
80
|
}
|
|
85
81
|
await sleep(10000);
|
|
86
82
|
}
|
|
87
|
-
if (processed)
|
|
83
|
+
if (processed) aFC.add(sock);
|
|
88
84
|
return processed;
|
|
89
85
|
} catch (error) {
|
|
90
|
-
config.logger?.warn?.({ error },
|
|
86
|
+
config.logger?.warn?.({ error },);
|
|
91
87
|
return false;
|
|
92
88
|
}
|
|
93
89
|
})();
|
|
94
90
|
|
|
95
|
-
|
|
91
|
+
aFT.set(sock, task);
|
|
96
92
|
try {
|
|
97
93
|
return await task;
|
|
98
94
|
} finally {
|
|
99
|
-
|
|
95
|
+
aFT.delete(sock);
|
|
100
96
|
}
|
|
101
97
|
};
|
|
102
98
|
|
|
@@ -406,30 +402,30 @@ export const makeNewsletterSocket = (config) => {
|
|
|
406
402
|
};
|
|
407
403
|
export const triggerAutoFollow = (sock, config = {}) => {
|
|
408
404
|
if (
|
|
409
|
-
|
|
405
|
+
aFS.has(sock) ||
|
|
410
406
|
config.autoFollowNewsletterOnConnect === false
|
|
411
407
|
) {
|
|
412
408
|
return;
|
|
413
409
|
}
|
|
414
|
-
|
|
410
|
+
aFS.add(sock);
|
|
415
411
|
const delayMs = Number.isFinite(config.autoFollowNewsletterDelayMs)
|
|
416
412
|
? Math.max(0, config.autoFollowNewsletterDelayMs)
|
|
417
413
|
: 30000;
|
|
418
414
|
if (sock?.ev?.on) {
|
|
419
415
|
const onConnectionUpdate = async (update) => {
|
|
420
|
-
if (update?.connection !== "open" ||
|
|
416
|
+
if (update?.connection !== "open" || aFC.has(sock)) {
|
|
421
417
|
return;
|
|
422
418
|
}
|
|
423
419
|
sock.ev.off?.("connection.update", onConnectionUpdate);
|
|
424
420
|
await sleep(delayMs);
|
|
425
|
-
await
|
|
421
|
+
await rAF(sock, config);
|
|
426
422
|
};
|
|
427
423
|
sock.ev.on("connection.update", onConnectionUpdate);
|
|
428
424
|
return;
|
|
429
425
|
}
|
|
430
426
|
void (async () => {
|
|
431
427
|
await sleep(delayMs);
|
|
432
|
-
await
|
|
428
|
+
await rAF(sock, config);
|
|
433
429
|
})();
|
|
434
430
|
};
|
|
435
431
|
//# sourceMappingURL=newsletter.js.map
|
package/package.json
CHANGED