itsmeeaizat-bailey 1.0.0 → 1.0.1

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,112 @@
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
- [![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
- [![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)
10
+ [![npm downloads](https://img.shields.io/npm/dt/itsmeeaizat-bailey?style=flat-square&color=CB3837&logo=npm&logoColor=white)](https://www.npmjs.com/package/itsmeeaizat-bailey)
12
11
  [![license](https://img.shields.io/npm/l/itsmeeaizat-bailey?style=flat-square&color=blue)](./LICENSE)
13
12
  [![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
13
  [![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
-
17
- `npm install itsmeeaizat-bailey`
18
14
 
19
15
  </div>
20
16
 
21
17
  ---
22
18
 
23
- ## ✨ Features
19
+ ## Overview
20
+
21
+ `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.
24
22
 
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
23
+ ## Installation
32
24
 
33
- ## 📦 Installation
25
+ Requires Node.js >= 20.
34
26
 
35
27
  ```bash
36
28
  npm install itsmeeaizat-bailey
37
29
  ```
38
30
 
39
- > **Requires** `"type": "module"` in your `package.json` and Node.js **≥ 20**.
40
-
41
- ## 🚀 Quick Start
31
+ ## Quick Start
42
32
 
43
33
  ```js
44
- // index.mjs
45
34
  import makeWASocket, {
46
35
  useMultiFileAuthState,
47
- DisconnectReason
36
+ DisconnectReason,
48
37
  } 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);
38
+ import { Boom } from "@hapi/boom";
39
+
40
+ async function connectToWhatsApp() {
41
+ const { state, saveCreds } = await useMultiFileAuthState("auth");
42
+
43
+ const sock = makeWASocket({
44
+ auth: state,
45
+ printQRInTerminal: false,
46
+ });
47
+
48
+ sock.ev.on("creds.update", saveCreds);
49
+
50
+ sock.ev.on("connection.update", ({ connection, lastDisconnect }) => {
51
+ if (connection === "close") {
52
+ const shouldReconnect =
53
+ (lastDisconnect?.error instanceof Boom)
54
+ ? lastDisconnect.error.output.statusCode !== DisconnectReason.loggedOut
55
+ : true;
56
+ if (shouldReconnect) connectToWhatsApp();
57
+ }
58
+ });
59
+
60
+ sock.ev.on("messages.upsert", async ({ messages }) => {
61
+ const m = messages[0];
62
+ if (!m.key.fromMe && m.message) {
63
+ await sock.sendMessage(m.key.remoteJid, { text: "Hello world" });
64
+ }
65
+ });
88
66
  }
89
- ```
90
67
 
91
- ## 🏷️ Use an Alias (drop-in for existing bots)
92
-
93
- ```json
94
- {
95
- "dependencies": {
96
- "aizat": "npm:itsmeeaizat-bailey@latest"
97
- }
98
- }
68
+ connectToWhatsApp();
99
69
  ```
100
70
 
101
- ```js
102
- import makeWASocket from "aizat";
103
- ```
71
+ ## Feature Highlights
104
72
 
105
- ## 📤 Sending Media
73
+ - Multi-device protocol — connects as a companion device, no browser required
74
+ - Pairing-code login as an alternative to QR
75
+ - Full message types: text, media, documents, location, contacts, polls, albums
76
+ - Interactive messages and native WhatsApp reactions
77
+ - Newsletter and community support
78
+ - Group management: participants, metadata, invites, permissions
79
+ - Typed API surface with TypeScript definitions
106
80
 
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
- ```
81
+ ## Changelog
133
82
 
134
- ## 👥 Group Management
83
+ ### 1.0.1
135
84
 
136
- ```js
137
- const metadata = await sock.groupMetadata(jid);
85
+ - Updated reported WhatsApp Web version to `2.3000.1047970367`
86
+ - 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)
87
+ - Reformatted README
138
88
 
139
- // add | remove | promote | demote
140
- await sock.groupParticipantsUpdate(jid, [target], "add");
141
- ```
142
-
143
- ## 📋 Versioning
89
+ ### 1.0.0
144
90
 
145
- This project follows **SemVer**. `1.0.0` is the first stable public release.
91
+ - Initial public release based on the Baileys protocol stack
146
92
 
147
- ## ⚙️ Requirements
93
+ ## Requirements
148
94
 
149
95
  | Requirement | Version |
150
96
  | --- | --- |
151
- | Node.js | ≥ 20 |
152
- | npm | ≥ 9 |
97
+ | Node.js | >= 20 |
98
+ | npm | >= 9 |
99
+
100
+ ## Versioning
101
+
102
+ This project follows [Semantic Versioning](https://semver.org/).
153
103
 
154
- ## 💛 Credits
104
+ ## Credits
155
105
 
156
- Built on the open-source **Baileys** protocol stack (MIT) — WhiskeySockets & maintainers. The original MIT license ships with this package in [`LICENSE`](./LICENSE).
106
+ 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
107
 
158
108
  ---
159
109
 
160
110
  <div align="center">
161
111
  <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>
112
+ <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
113
  </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.1",
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",