@rexxhayanasi/elaina-baileys 1.1.0-rc.7 → 1.1.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 +170 -138
- package/lib/Auth/sqlite.js +8 -9
- package/lib/Socket/socket.js +16 -16
- package/lib/Utils/index.js +2 -1
- package/lib/Utils/resolveJid.js +41 -0
- package/lib/index.js +7 -5
- package/package.json +8 -10
package/README.MD
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
<
|
|
2
|
-
<h1>✨ @rexxhayanasi/elaina-baileys</h1>
|
|
3
|
-
<p><em>Custom WhatsApp library built upon Baileys — enhanced, modernized, and elegant ✨</em></p>
|
|
1
|
+
<img src="https://user-images.githubusercontent.com/74038190/212284100-561aa473-3905-4a80-b561-0d28506553ee.gif" width="100%">
|
|
4
2
|
|
|
5
|
-
|
|
3
|
+
<div align="center">
|
|
4
|
+
<h1>🎄✨ @rexxhayanasi/elaina-baileys ✨🎄</h1>
|
|
5
|
+
<p><em>Custom WhatsApp library built upon Baileys — enhanced, modernized, and elegant.</em></p>
|
|
6
|
+
<p><strong>🎅 Merry Christmas & Happy New Year 2025 🎅</strong></p>
|
|
6
7
|
|
|
8
|
+
<img src="./media/IMG-20251223-WA1753.png" width="450" alt="Elaina Bail Banner" style="border-radius: 15px; border: 2px solid #ff0000;" />
|
|
9
|
+
<br><br>
|
|
7
10
|
|
|
8
|
-
|
|
9
|
-
---
|
|
10
|
-
<p>
|
|
11
|
+
<p>
|
|
11
12
|
<!-- NPM Version -->
|
|
12
13
|
<a href="https://www.npmjs.com/package/@rexxhayanasi/elaina-baileys">
|
|
13
14
|
<img src="https://img.shields.io/npm/v/@rexxhayanasi/elaina-baileys?color=blueviolet&label=version&logo=npm" alt="npm version" />
|
|
@@ -66,243 +67,274 @@
|
|
|
66
67
|
<img src="https://img.shields.io/badge/Status-Baileys-blue?style=for-the-badge&logo=readthedocs&logoColor=white" alt="Status Baileys" />
|
|
67
68
|
</a>
|
|
68
69
|
</p>
|
|
70
|
+
</div>
|
|
69
71
|
|
|
70
|
-
|
|
72
|
+
<div align="center">
|
|
73
|
+
<img src="https://user-images.githubusercontent.com/74038190/212257468-1e9a91f1-b636-4676-a213-39d67b2d5d67.gif" width="100%">
|
|
74
|
+
</div>
|
|
71
75
|
|
|
72
76
|
## 📌 Overview
|
|
77
|
+
> ❄️ `elaina-baileys` is a refined version of the Baileys library with cleaner API usage, exclusive features like album messaging, newsletter controls, and full-size profile uploads — tailored for modern WhatsApp automation needs.
|
|
73
78
|
|
|
74
|
-
>
|
|
79
|
+
> **Christmas Update** 🎁
|
|
80
|
+
> All update information is now redirected to the WhatsApp channel check at the bottom of the "homepage"
|
|
75
81
|
|
|
76
|
-
|
|
77
|
-
+ All update information is now redirected to the WhatsApp channel
|
|
78
|
-
[!]<a href="https://whatsapp.com/channel/0029Vb70uHbD8SE2w5Q9M107">
|
|
79
|
-
<img src="https://img.shields.io/badge/Join-WhatsApp%20Channel-25D366?logo=whatsapp&logoColor=white" alt="WhatsApp Channel" />
|
|
80
|
-
</a>
|
|
82
|
+
---
|
|
81
83
|
|
|
82
84
|
## 📦 Installation
|
|
83
85
|
|
|
84
|
-
### Via `package.json`
|
|
85
|
-
|
|
86
|
+
### Via `package.json`
|
|
87
|
+
|
|
88
|
+
Fork Baileys (NPM) **@whiskeysockets/baileys** / **@adiwajshing/baileys**
|
|
89
|
+
|
|
86
90
|
```json
|
|
91
|
+
@whiskeysockets/baileys
|
|
87
92
|
"dependencies": {
|
|
88
|
-
|
|
93
|
+
"@whiskeysockets/baileys": "npm:@rexxhayanasi/elaina-baileys"
|
|
89
94
|
}
|
|
90
95
|
```
|
|
91
|
-
@adiwajsing/baileys
|
|
92
96
|
```json
|
|
97
|
+
@adiwajsing/baileys
|
|
93
98
|
"dependencies": {
|
|
94
|
-
|
|
99
|
+
"@adiwajshing/baileys": "npm:@rexxhayanasi/elaina-baileys"
|
|
95
100
|
}
|
|
96
101
|
```
|
|
97
102
|
|
|
98
|
-
Or via terminal
|
|
103
|
+
Or via terminal non fork
|
|
99
104
|
```bash
|
|
100
105
|
npm install elaina-bail@npm:@rexxhayanasi/elaina-baileys
|
|
101
106
|
```
|
|
102
107
|
|
|
103
|
-
Importing (
|
|
108
|
+
Importing (for those who don't fork another repository)
|
|
109
|
+
ESM & CJS
|
|
104
110
|
|
|
105
|
-
ESM
|
|
111
|
+
> ESM
|
|
106
112
|
```bash
|
|
107
|
-
import makeWASocket from '@rexxhayanasi/elaina-baileys
|
|
113
|
+
import makeWASocket from '@rexxhayanasi/elaina-baileys
|
|
108
114
|
```
|
|
109
115
|
|
|
110
|
-
CJS
|
|
116
|
+
> CJS
|
|
111
117
|
```bash
|
|
112
118
|
const { default: makeWASocket } = require('@rexxhayanasi/elaina-baileys')
|
|
113
119
|
```
|
|
114
|
-
|
|
115
|
-
|
|
116
120
|
---
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
|
121
|
-
|
|
122
|
-
|
|
|
123
|
-
|
|
|
124
|
-
|
|
|
125
|
-
|
|
|
126
|
-
|
|
|
127
|
-
|
|
|
128
|
-
| 🔐 Pairing Code | Generate custom alphanumeric pairing codes. |
|
|
129
|
-
| 🛠️ Dev Experience | Reduced noise from logs with optimized libsignal printouts. |
|
|
130
|
-
|
|
121
|
+
🌟 Key Features
|
|
122
|
+
| Category | Description |
|
|
123
|
+
|---|---|
|
|
124
|
+
|channels | Seamlessly send messages to WhatsApp Channels. |
|
|
125
|
+
| 🖱️ Buttons | Create interactive messages with button options and quick replies. |
|
|
126
|
+
| 🖼️ Albums | Send grouped images or videos as an album (carousel-like format). |
|
|
127
|
+
| 👤 LID Grouping | Handle group operations using the latest @lid addressing style. |
|
|
128
|
+
| 🤖 AI Message Style | Add a stylized “AI” icon to messages. |
|
|
129
|
+
| 📷 HD Profile Pics | Upload full-size profile pictures without cropping. |
|
|
130
|
+
| 🔐 Pairing Code | Generate custom alphanumeric pairing codes. |
|
|
131
|
+
| 🛠️ Dev Experience | Reduced noise from logs with optimized libsignal printouts. |
|
|
131
132
|
---
|
|
132
133
|
|
|
133
|
-
##
|
|
134
|
+
## 🚀 Features & Usage
|
|
135
|
+
|
|
136
|
+
### 📬 Newsletter Control
|
|
137
|
+
Kelola WhatsApp Newsletter (Channel), mulai dari pembuatan hingga interaksi pesan.
|
|
134
138
|
|
|
135
139
|
<details>
|
|
136
|
-
<summary><strong
|
|
140
|
+
<summary><strong>Lihat Contoh</strong></summary>
|
|
137
141
|
|
|
138
|
-
```
|
|
142
|
+
```js
|
|
139
143
|
// Create a newsletter
|
|
140
144
|
await sock.newsletterCreate("Elaina Updates");
|
|
141
145
|
|
|
142
|
-
//
|
|
143
|
-
await sock.newsletterUpdateDescription(
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
146
|
+
// Update description
|
|
147
|
+
await sock.newsletterUpdateDescription(
|
|
148
|
+
"elaina@newsletter",
|
|
149
|
+
"Fresh updates weekly"
|
|
150
|
+
);
|
|
151
|
+
|
|
152
|
+
// React to a channel message
|
|
153
|
+
await sock.newsletterReactMessage(
|
|
154
|
+
"elaina@newsletter",
|
|
155
|
+
"175",
|
|
156
|
+
"🔥"
|
|
157
|
+
);
|
|
147
158
|
```
|
|
148
|
-
|
|
149
159
|
</details>
|
|
150
160
|
|
|
161
|
+
---
|
|
162
|
+
|
|
163
|
+
### 📌 Interactive Messaging
|
|
164
|
+
Kirim pesan interaktif menggunakan tombol untuk meningkatkan interaksi pengguna.
|
|
165
|
+
|
|
151
166
|
<details>
|
|
152
|
-
<summary><strong
|
|
167
|
+
<summary><strong>Lihat Contoh</strong></summary>
|
|
153
168
|
|
|
154
|
-
```
|
|
169
|
+
```js
|
|
155
170
|
const buttons = [
|
|
156
|
-
{ buttonId:
|
|
157
|
-
{ buttonId:
|
|
171
|
+
{ buttonId: "btn1", buttonText: { displayText: "Click Me" }, type: 1 },
|
|
172
|
+
{ buttonId: "btn2", buttonText: { displayText: "Visit Site" }, type: 1 }
|
|
158
173
|
];
|
|
159
174
|
|
|
160
|
-
|
|
175
|
+
await sock.sendMessage(id, {
|
|
161
176
|
text: "Choose one:",
|
|
162
177
|
footer: "From Elaina with love 💜",
|
|
163
178
|
buttons,
|
|
164
179
|
headerType: 1
|
|
165
|
-
};
|
|
166
|
-
|
|
167
|
-
await sock.sendMessage(id, msg, { quoted: null });
|
|
180
|
+
});
|
|
168
181
|
```
|
|
169
182
|
|
|
170
183
|
</details>
|
|
171
184
|
|
|
185
|
+
---
|
|
186
|
+
|
|
187
|
+
### 🖼️ Send Album
|
|
188
|
+
Kirim beberapa media (gambar atau video) dalam satu pesan album.
|
|
189
|
+
|
|
172
190
|
<details>
|
|
173
|
-
<summary><strong
|
|
191
|
+
<summary><strong>Lihat Contoh</strong></summary>
|
|
174
192
|
|
|
175
|
-
```
|
|
193
|
+
```js
|
|
176
194
|
const media = [
|
|
177
195
|
{ image: { url: "https://example.com/pic1.jpg" } },
|
|
178
196
|
{ video: { url: "https://example.com/clip.mp4" } }
|
|
179
197
|
];
|
|
180
198
|
|
|
181
|
-
await sock.sendMessage(
|
|
199
|
+
await sock.sendMessage(
|
|
200
|
+
id,
|
|
201
|
+
{ album: media, caption: "Memories 💫" }
|
|
202
|
+
);
|
|
182
203
|
```
|
|
183
204
|
|
|
184
205
|
</details>
|
|
185
206
|
|
|
207
|
+
---
|
|
208
|
+
|
|
209
|
+
### 🔐 Custom Pairing Code
|
|
210
|
+
Pairing perangkat WhatsApp menggunakan kode kustom.
|
|
211
|
+
|
|
186
212
|
<details>
|
|
187
|
-
<summary><strong
|
|
213
|
+
<summary><strong>Lihat Contoh</strong></summary>
|
|
214
|
+
|
|
215
|
+
```js
|
|
216
|
+
const code = await sock.requestPairingCode("62xxxxxxxxxx","ELAINA01");
|
|
188
217
|
|
|
189
|
-
|
|
190
|
-
const code = await sock.requestPairingCode("62xxxxxxxxxx", "ELAINA01");
|
|
191
|
-
console.log("Your Pairing Code:", code);
|
|
218
|
+
console.log("Pairing Code:", code);
|
|
192
219
|
```
|
|
193
220
|
|
|
194
221
|
</details>
|
|
195
222
|
|
|
196
|
-
|
|
197
|
-
<summary><strong>📊 Poll Creation</strong></summary>
|
|
223
|
+
---
|
|
198
224
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
name: "Favorite Color?",
|
|
202
|
-
values: ["Red", "Blue", "Green"],
|
|
203
|
-
selectableCount: 1
|
|
204
|
-
};
|
|
225
|
+
### 📊 Poll Creation
|
|
226
|
+
Buat polling untuk voting cepat di chat atau grup.
|
|
205
227
|
|
|
206
|
-
|
|
228
|
+
<details>
|
|
229
|
+
<summary><strong>Lihat Contoh</strong></summary>
|
|
230
|
+
|
|
231
|
+
```js
|
|
232
|
+
await sock.sendMessage(id, {
|
|
233
|
+
poll: {
|
|
234
|
+
name: "Favorite Color?",
|
|
235
|
+
values: ["Red", "Blue", "Green"],
|
|
236
|
+
selectableCount: 1
|
|
237
|
+
}
|
|
238
|
+
});
|
|
207
239
|
```
|
|
208
240
|
|
|
209
241
|
</details>
|
|
210
242
|
|
|
211
|
-
|
|
212
|
-
<summary><strong>📍 Location Sharing</strong></summary>
|
|
243
|
+
---
|
|
213
244
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
degreesLatitude: 37.422,
|
|
217
|
-
degreesLongitude: -122.084,
|
|
218
|
-
name: "Googleplex",
|
|
219
|
-
address: "1600 Amphitheatre Pkwy, Mountain View, CA 94043"
|
|
220
|
-
};
|
|
245
|
+
### 📍 Location Sharing
|
|
246
|
+
Bagikan lokasi lengkap dengan koordinat dan alamat.
|
|
221
247
|
|
|
222
|
-
|
|
248
|
+
<details>
|
|
249
|
+
<summary><strong>Lihat Contoh</strong></summary>
|
|
250
|
+
|
|
251
|
+
```js
|
|
252
|
+
await sock.sendMessage(id, {
|
|
253
|
+
location: {
|
|
254
|
+
degreesLatitude: 37.422,
|
|
255
|
+
degreesLongitude: -122.084,
|
|
256
|
+
name: "Googleplex",
|
|
257
|
+
address: "1600 Amphitheatre Pkwy, Mountain View"
|
|
258
|
+
}
|
|
259
|
+
});
|
|
223
260
|
```
|
|
224
261
|
|
|
225
262
|
</details>
|
|
226
263
|
|
|
227
|
-
|
|
228
|
-
|
|
264
|
+
---
|
|
265
|
+
|
|
266
|
+
### 👥 Group Management
|
|
267
|
+
Kelola grup WhatsApp: membuat grup, menambah anggota, dan memperbarui deskripsi.
|
|
268
|
+
|
|
229
269
|
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
const group = await sock.groupCreate("My New Group", [number1, number2]);
|
|
270
|
+
<details>
|
|
271
|
+
<summary><strong>Lihat Contoh</strong></summary>
|
|
233
272
|
|
|
234
|
-
|
|
235
|
-
await sock.
|
|
273
|
+
```js
|
|
274
|
+
const group = await sock.groupCreate(
|
|
275
|
+
"My New Group",
|
|
276
|
+
[number1, number2]
|
|
277
|
+
);
|
|
236
278
|
|
|
237
|
-
|
|
238
|
-
await sock.groupUpdateDescription(group.id,
|
|
279
|
+
await sock.groupAdd(group.id, [number3]);
|
|
280
|
+
await sock.groupUpdateDescription(group.id,"This is our awesome group!"
|
|
281
|
+
);
|
|
239
282
|
```
|
|
240
283
|
|
|
241
284
|
</details>
|
|
242
285
|
|
|
243
286
|
---
|
|
244
287
|
|
|
245
|
-
|
|
288
|
+
### 🐞 Menemukan Bug?
|
|
246
289
|
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
## 🐞 Found a Bug?
|
|
290
|
+
Jika Anda menemukan bug atau kendala saat menggunakan proyek ini, silakan lakukan salah satu opsi berikut:
|
|
250
291
|
|
|
251
|
-
|
|
252
|
-
|
|
292
|
+
- **Buka Issue** melalui website resmi (segera hadir)
|
|
293
|
+
- **Hubungi maintainer langsung** melalui WhatsApp
|
|
253
294
|
|
|
254
295
|
<p align="center">
|
|
255
|
-
<a href="https://wa.me/6285282530851" target="_blank">
|
|
256
|
-
<img
|
|
296
|
+
<a href="https://wa.me/6285282530851" target="_blank" rel="noopener noreferrer">
|
|
297
|
+
<img
|
|
298
|
+
alt="Chat on WhatsApp"
|
|
299
|
+
src="https://img.shields.io/badge/Chat%20on%20WhatsApp-25D366?style=for-the-badge&logo=whatsapp&logoColor=white"
|
|
300
|
+
/>
|
|
257
301
|
</a>
|
|
258
302
|
</p>
|
|
259
|
-
|
|
260
|
-
---
|
|
261
|
-
|
|
262
303
|
<details>
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
Terima kasih kepada pihak-pihak yang telah memberikan dukungan, inspirasi, dan kontribusi secara langsung maupun tidak langsung dalam pengembangan proyek ini:
|
|
266
|
-
|
|
267
|
-
- **Allah SWT**
|
|
268
|
-
For all His grace and ease.
|
|
269
|
-
|
|
270
|
-
- **Parent**
|
|
271
|
-
For your continued love, prayers, and support.
|
|
304
|
+
<summary>🙏 <strong>TQTO (Thanks To)</strong></summary>
|
|
272
305
|
|
|
273
|
-
|
|
274
|
-
As an initial foundation and reference in the development of this system.
|
|
306
|
+
Terima kasih kepada semua pihak yang telah memberikan dukungan, inspirasi, serta kontribusi—baik secara langsung maupun tidak langsung—dalam pengembangan proyek ini:
|
|
275
307
|
|
|
276
|
-
- **
|
|
277
|
-
|
|
308
|
+
- **Allah SWT** — atas segala rahmat, kemudahan, dan perlindungan-Nya.
|
|
309
|
+
- **Orang Tua** — atas kasih sayang, doa, dan dukungan yang tiada henti.
|
|
310
|
+
- **Nstar-Y / Nstar-bail** — sebagai fondasi awal dan referensi dalam pengembangan sistem ini.
|
|
311
|
+
- **RexxHayanasi (Saya)** — pengembang utama proyek ini.
|
|
278
312
|
|
|
279
313
|
</details>
|
|
280
314
|
|
|
281
315
|
> [!CAUTION]
|
|
282
|
-
> Built on top of the WhiskeySockets/Baileys project. All original core logic credits go to their team. elaina-
|
|
283
|
-
|
|
284
|
-
---
|
|
285
|
-
|
|
286
|
-
### 🙌 Contributors outside the Baileys code
|
|
287
|
-
|
|
316
|
+
> Built on top of the WhiskeySockets/Baileys project. All original core logic credits go to their team. elaina-baileys extends it with thoughtful UX and DX improvements.
|
|
317
|
+
> 🙌 Contributors outside the Baileys code
|
|
288
318
|
Thanks to the following awesome contributors who help improve this project 💖
|
|
289
319
|
|
|
290
320
|
<table>
|
|
291
|
-
|
|
292
|
-
<td align="center">
|
|
293
|
-
<a href="https://github.com/RexxHayanasi">
|
|
294
|
-
<img src="https://avatars.githubusercontent.com/u/150516773?v=4" width="80px;" style="border-radius:50%;" alt="Matstoree"/>
|
|
295
|
-
<br />
|
|
296
|
-
<sub><b>RexxHayanasi [ developer project ]</b></sub>
|
|
297
|
-
</a>
|
|
298
|
-
</td>
|
|
321
|
+
<tr>
|
|
299
322
|
<td align="center">
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
323
|
+
<a href="https://github.com/RexxHayanasi">
|
|
324
|
+
<img src="https://avatars.githubusercontent.com/u/150516773?v=4" width="80px;" style="border-radius:50%;" alt="Matstoree"/>
|
|
325
|
+
<br />
|
|
326
|
+
<sub><b>RexxHayanasi [ developer project ]</b></sub>
|
|
327
|
+
</a>
|
|
328
|
+
</td>
|
|
329
|
+
|
|
330
|
+
<td align="center">
|
|
331
|
+
<a href="https://github.com/kiuur">
|
|
332
|
+
<img src="https://avatars.githubusercontent.com/u/182334162?v=4" width="80px;" style="border-radius:50%;" alt="Matstoree"/>
|
|
333
|
+
<br />
|
|
334
|
+
<sub><b>Kyuu [ kiuur ]</b></sub>
|
|
335
|
+
</a>
|
|
336
|
+
</td>
|
|
337
|
+
</tr>
|
|
308
338
|
</table>
|
|
339
|
+
|
|
340
|
+
<img src="https://user-images.githubusercontent.com/74038190/212284100-561aa473-3905-4a80-b561-0d28506553ee.gif" width="100%" style="transform: rotate(180deg);">
|
package/lib/Auth/sqlite.js
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.useSQLiteAuth = void 0;
|
|
5
5
|
|
|
6
|
-
const
|
|
7
|
-
const
|
|
6
|
+
const BetterSqlite = require("better-sqlite3");
|
|
7
|
+
const { BufferJSON } = require("../index");
|
|
8
|
+
const { initAuthCreds } = require("../Utils");
|
|
8
9
|
|
|
9
|
-
const BetterSqlite = better_sqlite3_1.default || better_sqlite3_1;
|
|
10
10
|
const db = new BetterSqlite("./session.db");
|
|
11
11
|
|
|
12
12
|
db.exec(`
|
|
@@ -19,23 +19,22 @@ db.exec(`
|
|
|
19
19
|
const useSQLiteAuth = () => {
|
|
20
20
|
const readData = (id) => {
|
|
21
21
|
const row = db.prepare("SELECT data FROM auth WHERE id=?").get(id);
|
|
22
|
-
return row ? JSON.parse(row.data,
|
|
22
|
+
return row ? JSON.parse(row.data, BufferJSON.reviver) : null;
|
|
23
23
|
};
|
|
24
24
|
|
|
25
25
|
const writeData = (id, data) => {
|
|
26
26
|
db.prepare("INSERT OR REPLACE INTO auth VALUES (?, ?)")
|
|
27
|
-
|
|
27
|
+
.run(id, JSON.stringify(data, BufferJSON.replacer));
|
|
28
28
|
};
|
|
29
29
|
|
|
30
30
|
const state = {
|
|
31
|
-
creds: readData("creds") ||
|
|
31
|
+
creds: readData("creds") || initAuthCreds(),
|
|
32
32
|
keys: {
|
|
33
33
|
get(type, ids) {
|
|
34
34
|
const data = {};
|
|
35
35
|
for (const id of ids) {
|
|
36
|
-
const
|
|
37
|
-
if (
|
|
38
|
-
data[id] = v;
|
|
36
|
+
const value = readData(`${type}-${id}`);
|
|
37
|
+
if (value) data[id] = value;
|
|
39
38
|
}
|
|
40
39
|
return data;
|
|
41
40
|
},
|
package/lib/Socket/socket.js
CHANGED
|
@@ -429,8 +429,12 @@ const end = (error) => {
|
|
|
429
429
|
authState.creds.pairingCode = (0, Utils_1.bytesToCrockford)((0, crypto_1.randomBytes)(5))
|
|
430
430
|
}
|
|
431
431
|
|
|
432
|
-
authState.creds.
|
|
433
|
-
|
|
432
|
+
authState.creds.me = {
|
|
433
|
+
id: (0, WABinary_1.jidEncode)(phoneNumber, 's.whatsapp.net'),
|
|
434
|
+
name: '~'
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
ev.emit('creds.update', authState.creds)
|
|
434
438
|
|
|
435
439
|
await sendNode({
|
|
436
440
|
tag: 'iq',
|
|
@@ -444,8 +448,9 @@ ev.emit('creds.update', authState.creds)
|
|
|
444
448
|
{
|
|
445
449
|
tag: 'link_code_companion_reg',
|
|
446
450
|
attrs: {
|
|
447
|
-
|
|
448
|
-
|
|
451
|
+
jid: authState.creds.me.id,
|
|
452
|
+
stage: 'companion_hello',
|
|
453
|
+
should_show_push_notification: 'true'
|
|
449
454
|
},
|
|
450
455
|
content: [
|
|
451
456
|
{
|
|
@@ -525,19 +530,14 @@ ev.emit('creds.update', authState.creds)
|
|
|
525
530
|
};
|
|
526
531
|
ws.on('message', onMessageReceived);
|
|
527
532
|
ws.on('open', async () => {
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
authState.creds.isConnecting = true;
|
|
531
|
-
ev.emit('creds.update', authState.creds);
|
|
533
|
+
try {
|
|
534
|
+
await validateConnection();
|
|
532
535
|
}
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
end(err);
|
|
539
|
-
}
|
|
540
|
-
});
|
|
536
|
+
catch (err) {
|
|
537
|
+
logger.error({ err }, 'error in validating connection');
|
|
538
|
+
end(err);
|
|
539
|
+
}
|
|
540
|
+
});
|
|
541
541
|
ws.on('error', mapWebSocketError(end));
|
|
542
542
|
ws.on('close', () => end(new boom_1.Boom('Connection Terminated', { statusCode: Types_1.DisconnectReason.connectionClosed })));
|
|
543
543
|
// the server terminated the connection
|
package/lib/Utils/index.js
CHANGED
|
@@ -32,4 +32,5 @@ __exportStar(require("./link-preview"), exports);
|
|
|
32
32
|
__exportStar(require("./event-buffer"), exports);
|
|
33
33
|
__exportStar(require("./process-message"), exports);
|
|
34
34
|
__exportStar(require("./message-retry-manager"), exports);
|
|
35
|
-
__exportStar(require("./browser-utils"), exports);
|
|
35
|
+
__exportStar(require("./browser-utils"), exports);
|
|
36
|
+
__exportStar(require("./resolveJid"), exports);
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.resolveJid = void 0;
|
|
5
|
+
|
|
6
|
+
const WABinary = require("../WABinary");
|
|
7
|
+
|
|
8
|
+
async function resolveJid(sock, m, target) {
|
|
9
|
+
if (target === void 0) target = null;
|
|
10
|
+
|
|
11
|
+
const input =
|
|
12
|
+
target ||
|
|
13
|
+
(m.mentionedJid && m.mentionedJid[0]) ||
|
|
14
|
+
m.participant ||
|
|
15
|
+
(m.key && (m.key.participant || m.key.remoteJid));
|
|
16
|
+
|
|
17
|
+
if (!input)
|
|
18
|
+
return null;
|
|
19
|
+
|
|
20
|
+
if (/@s\.whatsapp\.net$/.test(input))
|
|
21
|
+
return input;
|
|
22
|
+
|
|
23
|
+
const chat =
|
|
24
|
+
m.chat ||
|
|
25
|
+
(m.key && m.key.remoteJid);
|
|
26
|
+
|
|
27
|
+
if (!chat || !chat.endsWith("@g.us"))
|
|
28
|
+
return null;
|
|
29
|
+
|
|
30
|
+
const metadata = await sock.groupMetadata(chat);
|
|
31
|
+
|
|
32
|
+
const participant = metadata.participants.find(p =>
|
|
33
|
+
WABinary.areJidsSameUser(p.jid, input) ||
|
|
34
|
+
WABinary.areJidsSameUser(p.id, input) ||
|
|
35
|
+
(p.lid && p.lid === input)
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
return participant ? participant.jid : null;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
exports.resolveJid = resolveJid;
|
package/lib/index.js
CHANGED
|
@@ -3,12 +3,14 @@
|
|
|
3
3
|
const chalk = require("chalk");
|
|
4
4
|
const gradient = require("gradient-string");
|
|
5
5
|
|
|
6
|
-
const title = "@rexxhayanasi/elaina-baileys| Default Paircode: ELAI-NAMD";
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
console.log(gradient(["#
|
|
11
|
-
console.log(gradient(["#
|
|
7
|
+
const title = "🎄 @rexxhayanasi/elaina-baileys | 🎅 Christmas 2025 Edition 🎅 | Paircode: ELAI-NAMD";
|
|
8
|
+
|
|
9
|
+
console.log(gradient(["#FF0000", "#00FF00", "#FFFFFF"])("❄️ ═════════════════════════════════════════════════════════════════ ❄️"));
|
|
10
|
+
console.log(gradient(["#FF0000", "#FFFFFF", "#FF0000"])(title));
|
|
11
|
+
console.log(gradient(["#FFD700", "#FFFFFF"])("🎁 Semoga kode Anda bebas dari bug selama musim liburan ini! 🎁"));
|
|
12
|
+
console.log(gradient(["#00FF00", "#FFFFFF", "#00FF00"])("> Hubungi Tim @rexxhayanasi/elaina-baileys jika baileys terjadi error <"));
|
|
13
|
+
console.log(gradient(["#FF0000", "#00FF00", "#FFFFFF"])("❄️ ═════════════════════════════════════════════════════════════════ ❄️"));
|
|
12
14
|
|
|
13
15
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
16
|
if (k2 === undefined) k2 = k;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rexxhayanasi/elaina-baileys",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "Custom Baileys WhatsApp API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"baileys",
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
"whatsapp-web",
|
|
13
13
|
"whatsapp-bot",
|
|
14
14
|
"automation",
|
|
15
|
-
"multi-device"
|
|
15
|
+
"multi-device",
|
|
16
|
+
"RexxHayanasi"
|
|
16
17
|
],
|
|
17
18
|
"homepage": "https://whatsapp.com/channel/0029Vb70uHbD8SE2w5Q9M107",
|
|
18
19
|
"license": "MIT",
|
|
@@ -46,8 +47,8 @@
|
|
|
46
47
|
"@cacheable/node-cache": "^1.4.0",
|
|
47
48
|
"@hapi/boom": "^9.1.3",
|
|
48
49
|
"async-mutex": "^0.5.0",
|
|
50
|
+
"audio-decode": "^2.1.3",
|
|
49
51
|
"axios": "^1.6.0",
|
|
50
|
-
"better-sqlite3": "^12.5.0",
|
|
51
52
|
"chalk": "^4.1.2",
|
|
52
53
|
"gradient-string": "^2.0.2",
|
|
53
54
|
"cache-manager": "^5.7.6",
|
|
@@ -71,7 +72,7 @@
|
|
|
71
72
|
"conventional-changelog-cli": "^2.2.2",
|
|
72
73
|
"eslint": "^8.0.0",
|
|
73
74
|
"jest": "^27.0.6",
|
|
74
|
-
"jimp": "^
|
|
75
|
+
"jimp": "^0.22.10",
|
|
75
76
|
"json": "^11.0.0",
|
|
76
77
|
"link-preview-js": "^3.0.0",
|
|
77
78
|
"open": "^8.4.2",
|
|
@@ -84,16 +85,13 @@
|
|
|
84
85
|
"typescript": "^5.8.2"
|
|
85
86
|
},
|
|
86
87
|
"peerDependencies": {
|
|
87
|
-
"audio-decode": "^2.1.3",
|
|
88
88
|
"jimp": "^0.22.10",
|
|
89
89
|
"link-preview-js": "^3.0.0",
|
|
90
90
|
"qrcode-terminal": "^0.12.0",
|
|
91
|
-
"sharp": "^0.34.1"
|
|
91
|
+
"sharp": "^0.34.1",
|
|
92
|
+
"better-sqlite3": "^12.5.0"
|
|
92
93
|
},
|
|
93
|
-
"peerDependenciesMeta": {
|
|
94
|
-
"audio-decode": {
|
|
95
|
-
"optional": true
|
|
96
|
-
},
|
|
94
|
+
"peerDependenciesMeta": {
|
|
97
95
|
"jimp": {
|
|
98
96
|
"optional": true
|
|
99
97
|
},
|