alipclutch-baileys 8.0.0 → 8.2.0

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
@@ -1,352 +1,15 @@
1
- # <div align='center'>alipclutch</div>
2
-
3
- <div align='center'>
4
-
5
- [![npm version](https://img.shields.io/npm/v/alipclutch.svg)](https://www.npmjs.com/package/alipclutch)
6
- [![License](https://img.shields.io/badge/license-GPL%203-blue.svg)](LICENSE)
7
- [![Downloads](https://img.shields.io/npm/dm/alipclutch.svg)](https://www.npmjs.com/package/alipclutch)
8
-
9
- </div>
10
-
11
- **alipclutch** is a modern WebSocket-based TypeScript library for interacting with the WhatsApp Web API. This library has been enhanced to address issues with WhatsApp group `@lid` and `@jid` handling, ensuring robust performance.
12
-
13
- ## ✨ Key Features
14
-
15
- - 🚀 **Modern & Fast** - Built with TypeScript and cutting-edge technologies
16
- - 🔧 **Fixed @lid & @jid** - Resolved WhatsApp group `@lid` to @pn` issues
17
- - 📱 **Multi-Device Support** - Supports WhatsApp multi-device connections
18
- - 🔐 **End-to-End Encryption** - Fully encrypted communications
19
- - 📨 **All Message Types** - Supports all message types (text, media, polls, etc.)
20
- - 🎯 **Easy to Use** - Simple and intuitive API
21
-
22
- ## ⚠️ Disclaimer
23
-
24
- This project is not affiliated, associated, authorized, endorsed by, or in any way officially connected with WhatsApp or any of its subsidiaries or affiliates. The official WhatsApp website can be found at [whatsapp.com](https://whatsapp.com).
25
-
26
- The maintainers of `alipclutch` do not condone the use of this application in practices that violate WhatsApp's Terms of Service. We urge users to exercise personal responsibility and use this application fairly and responsibly.
27
-
28
- **Use wisely. Avoid spamming. Refrain from excessive automated usage.**
29
-
30
- ## 📦 Installation
31
-
32
- ### Stable Version (Recommended)
33
- ```bash
34
- npm i alipclutch
35
- ```
36
-
37
- ### Edge Version (Latest Features)
38
- ```bash
39
- npm i alipclutch@latest
40
- # or
41
- yarn add alipclutch@latest
42
- ```
43
-
44
- ### Import in Code
45
- ```javascript
46
- const { default: makeWASocket } = require("alipclutch")
47
- // or ES6
48
- import makeWASocket from "alipclutch"
49
- ```
50
-
51
- ## 🚀 Quick Start
52
-
53
- ### Example
54
- Here is an example you can use: [example.ts](Example/example.ts) or follow this tutorial to run the alipclutch WhatsApp API code:
55
- 1. ```bash
56
- cd path/to/alipclutch
57
- ```
58
- 2. ```bash
59
- npm install
60
- ```
61
- 3. ```bash
62
- node example.js
63
- ```
64
-
65
- ### Basic Example
66
- ```javascript
67
- const { default: makeWASocket, DisconnectReason, useMultiFileAuthState } = require('alipclutch')
68
- const { Boom } = require('@hapi/boom')
69
-
70
- async function connectToWhatsApp() {
71
- const { state, saveCreds } = await useMultiFileAuthState('auth_info_baileys')
72
-
73
- const sock = makeWASocket({
74
- auth: state,
75
- printQRInTerminal: true,
76
- browser: ['alipclutch', 'Desktop', '3.0']
77
- })
78
-
79
- sock.ev.on('connection.update', (update) => {
80
- const { connection, lastDisconnect } = update
81
- if(connection === 'close') {
82
- const shouldReconnect = (lastDisconnect?.error as Boom)?.output?.statusCode !== DisconnectReason.loggedOut
83
- console.log('Connection closed due to ', lastDisconnect.error, ', reconnecting ', shouldReconnect)
84
- if(shouldReconnect) {
85
- connectToWhatsApp()
86
- }
87
- } else if(connection === 'open') {
88
- console.log('✅ Successfully connected to WhatsApp!')
89
- }
90
- })
91
-
92
- sock.ev.on('messages.upsert', async ({ messages }) => {
93
- for (const m of messages) {
94
- if (!m.message) continue
95
-
96
- console.log('📱 New message:', JSON.stringify(m, undefined, 2))
97
-
98
- // Auto reply
99
- await sock.sendMessage(m.key.remoteJid!, {
100
- text: 'Hello! I am a WhatsApp bot using alipclutch 🤖'
101
- })
102
- }
103
- })
104
-
105
- sock.ev.on('creds.update', saveCreds)
106
- }
107
-
108
- connectToWhatsApp()
109
- ```
110
-
111
- # Index
112
-
113
- - [Connecting Account](#connecting-account)
114
- - [Connect with QR Code](#starting-socket-with-qr-code)
115
- - [Connect with Pairing Code](#starting-socket-with-pairing-code)
116
- - [Receive Full History](#receive-full-history)
117
- - [Important Notes About Socket Config](#important-notes-about-socket-config)
118
- - [Caching Group Metadata (Recommended)](#caching-group-metadata-recommended)
119
- - [Improve Retry System & Decrypt Poll Votes](#improve-retry-system--decrypt-poll-votes)
120
- - [Receive Notifications in WhatsApp App](#receive-notifications-in-whatsapp-app)
121
- - [Save Auth Info](#saving--restoring-sessions)
122
- - [Handling Events](#handling-events)
123
- - [Example to Start](#example-to-start)
124
- - [Decrypt Poll Votes](#decrypt-poll-votes)
125
- - [Summary of Events on First Connection](#summary-of-events-on-first-connection)
126
- - [Implementing a Data Store](#implementing-a-data-store)
127
- - [WhatsApp IDs Explained](#whatsapp-ids-explain)
128
- - [Utility Functions](#utility-functions)
129
- - [Sending Messages](#sending-messages)
130
- - [Non-Media Messages](#non-media-messages)
131
- - [Sending with Link Preview](#sending-messages-with-link-previews)
132
- - [Media Messages](#media-messages)
133
- - [Modify Messages](#modify-messages)
134
- - [Manipulating Media Messages](#manipulating-media-messages)
135
- - [Reject Call](#reject-call)
136
- - [Send States in Chat](#send-states-in-chat)
137
- - [Modifying Chats](#modifying-chats)
138
- - [User Queries](#user-querys)
139
- - [Change Profile](#change-profile)
140
- - [Groups](#groups)
141
- - [Privacy](#privacy)
142
- - [Broadcast Lists & Stories](#broadcast-lists--stories)
143
- - [Writing Custom Functionality](#writing-custom-functionality)
144
- - [Tips & Best Practices](#tips--best-practices)
145
- - [Troubleshooting](#troubleshooting)
146
- - [Contributing](#contributing)
147
- - [License](#license)
148
- - [Acknowledgments](#acknowledgments)
149
-
150
- ## Connecting Account
151
-
152
- WhatsApp provides a multi-device API that allows `alipclutch` to authenticate as a secondary WhatsApp client via QR code or pairing code.
153
-
154
- ### Starting Socket with **QR Code**
155
-
156
- > [!TIP]
157
- > Customize the browser name using the `Browsers` constant. See available configurations [here](https://baileys.whiskeysockets.io/types/BrowsersMap.html).
158
-
159
- ```javascript
160
- const { default: makeWASocket, Browsers } = require("alipclutch")
161
-
162
- const sock = makeWASocket({
163
- browser: Browsers.ubuntu('My App'),
164
- printQRInTerminal: true
165
- })
166
- ```
167
-
168
- Upon successful connection, a QR code will be printed in the terminal. Scan it with WhatsApp on your phone to log in.
169
-
170
- ### Starting Socket with **Pairing Code**
171
-
172
- > [!IMPORTANT]
173
- > Pairing codes are not part of the Mobile API. They allow connecting WhatsApp Web without a QR code, but only one device can be connected. See [WhatsApp FAQ](https://faq.whatsapp.com/1324084875126592/?cms_platform=web).
174
-
175
- Phone numbers must exclude `+`, `()`, or `-`, and include the country code.
176
-
177
- ```javascript
178
- const { default: makeWASocket } = require("alipclutch")
179
-
180
- const sock = makeWASocket({
181
- printQRInTerminal: false
182
- })
183
-
184
- // Normal Pairing
185
- if (!sock.authState.creds.registered) {
186
- const number = '6285134816783'
187
- const code = await sock.requestPairingCode(number)
188
- console.log('🔑 Pairing Code:', code)
189
- }
190
-
191
- // Custom Pairing
192
- if (!sock.authState.creds.registered) {
193
- const pair = "YP240125" // 8 characters
194
- const number = '6285134816783'
195
- const code = await sock.requestPairingCode(number, pair)
196
- console.log('🔑 Custom Pairing Code:', code)
197
- }
198
- ```
199
-
200
- ### Receive Full History
201
-
202
- 1. Set `syncFullHistory` to `true`.
203
- 2. By default, alipclutch uses Chrome browser config. For desktop-like connections (to receive more message history), use:
204
-
205
- ```javascript
206
- const { default: makeWASocket, Browsers } = require("alipclutch")
207
-
208
- const sock = makeWASocket({
209
- browser: Browsers.macOS('Desktop'),
210
- syncFullHistory: true
211
- })
212
- ```
213
-
214
- ## Important Notes About Socket Config
215
-
216
- ### Caching Group Metadata (Recommended)
217
-
218
- For group usage, implement caching for group metadata:
219
-
220
- ```javascript
221
- const { default: makeWASocket } = require("alipclutch")
222
- const NodeCache = require('node-cache')
223
-
224
- const groupCache = new NodeCache({ stdTTL: 5 * 60, useClones: false })
225
-
226
- const sock = makeWASocket({
227
- cachedGroupMetadata: async (jid) => groupCache.get(jid)
228
- })
229
-
230
- sock.ev.on('groups.update', async ([event]) => {
231
- const metadata = await sock.groupMetadata(event.id)
232
- groupCache.set(event.id, metadata)
233
- })
234
-
235
- sock.ev.on('group-participants.update', async (event) => {
236
- const metadata = await sock.groupMetadata(event.id)
237
- groupCache.set(event.id, metadata)
238
- })
239
- ```
240
-
241
- ### Improve Retry System & Decrypt Poll Votes
242
-
243
- Enhance message sending and poll vote decryption with a store:
244
-
245
- ```javascript
246
- const sock = makeWASocket({
247
- getMessage: async (key) => await getMessageFromStore(key)
248
- })
249
- ```
250
-
251
- ### Receive Notifications in WhatsApp App
252
-
253
- Disable online status to receive notifications:
254
-
255
- ```javascript
256
- const sock = makeWASocket({
257
- markOnlineOnConnect: false
258
- })
259
- ```
260
-
261
- ## Saving & Restoring Sessions
262
-
263
- Avoid rescanning QR codes by saving credentials:
264
-
265
- ```javascript
266
- const makeWASocket = require("alipclutch").default
267
- const { useMultiFileAuthState } = require("alipclutch")
268
-
269
- async function connect() {
270
- const { state, saveCreds } = await useMultiFileAuthState('auth_info_baileys')
271
- const sock = makeWASocket({ auth: state })
272
- sock.ev.on('creds.update', saveCreds)
273
- }
274
-
275
- connect()
276
- ```
277
-
278
- > [!IMPORTANT]
279
- > `useMultiFileAuthState` saves auth state in a folder. For production, use SQL/no-SQL databases and carefully manage key updates.
280
-
281
- ## Handling Events
282
-
283
- alipclutch uses EventEmitter for events, fully typed for IDE support.
284
-
285
- > [!IMPORTANT]
286
- > See all events [here](https://baileys.whiskeysockets.io/types/BaileysEventMap.html).
287
-
288
- ```javascript
289
- const sock = makeWASocket()
290
- sock.ev.on('messages.upsert', ({ messages }) => {
291
- console.log('Got messages:', messages)
292
- })
293
- ```
294
-
295
- ### Example to Start
296
-
297
- ```javascript
298
- const makeWASocket = require("alipclutch").default
299
- const { DisconnectReason, useMultiFileAuthState } = require("alipclutch")
300
- const { Boom } = require('@hapi/boom')
301
-
302
- async function connectToWhatsApp() {
303
- const { state, saveCreds } = await useMultiFileAuthState('auth_info_baileys')
304
- const sock = makeWASocket({
305
- auth: state,
306
- printQRInTerminal: true
307
- })
308
-
309
- sock.ev.on('connection.update', (update) => {
310
- const { connection, lastDisconnect } = update
311
- if(connection === 'close') {
312
- const shouldReconnect = (lastDisconnect.error as Boom)?.output?.statusCode !== DisconnectReason.loggedOut
313
- console.log('Connection closed due to ', lastDisconnect.error, ', reconnecting ', shouldReconnect)
314
- if(shouldReconnect) {
315
- connectToWhatsApp()
316
- }
317
- } else if(connection === 'open') {
318
- console.log('Opened connection')
319
- }
320
- })
321
-
322
- sock.ev.on('messages.upsert', async ({ messages }) => {
323
- for (const m of messages) {
324
- console.log(JSON.stringify(m, undefined, 2))
325
- console.log('Replying to', m.key.remoteJid)
326
- await sock.sendMessage(m.key.remoteJid!, { text: 'Hello World' })
327
- }
328
- })
329
-
330
- sock.ev.on('creds.update', saveCreds)
331
- }
332
-
333
- connectToWhatsApp()
334
- ```
335
-
336
- ## License
337
-
338
- Distributed under the GPL-3.0 License. See `LICENSE` for more information.
339
-
340
- ## Acknowledgments
341
-
342
- - [Group](https://chat.whatsapp.com/DUWddjCXWv4CCoeS8uP2lP) - Comunity
1
+ # 🤖 alipclutch-baileys
2
+ _Modified Baileys Library by alip clutch_
343
3
 
344
4
  ---
345
5
 
346
- <div align='center'>
347
-
348
- **Fork from baileys modified by alipclutch**
6
+ ## 🚀 Features
7
+ - Multi-device ready
8
+ - Stable connection system
9
+ - Custom command handler
349
10
 
350
- *alipclutch - Modern WhatsApp Web API with Fixed @lid To @pn*
11
+ ---
351
12
 
352
- </div>
13
+ ## 📦 Install
14
+ ```bash
15
+ npm install alipclutch-baileys
@@ -1,4 +1,3 @@
1
- // Baileys By Denzy ZeroDay
2
1
  "use strict";
3
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
4
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "alipclutch-baileys",
3
- "version": "8.0.0",
3
+ "version": "8.2.0",
4
4
  "description": "Modified WhatsApp Web API Library",
5
5
  "keywords": [
6
6
  "baileys",