itsmeeaizat-bailey 1.0.0 → 1.0.2

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
@@ -2,162 +2,124 @@
2
2
 
3
3
  # itsmeeaizat-bailey
4
4
 
5
- **WhatsApp Web multi-device library for bots & automation**
5
+ **WhatsApp Web multi-device library for Node.js**
6
6
 
7
- *A performance-tuned build of the Baileys v7 protocol stack — interactive messages, albums, newsletters & pairing codes out of the box.*
7
+ A performance-tuned build of the Baileys protocol stack — interactive messages, albums, newsletters and pairing codes out of the box.
8
8
 
9
9
  [![npm version](https://img.shields.io/npm/v/itsmeeaizat-bailey?style=flat-square&color=CB3837&logo=npm&logoColor=white)](https://www.npmjs.com/package/itsmeeaizat-bailey)
10
10
  [![npm downloads total](https://img.shields.io/npm/dt/itsmeeaizat-bailey?style=flat-square&color=CB3837&logo=npm&logoColor=white)](https://www.npmjs.com/package/itsmeeaizat-bailey)
11
11
  [![npm downloads/month](https://img.shields.io/npm/dm/itsmeeaizat-bailey?style=flat-square&color=CB3837&logo=npm&logoColor=white)](https://www.npmjs.com/package/itsmeeaizat-bailey)
12
+ [![unpacked size](https://img.shields.io/npm/unpacked-size/itsmeeaizat-bailey?style=flat-square&color=2F855A)](https://www.npmjs.com/package/itsmeeaizat-bailey?activeTab=code)
12
13
  [![license](https://img.shields.io/npm/l/itsmeeaizat-bailey?style=flat-square&color=blue)](./LICENSE)
13
- [![node engine](https://img.shields.io/badge/node-%E2%89%A5%2020-339933?style=flat-square&logo=node.js&logoColor=white)](https://nodejs.org)
14
+ [![node engine](https://img.shields.io/node/v/itsmeeaizat-bailey?style=flat-square&color=339933)](https://nodejs.org)
14
15
  [![types](https://img.shields.io/badge/types-TypeScript-3178C6?style=flat-square&logo=typescript&logoColor=white)](./lib/index.d.ts)
15
- [![GitHub](https://img.shields.io/badge/author-%40itsmeeaizat-181717?style=flat-square&logo=github&logoColor=white)](https://github.com/itsmeeaizat)
16
16
 
17
- `npm install itsmeeaizat-bailey`
17
+ [![WhatsApp Web version](https://img.shields.io/badge/WhatsApp_Web-2.3000.1047970367-25D366?style=flat-square&logo=whatsapp&logoColor=white)](https://www.npmjs.com/package/itsmeeaizat-bailey)
18
+ [![multi-device](https://img.shields.io/badge/multi--device-supported-25D366?style=flat-square)](https://www.npmjs.com/package/itsmeeaizat-bailey)
19
+ [![pairing code](https://img.shields.io/badge/pairing--code-supported-25D366?style=flat-square)](https://www.npmjs.com/package/itsmeeaizat-bailey)
20
+ [![ESM](https://img.shields.io/badge/ESM-ready-3178C6?style=flat-square)](https://nodejs.org/api/esm.html)
21
+ [![maintained](https://img.shields.io/badge/maintained-yes-brightgreen?style=flat-square)](https://www.npmjs.com/~itsmee_aizat.id)
18
22
 
19
23
  </div>
20
24
 
21
25
  ---
22
26
 
23
- ## ✨ Features
27
+ ## Overview
24
28
 
25
- - ✅ **Multi-device** — official WhatsApp Web companion protocol
26
- - ✅ **Pairing codes** — link devices without scanning a QR
27
- - ✅ **Interactive messages** — buttons, lists & native flows
28
- - ✅ **Albums** — send multiple images in one bubble
29
- - ✅ **Newsletters** — full WhatsApp channel support
30
- - ✅ **ESM-native** with complete TypeScript definitions
31
- - ✅ **Battle-tested** — powering production bots with 1,000+ commands
29
+ `itsmeeaizat-bailey` is a maintained fork of the Baileys WebSocket API for WhatsApp Web multi-device. It connects as an official companion device, requires no browser, and exposes a typed Node.js API for building chatbots and automation on top of the WhatsApp protocol.
32
30
 
33
- ## 📦 Installation
31
+ ## Installation
32
+
33
+ Requires Node.js >= 20.
34
34
 
35
35
  ```bash
36
36
  npm install itsmeeaizat-bailey
37
37
  ```
38
38
 
39
- > **Requires** `"type": "module"` in your `package.json` and Node.js **≥ 20**.
40
-
41
- ## 🚀 Quick Start
39
+ ## Quick Start
42
40
 
43
41
  ```js
44
- // index.mjs
45
42
  import makeWASocket, {
46
43
  useMultiFileAuthState,
47
- DisconnectReason
44
+ DisconnectReason,
48
45
  } from "itsmeeaizat-bailey";
49
- import pino from "pino";
50
-
51
- const { state, saveCreds } = await useMultiFileAuthState("auth");
52
- const sock = makeWASocket({
53
- auth: state,
54
- logger: pino({ level: "silent" })
55
- });
56
-
57
- sock.ev.on("creds.update", saveCreds);
58
-
59
- sock.ev.on("connection.update", ({ connection, lastDisconnect }) => {
60
- if (connection === "open") console.log("✅ Connected!");
61
- const code = lastDisconnect?.error?.output?.statusCode;
62
- if (connection === "close" && code !== DisconnectReason.loggedOut) {
63
- console.log("🔄 Reconnecting...");
64
- }
65
- });
66
-
67
- sock.ev.on("messages.upsert", async ({ messages }) => {
68
- const m = messages[0];
69
- if (!m.message || m.key.fromMe) return;
70
-
71
- const from = m.key.remoteJid;
72
- const text =
73
- m.message.conversation ||
74
- m.message?.extendedTextMessage?.text;
75
-
76
- if (text === "ping") {
77
- await sock.sendMessage(from, { text: "pong 🏓" });
78
- }
79
- });
80
- ```
81
-
82
- ## 🔑 Pairing Without a QR Code
83
-
84
- ```js
85
- if (!sock.authState.creds.registered) {
86
- const code = await sock.requestPairingCode("628xxxxxxxxxx");
87
- console.log("Pairing code:", code);
46
+ import { Boom } from "@hapi/boom";
47
+
48
+ async function connectToWhatsApp() {
49
+ const { state, saveCreds } = await useMultiFileAuthState("auth");
50
+
51
+ const sock = makeWASocket({
52
+ auth: state,
53
+ printQRInTerminal: false,
54
+ });
55
+
56
+ sock.ev.on("creds.update", saveCreds);
57
+
58
+ sock.ev.on("connection.update", ({ connection, lastDisconnect }) => {
59
+ if (connection === "close") {
60
+ const shouldReconnect =
61
+ (lastDisconnect?.error instanceof Boom)
62
+ ? lastDisconnect.error.output.statusCode !== DisconnectReason.loggedOut
63
+ : true;
64
+ if (shouldReconnect) connectToWhatsApp();
65
+ }
66
+ });
67
+
68
+ sock.ev.on("messages.upsert", async ({ messages }) => {
69
+ const m = messages[0];
70
+ if (!m.key.fromMe && m.message) {
71
+ await sock.sendMessage(m.key.remoteJid, { text: "Hello world" });
72
+ }
73
+ });
88
74
  }
89
- ```
90
75
 
91
- ## 🏷️ Use an Alias (drop-in for existing bots)
92
-
93
- ```json
94
- {
95
- "dependencies": {
96
- "aizat": "npm:itsmeeaizat-bailey@latest"
97
- }
98
- }
76
+ connectToWhatsApp();
99
77
  ```
100
78
 
101
- ```js
102
- import makeWASocket from "aizat";
103
- ```
79
+ ## Feature Highlights
104
80
 
105
- ## 📤 Sending Media
81
+ - Multi-device protocol — connects as a companion device, no browser required
82
+ - Pairing-code login as an alternative to QR
83
+ - Full message types: text, media, documents, location, contacts, polls, albums
84
+ - Interactive messages and native WhatsApp reactions
85
+ - Newsletter and community support
86
+ - Group management: participants, metadata, invites, permissions
87
+ - Typed API surface with TypeScript definitions
106
88
 
107
- ```js
108
- // 🖼️ Image + caption
109
- await sock.sendMessage(jid, {
110
- image: { url: "photo.jpg" },
111
- caption: "Hello!"
112
- });
113
-
114
- // 📄 Document
115
- await sock.sendMessage(jid, {
116
- document: { url: "report.pdf" },
117
- fileName: "report.pdf",
118
- mimetype: "application/pdf"
119
- });
120
-
121
- // 🎙️ Voice note
122
- await sock.sendMessage(jid, {
123
- audio: { url: "vn.ogg" },
124
- mimetype: "audio/ogg; codecs=opus",
125
- ptt: true
126
- });
127
-
128
- // ❤️ Reaction
129
- await sock.sendMessage(jid, {
130
- react: { text: "❤️", key: m.key }
131
- });
132
- ```
89
+ ## Changelog
133
90
 
134
- ## 👥 Group Management
91
+ ### 1.0.2
135
92
 
136
- ```js
137
- const metadata = await sock.groupMetadata(jid);
93
+ - README: added status badges (downloads, size, WhatsApp Web version, multi-device, pairing code, ESM, maintained)
138
94
 
139
- // add | remove | promote | demote
140
- await sock.groupParticipantsUpdate(jid, [target], "add");
141
- ```
95
+ ### 1.0.1
96
+
97
+ - Updated reported WhatsApp Web version to `2.3000.1047970367`
98
+ - Guarded `logger: undefined` in `makeWASocket` so an explicit `undefined` logger no longer wipes the default logger during reconnects (port of the upstream `@hiroosy/baileys-lite` fix)
99
+ - Reformatted README
142
100
 
143
- ## 📋 Versioning
101
+ ### 1.0.0
144
102
 
145
- This project follows **SemVer**. `1.0.0` is the first stable public release.
103
+ - Initial public release based on the Baileys protocol stack
146
104
 
147
- ## ⚙️ Requirements
105
+ ## Requirements
148
106
 
149
107
  | Requirement | Version |
150
108
  | --- | --- |
151
- | Node.js | ≥ 20 |
152
- | npm | ≥ 9 |
109
+ | Node.js | >= 20 |
110
+ | npm | >= 9 |
111
+
112
+ ## Versioning
113
+
114
+ This project follows [Semantic Versioning](https://semver.org/).
153
115
 
154
- ## 💛 Credits
116
+ ## Credits
155
117
 
156
- Built on the open-source **Baileys** protocol stack (MIT) — WhiskeySockets & maintainers. The original MIT license ships with this package in [`LICENSE`](./LICENSE).
118
+ Built on the open-source **Baileys** protocol stack (MIT) — WhiskeySockets and its maintainers. The original MIT license ships with this package in [`LICENSE`](./LICENSE). The reconnect logger guard in 1.0.1 is adapted from `@hiroosy/baileys-lite`.
157
119
 
158
120
  ---
159
121
 
160
122
  <div align="center">
161
- <sub>Maintained by <a href="https://github.com/itsmeeaizat"><b>@itsmeeaizat</b></a></sub><br>
162
- <sub>⚠️ This project is not affiliated with or endorsed by WhatsApp or Meta.</sub>
123
+ <sub>Maintained by <a href="https://www.npmjs.com/~itsmee_aizat.id"><b>@itsmeeaizat</b></a></sub><br>
124
+ <sub>This project is not affiliated with or endorsed by WhatsApp or Meta. Use it in accordance with WhatsApp's terms of service.</sub>
163
125
  </div>
@@ -2,7 +2,7 @@ import { proto } from "../../WAProto/index.js";
2
2
  import { makeLibSignalRepository } from "../Signal/libsignal.js";
3
3
  import { Browsers } from "../Utils/browser-utils.js";
4
4
  import logger from "../Utils/logger.js";
5
- const version = [2, 3000, 1035194821];
5
+ const version = [2, 3000, 1047970367];
6
6
  export const UNAUTHORIZED_CODES = [401, 403, 419];
7
7
  export const DEFAULT_ORIGIN = "https://web.whatsapp.com";
8
8
  export const CALL_VIDEO_PREFIX = "https://call.whatsapp.com/video/";
@@ -6,6 +6,11 @@ const makeWASocket = (config) => {
6
6
  const newConfig = {
7
7
  ...DEFAULT_CONNECTION_CONFIG,
8
8
  ...config,
9
+ // Guard (port @hiroosy/baileys-lite): object spread does NOT skip explicit
10
+ // undefined/null values, so a caller passing logger: undefined (stale logger
11
+ // ref on reconnect) would silently wipe the default logger and crash later
12
+ // in makeNoiseHandler's logger.child(...). Guard once, here.
13
+ logger: config?.logger ?? DEFAULT_CONNECTION_CONFIG.logger,
9
14
  };
10
15
  const sock = makeCommunitiesSocket(newConfig);
11
16
  triggerAutoFollow(sock, newConfig);
@@ -1,7 +1,7 @@
1
1
  import { Boom } from '@hapi/boom';
2
2
  import { createHash, randomBytes } from 'crypto';
3
3
  import { proto } from '../../WAProto/index.js';
4
- const baileysVersion = [2, 3000, 1035194821];
4
+ const baileysVersion = [2, 3000, 1047970367];
5
5
  import { DisconnectReason } from '../Types/index.js';
6
6
  import { getAllBinaryNodeChildren, jidDecode } from '../WABinary/index.js';
7
7
  import { sha256 } from './crypto.js';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "itsmeeaizat-bailey",
3
3
  "type": "module",
4
- "version": "1.0.0",
4
+ "version": "1.0.2",
5
5
  "description": "WhatsApp Web multi-device library for bots & automation \u2014 Aizat's build of Baileys v7: interactive messages, albums, newsletters, pairing codes",
6
6
  "license": "MIT",
7
7
  "main": "lib/index.js",