@realvare/based 2.6.11 β 2.6.23
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 +364 -364
- package/lib/Socket/messages-recv.js +34 -10
- package/lib/Socket/messages-send.js +38 -17
- package/lib/Types/Socket.d.ts +1 -1
- package/lib/Utils/cache-manager.js +7 -3
- package/lib/Utils/logger.js +53 -1
- package/lib/Utils/messages-media.js +1 -1
- package/lib/Utils/messages.js +29 -166
- package/lib/Utils/performance-config.js +16 -18
- package/lib/Utils/thumbnail.js +35 -0
- package/lib/Utils/use-multi-file-auth-state.js +5 -1
- package/package.json +8 -9
package/README.MD
CHANGED
|
@@ -6,106 +6,106 @@
|
|
|
6
6
|

|
|
7
7
|
<br>
|
|
8
8
|
<p align="center">
|
|
9
|
-
<img src="https://img.shields.io/npm/v/@realvare/based?style=for-the-badge&color=8a2be2&labelColor=2d1b69" alt="
|
|
10
|
-
<img src="https://img.shields.io/npm/dm/@realvare/based?style=for-the-badge&color=8a2be2&labelColor=2d1b69" alt="
|
|
11
|
-
<img src="https://img.shields.io/badge/
|
|
12
|
-
<img src="https://img.shields.io/github/stars/realvare/based?style=for-the-badge&color=8a2be2&labelColor=2d1b69" alt="GitHub
|
|
9
|
+
<img src="https://img.shields.io/npm/v/@realvare/based?style=for-the-badge&color=8a2be2&labelColor=2d1b69" alt="NPM Version">
|
|
10
|
+
<img src="https://img.shields.io/npm/dm/@realvare/based?style=for-the-badge&color=8a2be2&labelColor=2d1b69" alt="NPM Downloads">
|
|
11
|
+
<img src="https://img.shields.io/badge/License-MIT-8a2be2.svg?style=for-the-badge&labelColor=2d1b69" alt="MIT License">
|
|
12
|
+
<img src="https://img.shields.io/github/stars/realvare/based?style=for-the-badge&color=8a2be2&labelColor=2d1b69" alt="GitHub Stars">
|
|
13
13
|
<img src="https://img.shields.io/github/forks/realvare/based?style=for-the-badge&color=8a2be2&labelColor=2d1b69" alt="GitHub Forks">
|
|
14
14
|
</p>
|
|
15
15
|
<p align="center">
|
|
16
|
-
<a href="#-
|
|
17
|
-
<a href="#-
|
|
18
|
-
<a href="#-
|
|
19
|
-
<a href="#-
|
|
20
|
-
<a href="#-
|
|
16
|
+
<a href="#-main-features"><img src="https://img.shields.io/badge/_Features-8a2be2?style=flat-square&logo=github&logoColor=white"/></a>
|
|
17
|
+
<a href="#-installation"><img src="https://img.shields.io/badge/_Installation-8a2be2?style=flat-square&logo=npm&logoColor=white"/></a>
|
|
18
|
+
<a href="#-quick-guide"><img src="https://img.shields.io/badge/_Quick_Guide-8a2be2?style=flat-square&logo=rocket&logoColor=white"/></a>
|
|
19
|
+
<a href="#-api-documentation"><img src="https://img.shields.io/badge/_API_Documentation-8a2be2?style=flat-square&logo=book&logoColor=white"/></a>
|
|
20
|
+
<a href="#-support-and-community"><img src="https://img.shields.io/badge/_Support-8a2be2?style=flat-square&logo=teamspeak&logoColor=white"/></a>
|
|
21
21
|
</p>
|
|
22
|
-
<img src="https://readme-typing-svg.herokuapp.com?font=Fira+Code&weight=600&size=20&duration=4000&pause=2500&color=8A2BE2¢er=true&vCenter=true&width=800&lines=π+
|
|
22
|
+
<img src="https://readme-typing-svg.herokuapp.com?font=Fira+Code&weight=600&size=20&duration=4000&pause=2500&color=8A2BE2¢er=true&vCenter=true&width=800&lines=π+A+modern%2C+powerful+and+fast+WhatsApp+Web+API+library;π+With+support+for+LID%2FJID+and+multi-device;">
|
|
23
23
|
|
|
24
24
|
----
|
|
25
25
|
|
|
26
26
|
</div>
|
|
27
27
|
|
|
28
|
-
##
|
|
29
|
-
|
|
30
|
-
- [
|
|
31
|
-
- [β¨
|
|
32
|
-
- [π
|
|
33
|
-
- [
|
|
34
|
-
- [
|
|
35
|
-
- [π
|
|
36
|
-
- [
|
|
37
|
-
- [π
|
|
38
|
-
- [
|
|
39
|
-
- [
|
|
40
|
-
- [Logging
|
|
41
|
-
- [
|
|
42
|
-
- [π
|
|
43
|
-
- [ποΈ
|
|
44
|
-
- [π―
|
|
45
|
-
- [πͺ
|
|
46
|
-
- [
|
|
47
|
-
- [
|
|
48
|
-
- [Media
|
|
49
|
-
- [Media
|
|
50
|
-
- [
|
|
51
|
-
- [
|
|
52
|
-
- [
|
|
53
|
-
- [
|
|
54
|
-
- [
|
|
55
|
-
- [
|
|
56
|
-
- [π
|
|
57
|
-
- [
|
|
58
|
-
- [
|
|
59
|
-
- [
|
|
60
|
-
- [
|
|
61
|
-
- [π§ Fix LID/JID
|
|
62
|
-
- [Best Practices
|
|
63
|
-
- [
|
|
64
|
-
- [
|
|
65
|
-
- [π
|
|
66
|
-
- [π‘οΈ
|
|
67
|
-
- [π Logging
|
|
68
|
-
- [π§
|
|
69
|
-
- [π§©
|
|
70
|
-
- [βοΈ
|
|
71
|
-
- [π§
|
|
72
|
-
- [π‘οΈ
|
|
73
|
-
- [π
|
|
74
|
-
- [π
|
|
75
|
-
- [π
|
|
76
|
-
- [β οΈ Disclaimer \&
|
|
77
|
-
- [π
|
|
78
|
-
- [π
|
|
28
|
+
## Table of Contents
|
|
29
|
+
|
|
30
|
+
- [Table of Contents](#table-of-contents)
|
|
31
|
+
- [β¨ Main Features](#-main-features)
|
|
32
|
+
- [π Quick Guide](#-quick-guide)
|
|
33
|
+
- [Basic Example - Starting Bot](#basic-example---starting-bot)
|
|
34
|
+
- [Anti-Ban Example - Recommended Configuration to Avoid Bans](#anti-ban-example---recommended-configuration-to-avoid-bans)
|
|
35
|
+
- [π Advanced Cache Management](#-advanced-cache-management)
|
|
36
|
+
- [Advanced Cache Configuration](#advanced-cache-configuration)
|
|
37
|
+
- [π Troubleshooting](#-troubleshooting)
|
|
38
|
+
- [Connection Issues](#connection-issues)
|
|
39
|
+
- [Memory Management](#memory-management)
|
|
40
|
+
- [Advanced Logging](#advanced-logging)
|
|
41
|
+
- [Basic Message Management with LID/JID](#basic-message-management-with-lidjid)
|
|
42
|
+
- [π API Documentation](#-api-documentation)
|
|
43
|
+
- [ποΈ Fundamental Methods](#οΈ-fundamental-methods)
|
|
44
|
+
- [π― Main Events](#-main-events)
|
|
45
|
+
- [πͺ Messages and Interactive Features](#-messages-and-interactive-features)
|
|
46
|
+
- [Basic Messages](#basic-messages)
|
|
47
|
+
- [Text with Formatting](#text-with-formatting)
|
|
48
|
+
- [Basic Media](#basic-media)
|
|
49
|
+
- [Advanced Media](#advanced-media)
|
|
50
|
+
- [Interactive Messages](#interactive-messages)
|
|
51
|
+
- [Messages with Simple Buttons](#messages-with-simple-buttons)
|
|
52
|
+
- [Messages with Buttons and Image](#messages-with-buttons-and-image)
|
|
53
|
+
- [List Messages](#list-messages)
|
|
54
|
+
- [Other Messages](#other-messages)
|
|
55
|
+
- [Response Management](#response-management)
|
|
56
|
+
- [π Group Features](#-group-features)
|
|
57
|
+
- [Basic Group Management](#basic-group-management)
|
|
58
|
+
- [Participant Management](#participant-management)
|
|
59
|
+
- [Group Settings](#group-settings)
|
|
60
|
+
- [Advanced Group Messages](#advanced-group-messages)
|
|
61
|
+
- [π§ Fix LID/JID in Your Own Main and Handler](#-fix-lidjid-in-your-own-main-and-handler)
|
|
62
|
+
- [Best Practices for LID/JID](#best-practices-for-lidjid)
|
|
63
|
+
- [Integrated Example in Main](#integrated-example-in-main)
|
|
64
|
+
- [Custom Handler Example](#custom-handler-example)
|
|
65
|
+
- [π Smart LID/JID Cache](#-smart-lidjid-cache)
|
|
66
|
+
- [π‘οΈ Advanced JID Validation](#οΈ-advanced-jid-validation)
|
|
67
|
+
- [π Conditional Logging](#-conditional-logging)
|
|
68
|
+
- [π§ Performance Configuration](#-performance-configuration)
|
|
69
|
+
- [π§© Events: LID and JID always available (new)](#-events-lid-and-jid-always-available-new)
|
|
70
|
+
- [βοΈ Advanced Configuration](#οΈ-advanced-configuration)
|
|
71
|
+
- [π§ Complete Options for makeWASocket](#-complete-options-for-makewasocket)
|
|
72
|
+
- [π‘οΈ Security and Encryption](#οΈ-security-and-encryption)
|
|
73
|
+
- [π Support and Community](#-support-and-community)
|
|
74
|
+
- [π Contacts and Resources](#-contacts-and-resources)
|
|
75
|
+
- [π Acknowledgments](#-acknowledgments)
|
|
76
|
+
- [β οΈ Disclaimer \& License](#οΈ-disclaimer--license)
|
|
77
|
+
- [π Legal Note](#-legal-note)
|
|
78
|
+
- [π MIT License](#-mit-license)
|
|
79
79
|
|
|
80
80
|
----
|
|
81
81
|
|
|
82
|
-
## β¨
|
|
82
|
+
## β¨ Main Features
|
|
83
83
|
|
|
84
84
|
<p align="center">
|
|
85
|
-
<img src="https://readme-typing-svg.herokuapp.com?font=Fira+Code&weight=600&size=18&duration=2500&pause=2500&color=8A2BE2¢er=true&vCenter=true&width=600&lines=π+
|
|
85
|
+
<img src="https://readme-typing-svg.herokuapp.com?font=Fira+Code&weight=600&size=18&duration=2500&pause=2500&color=8A2BE2¢er=true&vCenter=true&width=600&lines=π+Powerful+and+Intuitive;π§+Based+on+Baileys+with+Improvements" alt="Features">
|
|
86
86
|
</div>
|
|
87
87
|
|
|
88
88
|
<br>
|
|
89
89
|
|
|
90
|
-
|
|
90
|
+
This library, based on Baileys with specific improvements, offers an intuitive API to interact with WhatsApp Web. Here is a summary of the key features:
|
|
91
91
|
|
|
92
92
|
<table align="center">
|
|
93
93
|
<tr>
|
|
94
94
|
<td align="center" width="25%">
|
|
95
95
|
<h3>π Core Features</h3>
|
|
96
|
-
<p>β’
|
|
96
|
+
<p>β’ Intelligent LID/JID mapping<br>β’ Multi-device support<br>β’ E2E Signal encryption<br>β’ Modern TypeScript</p>
|
|
97
97
|
</td>
|
|
98
98
|
<td align="center" width="25%">
|
|
99
|
-
<h3>π¬
|
|
100
|
-
<p>β’
|
|
99
|
+
<h3>π¬ Messages</h3>
|
|
100
|
+
<p>β’ Text, media, interactive<br>β’ Buttons, lists, albums<br>β’ Polls, reactions<br>β’ Advanced templates</p>
|
|
101
101
|
</td>
|
|
102
102
|
<td align="center" width="25%">
|
|
103
103
|
<h3>π οΈ Developer</h3>
|
|
104
|
-
<p>β’
|
|
104
|
+
<p>β’ Real-time events<br>β’ Full TypeScript<br>β’ Extensive documentation<br>β’ Extensible APIs</p>
|
|
105
105
|
</td>
|
|
106
106
|
<td align="center" width="25%">
|
|
107
107
|
<h3>β‘ Performance</h3>
|
|
108
|
-
<p>β’
|
|
108
|
+
<p>β’ Intelligent reconnection<br>β’ Advanced TTL cache<br>β’ Performance monitoring</p>
|
|
109
109
|
</td>
|
|
110
110
|
</tr>
|
|
111
111
|
</table>
|
|
@@ -113,16 +113,16 @@ Questa libreria, basata su Baileys con miglioramenti specifici, offre un'API int
|
|
|
113
113
|
<img src="https://64.media.tumblr.com/13bc9e3c3b332dfc008cb4b9e8571558/2a577b39b15547dc-cc/s400x600/3db051b3117b695a61ad8e0b686f2774b971d210.gifv" width="800">
|
|
114
114
|
|
|
115
115
|
|
|
116
|
-
## π
|
|
116
|
+
## π Quick Guide
|
|
117
117
|
|
|
118
|
-
-
|
|
118
|
+
- This section includes basic examples for authentication and connection management.
|
|
119
119
|
|
|
120
|
-
###
|
|
120
|
+
### Basic Example - Starting Bot
|
|
121
121
|
|
|
122
122
|
```typescript
|
|
123
123
|
import makeWASocket, { DisconnectReason, useMultiFileAuthState, getPerformanceConfig, setPerformanceConfig } from '@realvare/based';
|
|
124
124
|
|
|
125
|
-
//
|
|
125
|
+
// Configure performance and cache
|
|
126
126
|
setPerformanceConfig({
|
|
127
127
|
performance: {
|
|
128
128
|
enableCache: true,
|
|
@@ -135,10 +135,10 @@ setPerformanceConfig({
|
|
|
135
135
|
});
|
|
136
136
|
|
|
137
137
|
async function startBot() {
|
|
138
|
-
// π
|
|
138
|
+
// π Multi-file authentication setup for persistent sessions
|
|
139
139
|
const { state, saveCreds } = await useMultiFileAuthState('auth_info_baileys');
|
|
140
140
|
|
|
141
|
-
// π
|
|
141
|
+
// π Socket creation with basic configuration
|
|
142
142
|
const sock = makeWASocket({
|
|
143
143
|
auth: state,
|
|
144
144
|
printQRInTerminal: true,
|
|
@@ -146,7 +146,7 @@ async function startBot() {
|
|
|
146
146
|
browser: ['VareBot', 'Chrome', '4.0.0'],
|
|
147
147
|
});
|
|
148
148
|
|
|
149
|
-
//
|
|
149
|
+
// Improved reconnection system
|
|
150
150
|
let reconnectAttempts = 0;
|
|
151
151
|
const config = getPerformanceConfig();
|
|
152
152
|
|
|
@@ -166,16 +166,16 @@ async function startBot() {
|
|
|
166
166
|
config.performance.maxRetryDelay
|
|
167
167
|
);
|
|
168
168
|
|
|
169
|
-
console.log(`π
|
|
169
|
+
console.log(`π Reconnection attempt ${reconnectAttempts}/${config.performance.maxRetries} in ${delay}ms`);
|
|
170
170
|
|
|
171
171
|
if (reconnectAttempts <= config.performance.maxRetries) {
|
|
172
172
|
setTimeout(startBot, delay);
|
|
173
173
|
} else {
|
|
174
|
-
console.log('β
|
|
174
|
+
console.log('β Maximum number of reconnection attempts reached');
|
|
175
175
|
}
|
|
176
176
|
}
|
|
177
177
|
} else if (connection === 'open') {
|
|
178
|
-
console.log('π’
|
|
178
|
+
console.log('π’ Connected successfully!');
|
|
179
179
|
reconnectAttempts = 0;
|
|
180
180
|
}
|
|
181
181
|
});
|
|
@@ -184,22 +184,22 @@ async function startBot() {
|
|
|
184
184
|
}startBot().catch(console.error);
|
|
185
185
|
```
|
|
186
186
|
|
|
187
|
-
###
|
|
187
|
+
### Anti-Ban Example - Recommended Configuration to Avoid Bans
|
|
188
188
|
|
|
189
189
|
```typescript
|
|
190
190
|
import makeWASocket, { DisconnectReason, useMultiFileAuthState, getPerformanceConfig, setPerformanceConfig, getSenderLid, validateJid } from '@realvare/based';
|
|
191
191
|
|
|
192
|
-
//
|
|
192
|
+
// Anti-ban configuration to reduce ban risks from improper acks
|
|
193
193
|
setPerformanceConfig({
|
|
194
194
|
performance: {
|
|
195
|
-
enableCache: true, //
|
|
196
|
-
enableMetrics: true, //
|
|
197
|
-
batchSize: 50, //
|
|
198
|
-
maxRetries: 5, //
|
|
199
|
-
retryDelay: 5000, //
|
|
200
|
-
retryBackoffMultiplier: 1.5,//
|
|
201
|
-
maxRetryDelay: 60000, //
|
|
202
|
-
maxMsgRetryCount: 3 //
|
|
195
|
+
enableCache: true, // Enable TTL cache to reduce API calls
|
|
196
|
+
enableMetrics: true, // Monitor performance to avoid overload
|
|
197
|
+
batchSize: 50, // Process messages in smaller batches to simulate human speed
|
|
198
|
+
maxRetries: 5, // Limit retry attempts to avoid aggressive behavior
|
|
199
|
+
retryDelay: 5000, // Base delay in ms for reconnections
|
|
200
|
+
retryBackoffMultiplier: 1.5,// Exponential backoff to space retries
|
|
201
|
+
maxRetryDelay: 60000, // Maximum delay to avoid rapid reconnections
|
|
202
|
+
maxMsgRetryCount: 3 // Limit message resend attempts
|
|
203
203
|
}
|
|
204
204
|
});
|
|
205
205
|
|
|
@@ -210,9 +210,9 @@ async function startBot() {
|
|
|
210
210
|
auth: state,
|
|
211
211
|
printQRInTerminal: true,
|
|
212
212
|
logger: console,
|
|
213
|
-
browser: ['YourBotName', 'Chrome', '4.0.0'], //
|
|
214
|
-
markOnlineOnConnect: false, //
|
|
215
|
-
syncFullHistory: false //
|
|
213
|
+
browser: ['YourBotName', 'Chrome', '4.0.0'], // Customize browser fingerprint
|
|
214
|
+
markOnlineOnConnect: false, // Crucial: Prevents always appearing online, reduces ban risk
|
|
215
|
+
syncFullHistory: false // Avoid syncing unnecessary data that could signal activity
|
|
216
216
|
});
|
|
217
217
|
|
|
218
218
|
let reconnectAttempts = 0;
|
|
@@ -248,23 +248,23 @@ async function startBot() {
|
|
|
248
248
|
}
|
|
249
249
|
});
|
|
250
250
|
|
|
251
|
-
//
|
|
251
|
+
// Monitor acks through message updates to ensure proper handling
|
|
252
252
|
sock.ev.on('messages.update', (updates) => {
|
|
253
253
|
for (const update of updates) {
|
|
254
254
|
if (update.update.status) {
|
|
255
|
-
console.log(`Message ${update.key.id} status: ${update.update.status}`); //
|
|
256
|
-
//
|
|
255
|
+
console.log(`Message ${update.key.id} status: ${update.update.status}`); // Track acks (1=sent, 2=delivered, 3=read)
|
|
256
|
+
// Add custom logic if necessary, but avoid overriding defaults to prevent detection
|
|
257
257
|
}
|
|
258
258
|
}
|
|
259
259
|
});
|
|
260
260
|
|
|
261
|
-
//
|
|
261
|
+
// Advanced LID/JID utilities for ack stability
|
|
262
262
|
sock.ev.on('messages.upsert', ({ messages }) => {
|
|
263
263
|
for (const msg of messages) {
|
|
264
264
|
const info = getSenderLid(msg);
|
|
265
265
|
const validation = validateJid(info.jid);
|
|
266
266
|
if (validation.isValid) {
|
|
267
|
-
//
|
|
267
|
+
// Process and ack safely
|
|
268
268
|
console.log(`Valid JID: ${info.jid}, LID: ${info.lid}`);
|
|
269
269
|
} else {
|
|
270
270
|
console.warn(`Invalid JID detected: ${info.jid}`);
|
|
@@ -278,58 +278,58 @@ async function startBot() {
|
|
|
278
278
|
startBot().catch(console.error);
|
|
279
279
|
```
|
|
280
280
|
|
|
281
|
-
## π
|
|
281
|
+
## π Advanced Cache Management
|
|
282
282
|
|
|
283
|
-
|
|
283
|
+
The library now includes an advanced cache system with automatic memory management and configurable TTL:
|
|
284
284
|
|
|
285
285
|
```typescript
|
|
286
286
|
import { CacheManager } from 'based/lib/Utils/cache-manager';
|
|
287
287
|
|
|
288
|
-
//
|
|
288
|
+
// Example of using the cache
|
|
289
289
|
const cache = CacheManager;
|
|
290
290
|
|
|
291
|
-
//
|
|
292
|
-
cache.set('lidCache', '
|
|
291
|
+
// Save a value in the cache
|
|
292
|
+
cache.set('lidCache', 'key', 'value', 300); // TTL of 300 seconds
|
|
293
293
|
|
|
294
|
-
//
|
|
295
|
-
const
|
|
294
|
+
// Retrieve a value
|
|
295
|
+
const value = cache.get('lidCache', 'key');
|
|
296
296
|
|
|
297
|
-
//
|
|
297
|
+
// Get cache statistics
|
|
298
298
|
const stats = cache.getStats('lidCache');
|
|
299
|
-
console.log('
|
|
299
|
+
console.log('Cache statistics:', stats);
|
|
300
300
|
```
|
|
301
301
|
|
|
302
|
-
###
|
|
302
|
+
### Advanced Cache Configuration
|
|
303
303
|
|
|
304
|
-
|
|
304
|
+
The cache can be configured with various options to optimize performance:
|
|
305
305
|
|
|
306
306
|
```typescript
|
|
307
307
|
setPerformanceConfig({
|
|
308
308
|
cache: {
|
|
309
309
|
lidCache: {
|
|
310
|
-
ttl: 5 * 60 * 1000, //
|
|
311
|
-
maxSize: 10000, //
|
|
312
|
-
cleanupInterval: 2 * 60 * 1000 //
|
|
310
|
+
ttl: 5 * 60 * 1000, // Entry lifetime
|
|
311
|
+
maxSize: 10000, // Maximum number of entries
|
|
312
|
+
cleanupInterval: 2 * 60 * 1000 // Cleanup interval
|
|
313
313
|
}
|
|
314
314
|
},
|
|
315
315
|
performance: {
|
|
316
|
-
memoryThreshold: 0.85 //
|
|
316
|
+
memoryThreshold: 0.85 // Threshold for automatic cleanup
|
|
317
317
|
}
|
|
318
318
|
});
|
|
319
319
|
```
|
|
320
|
-
## π
|
|
320
|
+
## π Troubleshooting
|
|
321
321
|
|
|
322
|
-
###
|
|
323
|
-
-
|
|
324
|
-
-
|
|
325
|
-
-
|
|
322
|
+
### Connection Issues
|
|
323
|
+
- The library now implements a retry system with exponential backoff
|
|
324
|
+
- Automatic monitoring of connection status
|
|
325
|
+
- Configurable reconnection attempts
|
|
326
326
|
|
|
327
|
-
###
|
|
328
|
-
-
|
|
329
|
-
-
|
|
330
|
-
- TTL
|
|
327
|
+
### Memory Management
|
|
328
|
+
- Automatic monitoring of memory usage
|
|
329
|
+
- Automatic cache cleanup when necessary
|
|
330
|
+
- Configurable TTL for each cache type
|
|
331
331
|
|
|
332
|
-
### Logging
|
|
332
|
+
### Advanced Logging
|
|
333
333
|
```typescript
|
|
334
334
|
setPerformanceConfig({
|
|
335
335
|
debug: {
|
|
@@ -340,37 +340,37 @@ setPerformanceConfig({
|
|
|
340
340
|
});
|
|
341
341
|
```
|
|
342
342
|
|
|
343
|
-
###
|
|
343
|
+
### Basic Message Management with LID/JID
|
|
344
344
|
|
|
345
345
|
```typescript
|
|
346
346
|
import makeWASocket, { getSenderLid, toJid, getCacheStats, validateJid, Logger } from '@realvare/based';
|
|
347
347
|
|
|
348
|
-
// ... (
|
|
348
|
+
// ... (sock creation code here)
|
|
349
349
|
|
|
350
350
|
conn.ev.on('messages.upsert', ({ messages }) => {
|
|
351
351
|
for (const msg of messages) {
|
|
352
|
-
// π
|
|
352
|
+
// π Extract sender LID with validation
|
|
353
353
|
const info = getSenderLid(msg);
|
|
354
354
|
|
|
355
|
-
// β
|
|
355
|
+
// β
Validate JID before using it
|
|
356
356
|
const validation = validateJid(info.jid);
|
|
357
357
|
if (!validation.isValid) {
|
|
358
|
-
Logger.error('JID
|
|
358
|
+
Logger.error('Invalid JID:', validation.error);
|
|
359
359
|
continue;
|
|
360
360
|
}
|
|
361
361
|
|
|
362
|
-
const jid = toJid(info.lid); //
|
|
362
|
+
const jid = toJid(info.lid); // Normalize to JID
|
|
363
363
|
|
|
364
|
-
Logger.info('π¬
|
|
365
|
-
console.log('π
|
|
364
|
+
Logger.info('π¬ Message from:', jid, 'Valid:', info.isValid);
|
|
365
|
+
console.log('π Content:', msg.message?.conversation);
|
|
366
366
|
|
|
367
|
-
//
|
|
367
|
+
// Automatically reply only if valid
|
|
368
368
|
if (info.isValid) {
|
|
369
|
-
conn.sendMessage(jid, { text: '
|
|
369
|
+
conn.sendMessage(jid, { text: 'Message received!' });
|
|
370
370
|
}
|
|
371
371
|
}
|
|
372
372
|
|
|
373
|
-
// π
|
|
373
|
+
// π Monitor cache performance
|
|
374
374
|
const stats = getCacheStats();
|
|
375
375
|
Logger.performance('Cache stats:', stats);
|
|
376
376
|
});
|
|
@@ -378,64 +378,64 @@ conn.ev.on('messages.upsert', ({ messages }) => {
|
|
|
378
378
|
|
|
379
379
|
---
|
|
380
380
|
|
|
381
|
-
## π
|
|
381
|
+
## π API Documentation
|
|
382
382
|
|
|
383
|
-
|
|
383
|
+
This section expands on the main methods, with detailed examples and parameters. All methods are typed in TypeScript for a safe development experience.
|
|
384
384
|
|
|
385
|
-
### ποΈ
|
|
385
|
+
### ποΈ Fundamental Methods
|
|
386
386
|
|
|
387
|
-
|
|
|
387
|
+
| Method | Description | Import |
|
|
388
388
|
|--------|-------------|--------|
|
|
389
|
-
| `makeWASocket(config)` | **Core**:
|
|
390
|
-
| `useMultiFileAuthState(folder)` | **Auth**:
|
|
391
|
-
| `getSenderLid(msg)` | **LID**:
|
|
392
|
-
| `toJid(lid)` | **JID**:
|
|
393
|
-
| `validateJid(jid)` | **
|
|
394
|
-
| `getCacheStats()` | **Performance**:
|
|
395
|
-
| `clearCache()` | **
|
|
396
|
-
| `setPerformanceConfig(config)` | **Config**:
|
|
389
|
+
| `makeWASocket(config)` | **Core**: Creates WhatsApp socket | β
Included |
|
|
390
|
+
| `useMultiFileAuthState(folder)` | **Auth**: Persistent credentials management | β
Included |
|
|
391
|
+
| `getSenderLid(msg)` | **LID**: Extracts LID from message | β
Included |
|
|
392
|
+
| `toJid(lid)` | **JID**: Converts LID β JID | β
Included |
|
|
393
|
+
| `validateJid(jid)` | **Validation**: Verifies JID | β
Included |
|
|
394
|
+
| `getCacheStats()` | **Performance**: Cache statistics | β
Included |
|
|
395
|
+
| `clearCache()` | **Cleanup**: Clears cache | β
Included |
|
|
396
|
+
| `setPerformanceConfig(config)` | **Config**: Customizes performance | β
Included |
|
|
397
397
|
|
|
398
|
-
**π₯
|
|
398
|
+
**π₯ Note**: All the above methods are **ready to use** and shown in the Quick Guide. Go directly to the advanced sections for specific features!
|
|
399
399
|
|
|
400
400
|
---
|
|
401
401
|
|
|
402
|
-
### π―
|
|
402
|
+
### π― Main Events
|
|
403
403
|
|
|
404
|
-
|
|
|
404
|
+
| Event | Description | Callback Signature |
|
|
405
405
|
|---------------------|--------------------------------------|-------------------------------------|
|
|
406
|
-
| `connection.update` |
|
|
407
|
-
| `creds.update` |
|
|
408
|
-
| `messages.upsert` |
|
|
409
|
-
| `messages.update` |
|
|
410
|
-
| `group-participants.update` |
|
|
406
|
+
| `connection.update` | Connection status updates | `(update: Partial<ConnectionState>) => void` |
|
|
407
|
+
| `creds.update` | Credentials update | `() => void` |
|
|
408
|
+
| `messages.upsert` | New messages or updates | `({ messages: WAMessage[], type: MessageUpsertType }) => void` |
|
|
409
|
+
| `messages.update` | Changes to existing messages | `(update: WAMessageUpdate[]) => void` |
|
|
410
|
+
| `group-participants.update` | Group participant changes | `(update: GroupParticipantEvent) => void` |
|
|
411
411
|
|
|
412
|
-
**
|
|
412
|
+
**Event Registration Example:**
|
|
413
413
|
```typescript
|
|
414
414
|
conn.ev.on('group-participants.update', (update) => {
|
|
415
|
-
console.log('
|
|
415
|
+
console.log('Participant updated:', update);
|
|
416
416
|
});
|
|
417
417
|
```
|
|
418
418
|
|
|
419
419
|
---
|
|
420
420
|
|
|
421
|
-
## πͺ
|
|
421
|
+
## πͺ Messages and Interactive Features
|
|
422
422
|
|
|
423
|
-
###
|
|
423
|
+
### Basic Messages
|
|
424
424
|
|
|
425
|
-
####
|
|
425
|
+
#### Text with Formatting
|
|
426
426
|
```typescript
|
|
427
|
-
//
|
|
427
|
+
// Text with formatting and mentions
|
|
428
428
|
await conn.sendMessage(jid, {
|
|
429
|
-
text: `*Bold* _italic_ ~strikethrough~ \`monospace\`\n@
|
|
429
|
+
text: `*Bold* _italic_ ~strikethrough~ \`monospace\`\n@mention`,
|
|
430
430
|
mentions: ['393476686131@s.whatsapp.net']
|
|
431
431
|
});
|
|
432
432
|
```
|
|
433
433
|
|
|
434
|
-
#### Media
|
|
434
|
+
#### Basic Media
|
|
435
435
|
```typescript
|
|
436
|
-
//
|
|
436
|
+
// Image
|
|
437
437
|
await conn.sendMessage(jid, {
|
|
438
|
-
image: { url: './media/varebot.jpg' }, //
|
|
438
|
+
image: { url: './media/varebot.jpg' }, // Also supports Buffer
|
|
439
439
|
caption: 'zwag'
|
|
440
440
|
});
|
|
441
441
|
|
|
@@ -443,27 +443,27 @@ await conn.sendMessage(jid, {
|
|
|
443
443
|
await conn.sendMessage(jid, {
|
|
444
444
|
video: { url: './media/oppastoppa.mp4' },
|
|
445
445
|
caption: 'brrrr',
|
|
446
|
-
gifPlayback: false // true
|
|
446
|
+
gifPlayback: false // true to play as GIF
|
|
447
447
|
});
|
|
448
448
|
|
|
449
449
|
// Audio
|
|
450
450
|
await conn.sendMessage(jid, {
|
|
451
451
|
audio: { url: './media/audio.mp3' },
|
|
452
452
|
mimetype: 'audio/mp4',
|
|
453
|
-
ptt: true // true
|
|
453
|
+
ptt: true // true for voice message, false for normal audio
|
|
454
454
|
});
|
|
455
455
|
|
|
456
|
-
//
|
|
456
|
+
// Document
|
|
457
457
|
await conn.sendMessage(jid, {
|
|
458
458
|
document: { url: './media/doc.pdf' },
|
|
459
459
|
mimetype: 'application/pdf',
|
|
460
|
-
fileName: '
|
|
460
|
+
fileName: 'document.pdf'
|
|
461
461
|
});
|
|
462
462
|
```
|
|
463
463
|
|
|
464
|
-
#### Media
|
|
464
|
+
#### Advanced Media
|
|
465
465
|
```typescript
|
|
466
|
-
// Album (Multiple
|
|
466
|
+
// Album (Multiple images)
|
|
467
467
|
await conn.sendMessage(jid, {
|
|
468
468
|
album: imageBuffers.map(buffer => ({ image: buffer })),
|
|
469
469
|
caption: 'ts gettin real'
|
|
@@ -474,7 +474,7 @@ await conn.sendMessage(jid, {
|
|
|
474
474
|
sticker: { url: './stickers/sticker.webp' }
|
|
475
475
|
});
|
|
476
476
|
|
|
477
|
-
//
|
|
477
|
+
// Location message
|
|
478
478
|
await conn.sendMessage(jid, {
|
|
479
479
|
location: {
|
|
480
480
|
degreesLatitude: 45.4642,
|
|
@@ -485,68 +485,68 @@ await conn.sendMessage(jid, {
|
|
|
485
485
|
});
|
|
486
486
|
```
|
|
487
487
|
|
|
488
|
-
####
|
|
489
|
-
|
|
488
|
+
#### Interactive Messages
|
|
489
|
+
These messages include interactive elements like buttons, lists, and templates.
|
|
490
490
|
|
|
491
|
-
#####
|
|
492
|
-
|
|
491
|
+
##### Messages with Simple Buttons
|
|
492
|
+
Send quick reply buttons.
|
|
493
493
|
|
|
494
494
|
```typescript
|
|
495
495
|
await conn.sendMessage(jid, {
|
|
496
|
-
text: '
|
|
496
|
+
text: 'Choose an option:',
|
|
497
497
|
footer: 'Footer',
|
|
498
498
|
buttons: [
|
|
499
|
-
{ buttonId: 'cmd1', buttonText: { displayText: '
|
|
500
|
-
{ buttonId: 'cmd2', buttonText: { displayText: '
|
|
499
|
+
{ buttonId: 'cmd1', buttonText: { displayText: 'text1' }, type: 1 },
|
|
500
|
+
{ buttonId: 'cmd2', buttonText: { displayText: 'text2' }, type: 1 },
|
|
501
501
|
],
|
|
502
502
|
headerType: 1,
|
|
503
503
|
});
|
|
504
504
|
```
|
|
505
505
|
|
|
506
|
-
#####
|
|
507
|
-
|
|
506
|
+
##### Messages with Buttons and Image
|
|
507
|
+
Combine image with buttons.
|
|
508
508
|
|
|
509
509
|
```typescript
|
|
510
510
|
await conn.sendMessage(jid, {
|
|
511
511
|
image: { url: 'https://i.ibb.co/hJW7WwxV/varebot.jpg' },
|
|
512
|
-
caption: '
|
|
512
|
+
caption: 'Message with buttons and image',
|
|
513
513
|
footer: 'vare β§ bot',
|
|
514
514
|
buttons: [
|
|
515
|
-
{ buttonId: 'cmd', buttonText: { displayText: '
|
|
515
|
+
{ buttonId: 'cmd', buttonText: { displayText: 'text1' }, type: 1 },
|
|
516
516
|
],
|
|
517
517
|
});
|
|
518
518
|
```
|
|
519
519
|
|
|
520
|
-
#####
|
|
521
|
-
|
|
520
|
+
##### List Messages
|
|
521
|
+
Send a list of options (only in private).
|
|
522
522
|
|
|
523
523
|
```typescript
|
|
524
524
|
await conn.sendMessage(jid, {
|
|
525
|
-
text: '
|
|
525
|
+
text: 'This is a list!',
|
|
526
526
|
footer: 'purplepurplepurple!',
|
|
527
|
-
title: '
|
|
528
|
-
buttonText: '
|
|
527
|
+
title: 'List Title',
|
|
528
|
+
buttonText: 'View List',
|
|
529
529
|
sections: [
|
|
530
530
|
{
|
|
531
|
-
title: '
|
|
531
|
+
title: 'Section 1',
|
|
532
532
|
rows: [
|
|
533
|
-
{ title: '
|
|
534
|
-
{ title: '
|
|
533
|
+
{ title: 'Option 1', rowId: 'opt1',description: 'Descriptionx' },
|
|
534
|
+
{ title: 'Option 2', rowId: 'opt2', description: 'Descriptiony' }
|
|
535
535
|
]
|
|
536
536
|
},
|
|
537
537
|
],
|
|
538
538
|
});
|
|
539
539
|
```
|
|
540
540
|
|
|
541
|
-
####
|
|
541
|
+
#### Other Messages
|
|
542
542
|
```typescript
|
|
543
|
-
//
|
|
543
|
+
// Message with quote
|
|
544
544
|
await conn.sendMessage(jid, {
|
|
545
545
|
text: 'bang bang',
|
|
546
|
-
quoted: quotedMessage //
|
|
546
|
+
quoted: quotedMessage // The message to quote/reply/cite
|
|
547
547
|
});
|
|
548
548
|
|
|
549
|
-
//
|
|
549
|
+
// Contact Messages
|
|
550
550
|
await conn.sendMessage(jid, {
|
|
551
551
|
contacts: {
|
|
552
552
|
displayName: 'Sam aka vare',
|
|
@@ -554,23 +554,23 @@ await conn.sendMessage(jid, {
|
|
|
554
554
|
}
|
|
555
555
|
});
|
|
556
556
|
|
|
557
|
-
//
|
|
557
|
+
// Poll Messages (Survey)
|
|
558
558
|
await conn.sendMessage(jid, {
|
|
559
559
|
poll: {
|
|
560
|
-
name: 'Anime
|
|
560
|
+
name: 'Favorite Anime?',
|
|
561
561
|
values: ['Aot', 'Bleach', 'Death note'],
|
|
562
|
-
selectableCount: 1 //
|
|
562
|
+
selectableCount: 1 // how many choices possible
|
|
563
563
|
}
|
|
564
564
|
});
|
|
565
565
|
|
|
566
|
-
//
|
|
566
|
+
// Ephemeral Messages (Self-Destructing)
|
|
567
567
|
await conn.sendMessage(jid, {
|
|
568
|
-
text: "
|
|
568
|
+
text: "This message will self-destruct {hopefully like israel}"
|
|
569
569
|
}, {
|
|
570
570
|
ephemeralExpiration: 7 * 24 * 60 * 60
|
|
571
571
|
});
|
|
572
572
|
|
|
573
|
-
//
|
|
573
|
+
// Messages with View Once Response
|
|
574
574
|
await conn.sendMessage(
|
|
575
575
|
jid,
|
|
576
576
|
{
|
|
@@ -580,27 +580,27 @@ await conn.sendMessage(
|
|
|
580
580
|
}
|
|
581
581
|
)
|
|
582
582
|
|
|
583
|
-
//
|
|
583
|
+
// Status Messages
|
|
584
584
|
await conn.sendMessage('status@broadcast', {
|
|
585
585
|
text: 'god forgive em'
|
|
586
586
|
}, {
|
|
587
|
-
statusJidList:
|
|
587
|
+
statusJidList: contacts
|
|
588
588
|
});
|
|
589
589
|
|
|
590
|
-
//
|
|
590
|
+
// Send a status with media (visible only to selected contacts)
|
|
591
591
|
await conn.sendMessage('status@broadcast', {
|
|
592
592
|
image: { url: './media/menu/menu.jpg' },
|
|
593
593
|
caption: 'all i need in this life of sin is-',
|
|
594
594
|
}, {
|
|
595
|
-
statusJidList:
|
|
595
|
+
statusJidList: contacts
|
|
596
596
|
});
|
|
597
597
|
|
|
598
|
-
//
|
|
598
|
+
// Newsletter Messages
|
|
599
599
|
await conn.sendMessage('120363418582531215@newsletter', {
|
|
600
600
|
text: 'ay yo',
|
|
601
601
|
});
|
|
602
602
|
|
|
603
|
-
//
|
|
603
|
+
// Payment Messages
|
|
604
604
|
await conn.sendMessage(jid, {
|
|
605
605
|
requestPayment: {
|
|
606
606
|
currency: 'EUR',
|
|
@@ -610,7 +610,7 @@ await conn.sendMessage(jid, {
|
|
|
610
610
|
}
|
|
611
611
|
});
|
|
612
612
|
|
|
613
|
-
//
|
|
613
|
+
// Call Messages
|
|
614
614
|
await conn.sendMessage(jid, {
|
|
615
615
|
call: {
|
|
616
616
|
callKey: {
|
|
@@ -622,7 +622,7 @@ await conn.sendMessage(jid, {
|
|
|
622
622
|
}
|
|
623
623
|
});
|
|
624
624
|
|
|
625
|
-
//
|
|
625
|
+
// Live Location Messages
|
|
626
626
|
await conn.sendMessage(jid, {
|
|
627
627
|
liveLocation: {
|
|
628
628
|
degreesLatitude: 45.4642,
|
|
@@ -636,11 +636,11 @@ await conn.sendMessage(jid, {
|
|
|
636
636
|
}
|
|
637
637
|
});
|
|
638
638
|
|
|
639
|
-
//
|
|
639
|
+
// Order/Product Messages
|
|
640
640
|
await conn.sendMessage(jid, {
|
|
641
641
|
order: {
|
|
642
642
|
id: 'bysamakavare',
|
|
643
|
-
thumbnail: buffer, //
|
|
643
|
+
thumbnail: buffer, // image buffer
|
|
644
644
|
itemCount: 67,
|
|
645
645
|
surface: 'CATALOG',
|
|
646
646
|
title: 'heh',
|
|
@@ -651,12 +651,12 @@ await conn.sendMessage(jid, {
|
|
|
651
651
|
}
|
|
652
652
|
});
|
|
653
653
|
|
|
654
|
-
//
|
|
654
|
+
// Product
|
|
655
655
|
await conn.sendMessage(jid, {
|
|
656
656
|
product: {
|
|
657
657
|
productImage: { url: './media/menu/menu.jpg' },
|
|
658
658
|
productId: 'prod123',
|
|
659
|
-
title: '
|
|
659
|
+
title: 'title',
|
|
660
660
|
description: 'Desc',
|
|
661
661
|
currency: 'EUR',
|
|
662
662
|
priceAmount1000: 67000,
|
|
@@ -666,97 +666,97 @@ await conn.sendMessage(jid, {
|
|
|
666
666
|
businessOwnerJid: m.sender
|
|
667
667
|
});
|
|
668
668
|
|
|
669
|
-
//
|
|
669
|
+
// Messages with Custom Header
|
|
670
670
|
await conn.sendMessage(jid, {
|
|
671
671
|
text: 'dilemma',
|
|
672
672
|
contextInfo: {
|
|
673
673
|
externalAdReply: {
|
|
674
|
-
title: `
|
|
674
|
+
title: `title`,
|
|
675
675
|
body: `desc`,
|
|
676
|
-
thumbnailUrl: 'https://i.ibb.co/hJW7WwxV/sam.jpg', //
|
|
677
|
-
sourceUrl: '', //
|
|
676
|
+
thumbnailUrl: 'https://i.ibb.co/hJW7WwxV/sam.jpg', // image
|
|
677
|
+
sourceUrl: '', // not recommended to set
|
|
678
678
|
mediaType: 1,
|
|
679
679
|
renderLargerThumbnail: false
|
|
680
680
|
}
|
|
681
681
|
}
|
|
682
682
|
});
|
|
683
|
-
>
|
|
683
|
+
> note: do not use showAdAttribution or keep it false, because with it active the message is not displayed
|
|
684
684
|
```
|
|
685
685
|
|
|
686
|
-
###
|
|
686
|
+
### Response Management
|
|
687
687
|
|
|
688
|
-
|
|
688
|
+
To manage responses to interactive messages, use the `messages.upsert` listener and check the response type:
|
|
689
689
|
|
|
690
690
|
```typescript
|
|
691
691
|
conn.ev.on('messages.upsert', async ({ messages }) => {
|
|
692
692
|
const msg = messages[0];
|
|
693
693
|
|
|
694
|
-
//
|
|
694
|
+
// Button response
|
|
695
695
|
if (msg.message?.buttonsResponseMessage) {
|
|
696
696
|
const selectedId = msg.message.buttonsResponseMessage.selectedButtonId;
|
|
697
|
-
console.log(`
|
|
697
|
+
console.log(`Selected button: ${selectedId}`);
|
|
698
698
|
}
|
|
699
699
|
|
|
700
|
-
//
|
|
700
|
+
// List response
|
|
701
701
|
if (msg.message?.listResponseMessage) {
|
|
702
702
|
const selectedId = msg.message.listResponseMessage.singleSelectReply.selectedRowId;
|
|
703
|
-
console.log(`
|
|
703
|
+
console.log(`Selected option: ${selectedId}`);
|
|
704
704
|
}
|
|
705
705
|
|
|
706
|
-
//
|
|
706
|
+
// Poll response
|
|
707
707
|
if (msg.message?.pollResponseMessage) {
|
|
708
708
|
const selectedOptions = msg.message.pollResponseMessage.selectedOptions;
|
|
709
|
-
console.log('
|
|
709
|
+
console.log('Selected options:', selectedOptions);
|
|
710
710
|
}
|
|
711
711
|
});
|
|
712
712
|
```
|
|
713
713
|
|
|
714
|
-
### π
|
|
714
|
+
### π Group Features
|
|
715
715
|
|
|
716
|
-
####
|
|
716
|
+
#### Basic Group Management
|
|
717
717
|
|
|
718
718
|
```typescript
|
|
719
|
-
//
|
|
719
|
+
// Group creation - the jid is for adding participants
|
|
720
720
|
const group = await conn.groupCreate('Angels π©ΈποΈ', ['user@s.whatsapp.net']);
|
|
721
721
|
|
|
722
|
-
//
|
|
722
|
+
// Get group info
|
|
723
723
|
const metadata = await conn.groupMetadata(jid);
|
|
724
724
|
|
|
725
|
-
//
|
|
725
|
+
// Get invite code
|
|
726
726
|
const code = await conn.groupInviteCode(jid);
|
|
727
727
|
|
|
728
|
-
//
|
|
728
|
+
// Revoke invite link
|
|
729
729
|
await conn.groupRevokeInvite(jid);
|
|
730
730
|
|
|
731
|
-
//
|
|
731
|
+
// Leave group
|
|
732
732
|
await conn.groupLeave(jid);
|
|
733
733
|
```
|
|
734
734
|
|
|
735
|
-
####
|
|
735
|
+
#### Participant Management
|
|
736
736
|
|
|
737
737
|
```typescript
|
|
738
|
-
//
|
|
738
|
+
// Add participants
|
|
739
739
|
await conn.groupParticipantsUpdate(
|
|
740
740
|
jid,
|
|
741
741
|
['user@s.whatsapp.net'],
|
|
742
742
|
'add'
|
|
743
743
|
);
|
|
744
744
|
|
|
745
|
-
//
|
|
745
|
+
// Remove participants
|
|
746
746
|
await conn.groupParticipantsUpdate(
|
|
747
747
|
jid,
|
|
748
748
|
['user@s.whatsapp.net'],
|
|
749
749
|
'remove'
|
|
750
750
|
);
|
|
751
751
|
|
|
752
|
-
//
|
|
752
|
+
// Promote to admin
|
|
753
753
|
await conn.groupParticipantsUpdate(
|
|
754
754
|
jid,
|
|
755
755
|
['user@s.whatsapp.net'],
|
|
756
756
|
'promote'
|
|
757
757
|
);
|
|
758
758
|
|
|
759
|
-
//
|
|
759
|
+
// Demote from admin
|
|
760
760
|
await conn.groupParticipantsUpdate(
|
|
761
761
|
jid,
|
|
762
762
|
['user@s.whatsapp.net'],
|
|
@@ -764,76 +764,76 @@ await conn.groupParticipantsUpdate(
|
|
|
764
764
|
);
|
|
765
765
|
```
|
|
766
766
|
|
|
767
|
-
####
|
|
767
|
+
#### Group Settings
|
|
768
768
|
|
|
769
769
|
```typescript
|
|
770
|
-
//
|
|
771
|
-
await conn.groupUpdateSubject(jid, '
|
|
770
|
+
// Change group name
|
|
771
|
+
await conn.groupUpdateSubject(jid, 'New Name');
|
|
772
772
|
|
|
773
|
-
//
|
|
774
|
-
await conn.groupUpdateDescription(jid, '
|
|
773
|
+
// Change description
|
|
774
|
+
await conn.groupUpdateDescription(jid, 'New description');
|
|
775
775
|
|
|
776
|
-
//
|
|
776
|
+
// Change group photo
|
|
777
777
|
await conn.updateProfilePicture(jid, { url: './img/group.jpg' });
|
|
778
778
|
|
|
779
|
-
//
|
|
779
|
+
// Remove group photo
|
|
780
780
|
await conn.removeProfilePicture(jid);
|
|
781
781
|
|
|
782
|
-
//
|
|
782
|
+
// Set group as admin only
|
|
783
783
|
await conn.groupSettingUpdate(jid, 'announcement');
|
|
784
784
|
|
|
785
|
-
//
|
|
785
|
+
// Set group as open to all
|
|
786
786
|
await conn.groupSettingUpdate(jid, 'not_announcement');
|
|
787
787
|
|
|
788
|
-
//
|
|
788
|
+
// Set who can edit info - admin only
|
|
789
789
|
await conn.groupSettingUpdate(jid, 'locked');
|
|
790
790
|
|
|
791
|
-
//
|
|
791
|
+
// Set who can edit info - all
|
|
792
792
|
await conn.groupSettingUpdate(jid, 'unlocked');
|
|
793
793
|
|
|
794
|
-
//
|
|
794
|
+
// Set who can add members - admin only
|
|
795
795
|
await conn.groupMemberAddMode(jid, 'admin_add');
|
|
796
796
|
|
|
797
|
-
//
|
|
797
|
+
// Set who can add members - all
|
|
798
798
|
await conn.groupMemberAddMode(jid, 'all_member_add');
|
|
799
799
|
|
|
800
|
-
//
|
|
801
|
-
await conn.groupToggleEphemeral(jid, 86400); //
|
|
800
|
+
// Enable/disable temporary messages (24 hours)
|
|
801
|
+
await conn.groupToggleEphemeral(jid, 86400); // seconds
|
|
802
802
|
|
|
803
|
-
//
|
|
803
|
+
// Disable temporary messages
|
|
804
804
|
await conn.groupToggleEphemeral(jid, 0);
|
|
805
805
|
|
|
806
|
-
//
|
|
807
|
-
await conn.groupJoinApprovalMode(jid, 'on'); //
|
|
808
|
-
await conn.groupJoinApprovalMode(jid, 'off'); //
|
|
806
|
+
// Enable/disable membership approval mode
|
|
807
|
+
await conn.groupJoinApprovalMode(jid, 'on'); // requires approval
|
|
808
|
+
await conn.groupJoinApprovalMode(jid, 'off'); // open
|
|
809
809
|
|
|
810
|
-
//
|
|
810
|
+
// Get all groups
|
|
811
811
|
const groups = await conn.groupFetchAllParticipating();
|
|
812
812
|
|
|
813
|
-
//
|
|
813
|
+
// Get pending invites
|
|
814
814
|
const invites = await conn.groupGetInviteInfo(code);
|
|
815
815
|
|
|
816
|
-
//
|
|
816
|
+
// Accept group invite
|
|
817
817
|
await conn.groupAcceptInvite(code);
|
|
818
818
|
|
|
819
|
-
//
|
|
819
|
+
// Get group info from link
|
|
820
820
|
const groupInfo = await conn.groupGetInviteInfo('https://chat.whatsapp.com/ABC123');
|
|
821
821
|
|
|
822
|
-
//
|
|
822
|
+
// Listen to settings changes
|
|
823
823
|
conn.ev.on('group-settings.update', async ({ id, announce, restrict }) => {
|
|
824
824
|
if (announce !== undefined) {
|
|
825
|
-
await conn.sendMessage(id, { text: `
|
|
825
|
+
await conn.sendMessage(id, { text: `The group has been set to ${announce ? 'admin only' : 'all'}` });
|
|
826
826
|
}
|
|
827
827
|
if (restrict !== undefined) {
|
|
828
|
-
await conn.sendMessage(id, { text: `
|
|
828
|
+
await conn.sendMessage(id, { text: `Group info can be edited by ${restrict ? 'admin only' : 'all'}` });
|
|
829
829
|
}
|
|
830
830
|
});
|
|
831
831
|
```
|
|
832
832
|
|
|
833
|
-
####
|
|
833
|
+
#### Advanced Group Messages
|
|
834
834
|
|
|
835
835
|
```typescript
|
|
836
|
-
//
|
|
836
|
+
// Message with multiple mentions
|
|
837
837
|
await conn.sendMessage(jid, {
|
|
838
838
|
text: '@user1 @user2 @user3',
|
|
839
839
|
mentions: [user1, user2, user3],
|
|
@@ -842,7 +842,7 @@ await conn.sendMessage(jid, {
|
|
|
842
842
|
}
|
|
843
843
|
});
|
|
844
844
|
|
|
845
|
-
//
|
|
845
|
+
// Message with Google search
|
|
846
846
|
await conn.sendMessage(jid, {
|
|
847
847
|
text: 'ZWAG',
|
|
848
848
|
contextInfo: {
|
|
@@ -854,18 +854,18 @@ await conn.sendMessage(jid, {
|
|
|
854
854
|
|
|
855
855
|
---
|
|
856
856
|
|
|
857
|
-
## π§ Fix LID/JID
|
|
857
|
+
## π§ Fix LID/JID in Your Own Main and Handler
|
|
858
858
|
|
|
859
|
-
*
|
|
859
|
+
*The LID/JID support is a strength of this library, solving common problems like sender identification in groups and private chats. Here's how to integrate it into your main code and handler.*
|
|
860
860
|
|
|
861
|
-
### Best Practices
|
|
861
|
+
### Best Practices for LID/JID
|
|
862
862
|
|
|
863
|
-
- **decodeJid(jid)**:
|
|
864
|
-
-
|
|
865
|
-
-
|
|
866
|
-
-
|
|
863
|
+
- **decodeJid(jid)**: Main function to normalize JID/LID. Handles:
|
|
864
|
+
- Formats with `:\d+@` (uses `jidNormalizedUser`).
|
|
865
|
+
- Decodes user/server into `${user}@${server}`.
|
|
866
|
+
- Converts `@lid` to `@s.whatsapp.net`.
|
|
867
867
|
|
|
868
|
-
**
|
|
868
|
+
**Implementation Example (from main.js):**
|
|
869
869
|
```typescript
|
|
870
870
|
decodeJid: (jid) => {
|
|
871
871
|
if (!jid) return jid;
|
|
@@ -882,11 +882,11 @@ await conn.sendMessage(jid, {
|
|
|
882
882
|
return decoded;
|
|
883
883
|
},
|
|
884
884
|
```
|
|
885
|
-
|
|
885
|
+
Use `conn.decodeJid(jid)` everywhere to normalize IDs (e.g., sender, participant, quoted).
|
|
886
886
|
|
|
887
|
-
- **Monkey-Patch
|
|
887
|
+
- **Monkey-Patch for groupParticipantsUpdate**: Fixes group participant updates by finding the real JID from metadata.
|
|
888
888
|
|
|
889
|
-
**
|
|
889
|
+
**Example (from handler.js):**
|
|
890
890
|
```typescript
|
|
891
891
|
if (!this.originalGroupParticipantsUpdate) {
|
|
892
892
|
this.originalGroupParticipantsUpdate = this.groupParticipantsUpdate;
|
|
@@ -898,7 +898,7 @@ await conn.sendMessage(jid, {
|
|
|
898
898
|
if (metadata) global.groupCache.set(chatId, metadata);
|
|
899
899
|
}
|
|
900
900
|
if (!metadata) {
|
|
901
|
-
console.error('[
|
|
901
|
+
console.error('[ERROR] No group metadata available for safe update');
|
|
902
902
|
return this.originalGroupParticipantsUpdate.call(this, chatId, users, action);
|
|
903
903
|
}
|
|
904
904
|
|
|
@@ -910,25 +910,25 @@ await conn.sendMessage(jid, {
|
|
|
910
910
|
const pPhone = pId.split('@')[0].split(':')[0];
|
|
911
911
|
return pPhone === phone;
|
|
912
912
|
});
|
|
913
|
-
return participant ? participant.id : userJid; // Fallback
|
|
913
|
+
return participant ? participant.id : userJid; // Fallback to original if not found
|
|
914
914
|
});
|
|
915
915
|
|
|
916
916
|
return this.originalGroupParticipantsUpdate.call(this, chatId, correctedUsers, action);
|
|
917
917
|
} catch (e) {
|
|
918
|
-
console.error('[
|
|
918
|
+
console.error('[ERROR] Error in safeGroupParticipantsUpdate:', e);
|
|
919
919
|
throw e;
|
|
920
920
|
}
|
|
921
921
|
};
|
|
922
922
|
}
|
|
923
923
|
```
|
|
924
924
|
|
|
925
|
-
- **Cache
|
|
925
|
+
- **Cache for Group Metadata**: Use NodeCache to store metadata, normalizing with `decodeJid`.
|
|
926
926
|
|
|
927
|
-
**
|
|
927
|
+
**Example (from handler.js):**
|
|
928
928
|
```typescript
|
|
929
929
|
global.groupCache = new NodeCache({ stdTTL: 5 * 60, useClones: false });
|
|
930
930
|
|
|
931
|
-
// In participantsUpdate
|
|
931
|
+
// In participantsUpdate or groups.update:
|
|
932
932
|
metadata.participants.forEach(u => {
|
|
933
933
|
const normId = this.decodeJid(u.id);
|
|
934
934
|
const jid = u.jid || normId;
|
|
@@ -936,14 +936,14 @@ await conn.sendMessage(jid, {
|
|
|
936
936
|
global.groupCache.set(update.id, metadata);
|
|
937
937
|
```
|
|
938
938
|
|
|
939
|
-
- **
|
|
939
|
+
- **Normalization in Print/Log**: Remove `:xx` from phone numbers for clean display.
|
|
940
940
|
|
|
941
|
-
**
|
|
941
|
+
**Example (from print.js):**
|
|
942
942
|
```typescript
|
|
943
943
|
function formatPhoneNumber(jid, name) {
|
|
944
|
-
if (!jid) return '
|
|
944
|
+
if (!jid) return 'Unknown';
|
|
945
945
|
let userPart = jid.split('@')[0];
|
|
946
|
-
let cleanNumber = userPart.split(':')[0]; //
|
|
946
|
+
let cleanNumber = userPart.split(':')[0]; // Remove the :xx part to get the real number
|
|
947
947
|
try {
|
|
948
948
|
const number = PhoneNumber('+' + cleanNumber).getNumber('international');
|
|
949
949
|
return number + (name ? ` ~${name}` : '');
|
|
@@ -953,18 +953,18 @@ await conn.sendMessage(jid, {
|
|
|
953
953
|
}
|
|
954
954
|
```
|
|
955
955
|
|
|
956
|
-
- **
|
|
957
|
-
- **LID
|
|
958
|
-
- **
|
|
959
|
-
- **Multi-
|
|
960
|
-
- **
|
|
956
|
+
- **Common Problems and Fixes:**
|
|
957
|
+
- **Missing LID in Groups:** Use `decodeJid` and metadata cache to find real JIDs.
|
|
958
|
+
- **JID Conversion:** Always apply `decodeJid` before `sendMessage` or query.
|
|
959
|
+
- **Multi-Device:** Set `syncFullHistory: true` in config for LID sync.
|
|
960
|
+
- **Errors in Mention/Quoted:** Normalize with `decodeJid` in handler for quoted.sender and mentionedJid.
|
|
961
961
|
|
|
962
|
-
###
|
|
962
|
+
### Integrated Example in Main
|
|
963
963
|
|
|
964
964
|
```typescript
|
|
965
|
-
//
|
|
965
|
+
// In your main file
|
|
966
966
|
import makeWASocket, { getSenderLid, toJid } from '@realvare/based';
|
|
967
|
-
// ... (
|
|
967
|
+
// ... (authentication and sock creation)
|
|
968
968
|
|
|
969
969
|
conn.ev.on('messages.upsert', async ({ messages }) => {
|
|
970
970
|
const msg = messages[0];
|
|
@@ -973,14 +973,14 @@ conn.ev.on('messages.upsert', async ({ messages }) => {
|
|
|
973
973
|
const info = getSenderLid(msg);
|
|
974
974
|
const senderJid = toJid(info.lid); // Fix LID -> JID
|
|
975
975
|
|
|
976
|
-
//
|
|
976
|
+
// Example: Reply only if valid JID
|
|
977
977
|
if (senderJid.endsWith('@s.whatsapp.net')) {
|
|
978
|
-
await conn.sendMessage(senderJid, { text: `
|
|
978
|
+
await conn.sendMessage(senderJid, { text: `Hello from ${senderJid}!` }, { quoted: msg });
|
|
979
979
|
}
|
|
980
980
|
});
|
|
981
981
|
```
|
|
982
982
|
|
|
983
|
-
###
|
|
983
|
+
### Custom Handler Example
|
|
984
984
|
|
|
985
985
|
```typescript
|
|
986
986
|
// handler.js
|
|
@@ -988,44 +988,44 @@ export async function handleMessage(sock, msg) {
|
|
|
988
988
|
const info = getSenderLid(msg);
|
|
989
989
|
const jid = toJid(info.lid);
|
|
990
990
|
|
|
991
|
-
// Log
|
|
992
|
-
console.log(`
|
|
993
|
-
await conn.sendMessage(jid, { text: 'Handler
|
|
991
|
+
// Log and response
|
|
992
|
+
console.log(`Message from ${jid}`);
|
|
993
|
+
await conn.sendMessage(jid, { text: 'Handler activated!' });
|
|
994
994
|
}
|
|
995
995
|
|
|
996
|
-
//
|
|
996
|
+
// In main: conn.ev.on('messages.upsert', ({ messages }) => handleMessage(sock, messages[0]));
|
|
997
997
|
```
|
|
998
998
|
|
|
999
|
-
**
|
|
999
|
+
**Tip:** Test in groups to verify LID, as Baileys upstream has improved native support in 2025, but the custom fixes here ensure backward compatibility.
|
|
1000
1000
|
|
|
1001
1001
|
---
|
|
1002
1002
|
|
|
1003
|
-
### π
|
|
1003
|
+
### π Smart LID/JID Cache
|
|
1004
1004
|
|
|
1005
|
-
|
|
1005
|
+
The library now includes an advanced cache system to optimize LID/JID conversions:
|
|
1006
1006
|
|
|
1007
1007
|
```typescript
|
|
1008
1008
|
import { getCacheStats, clearCache, setPerformanceConfig } from '@realvare/based';
|
|
1009
1009
|
|
|
1010
|
-
//
|
|
1010
|
+
// Configure custom cache
|
|
1011
1011
|
setPerformanceConfig({
|
|
1012
1012
|
cache: {
|
|
1013
1013
|
lidCache: {
|
|
1014
|
-
ttl: 10 * 60 * 1000, // 10
|
|
1014
|
+
ttl: 10 * 60 * 1000, // 10 minutes
|
|
1015
1015
|
maxSize: 15000
|
|
1016
1016
|
}
|
|
1017
1017
|
}
|
|
1018
1018
|
});
|
|
1019
1019
|
|
|
1020
|
-
//
|
|
1020
|
+
// Monitor performance
|
|
1021
1021
|
const stats = getCacheStats();
|
|
1022
|
-
console.log('Cache
|
|
1022
|
+
console.log('LID Cache:', stats.lidCache.size, '/', stats.lidCache.maxSize);
|
|
1023
1023
|
|
|
1024
|
-
//
|
|
1024
|
+
// Clear cache if necessary
|
|
1025
1025
|
clearCache();
|
|
1026
1026
|
```
|
|
1027
1027
|
|
|
1028
|
-
### π‘οΈ
|
|
1028
|
+
### π‘οΈ Advanced JID Validation
|
|
1029
1029
|
|
|
1030
1030
|
```typescript
|
|
1031
1031
|
import { validateJid, Logger } from '@realvare/based';
|
|
@@ -1034,18 +1034,18 @@ const jid = '1234567890@s.whatsapp.net';
|
|
|
1034
1034
|
const validation = validateJid(jid);
|
|
1035
1035
|
|
|
1036
1036
|
if (validation.isValid) {
|
|
1037
|
-
Logger.info('JID
|
|
1037
|
+
Logger.info('Valid JID:', jid);
|
|
1038
1038
|
} else {
|
|
1039
|
-
Logger.error('JID
|
|
1039
|
+
Logger.error('Invalid JID:', validation.error);
|
|
1040
1040
|
}
|
|
1041
1041
|
```
|
|
1042
1042
|
|
|
1043
|
-
### π Logging
|
|
1043
|
+
### π Conditional Logging
|
|
1044
1044
|
|
|
1045
1045
|
```typescript
|
|
1046
1046
|
import { Logger, setPerformanceConfig } from '@realvare/based';
|
|
1047
1047
|
|
|
1048
|
-
//
|
|
1048
|
+
// Configure logging
|
|
1049
1049
|
setPerformanceConfig({
|
|
1050
1050
|
debug: {
|
|
1051
1051
|
enableLidLogging: true,
|
|
@@ -1054,18 +1054,18 @@ setPerformanceConfig({
|
|
|
1054
1054
|
}
|
|
1055
1055
|
});
|
|
1056
1056
|
|
|
1057
|
-
//
|
|
1057
|
+
// Use conditional logger
|
|
1058
1058
|
Logger.debug('Debug info');
|
|
1059
1059
|
Logger.performance('Performance metrics');
|
|
1060
1060
|
Logger.error('Error occurred');
|
|
1061
1061
|
```
|
|
1062
1062
|
|
|
1063
|
-
### π§
|
|
1063
|
+
### π§ Performance Configuration
|
|
1064
1064
|
|
|
1065
1065
|
```typescript
|
|
1066
1066
|
import { setPerformanceConfig, getPerformanceConfig } from '@realvare/based';
|
|
1067
1067
|
|
|
1068
|
-
//
|
|
1068
|
+
// Complete configuration
|
|
1069
1069
|
setPerformanceConfig({
|
|
1070
1070
|
performance: {
|
|
1071
1071
|
enableCache: true,
|
|
@@ -1083,122 +1083,122 @@ setPerformanceConfig({
|
|
|
1083
1083
|
}
|
|
1084
1084
|
});
|
|
1085
1085
|
|
|
1086
|
-
//
|
|
1086
|
+
// Get current configuration
|
|
1087
1087
|
const config = getPerformanceConfig();
|
|
1088
|
-
console.log('Cache
|
|
1088
|
+
console.log('Cache enabled:', config.performance.enableCache);
|
|
1089
1089
|
```
|
|
1090
1090
|
|
|
1091
1091
|
---
|
|
1092
1092
|
|
|
1093
|
-
## π§©
|
|
1093
|
+
## π§© Events: LID and JID always available (new)
|
|
1094
1094
|
|
|
1095
|
-
|
|
1095
|
+
The emitted events include auxiliary fields on messages to easily access both the sender/participant's JID and LID.
|
|
1096
1096
|
|
|
1097
1097
|
```typescript
|
|
1098
1098
|
conn.ev.on('messages.upsert', ({ messages, type }) => {
|
|
1099
1099
|
for (const msg of messages) {
|
|
1100
|
-
//
|
|
1101
|
-
// - remoteJidNormalized: JID
|
|
1102
|
-
// - remoteLid: LID
|
|
1103
|
-
// - participantLid: LID
|
|
1100
|
+
// Additional fields on msg.key
|
|
1101
|
+
// - remoteJidNormalized: Normalized JID (e.g., @s.whatsapp.net)
|
|
1102
|
+
// - remoteLid: LID equivalent of remoteJid
|
|
1103
|
+
// - participantLid: LID equivalent of participant (if present)
|
|
1104
1104
|
const jid = msg.key.remoteJidNormalized || msg.key.remoteJid;
|
|
1105
1105
|
const remoteLid = msg.key.remoteLid;
|
|
1106
1106
|
const participantLid = msg.key.participantLid;
|
|
1107
1107
|
|
|
1108
1108
|
if (jid?.endsWith('@s.whatsapp.net')) {
|
|
1109
|
-
conn.sendMessage(jid, { text: `
|
|
1109
|
+
conn.sendMessage(jid, { text: `Hello! LID: ${remoteLid || 'n/a'}` });
|
|
1110
1110
|
}
|
|
1111
1111
|
}
|
|
1112
1112
|
});
|
|
1113
1113
|
```
|
|
1114
1114
|
|
|
1115
|
-
|
|
1115
|
+
These fields eliminate ambiguity in groups and multi-device contexts where some events report LID, others JID.
|
|
1116
1116
|
|
|
1117
1117
|
---
|
|
1118
1118
|
|
|
1119
|
-
## βοΈ
|
|
1119
|
+
## βοΈ Advanced Configuration
|
|
1120
1120
|
|
|
1121
|
-
|
|
1121
|
+
Customize the socket for performance and behavior.
|
|
1122
1122
|
|
|
1123
|
-
### π§
|
|
1123
|
+
### π§ Complete Options for makeWASocket
|
|
1124
1124
|
|
|
1125
1125
|
```typescript
|
|
1126
1126
|
const sock = makeWASocket({
|
|
1127
|
-
// π
|
|
1127
|
+
// π Authentication
|
|
1128
1128
|
auth: state,
|
|
1129
1129
|
|
|
1130
|
-
// π₯οΈ UI
|
|
1130
|
+
// π₯οΈ UI and Debug
|
|
1131
1131
|
printQRInTerminal: true,
|
|
1132
1132
|
logger: console,
|
|
1133
1133
|
browser: ['VareBot', 'Chrome', '4.0.0'],
|
|
1134
1134
|
|
|
1135
|
-
// β±οΈ Timeout
|
|
1135
|
+
// β±οΈ Timeout and Connection
|
|
1136
1136
|
defaultQueryTimeoutMs: 60000,
|
|
1137
1137
|
keepAliveIntervalMs: 30000,
|
|
1138
1138
|
connectTimeoutMs: 60000,
|
|
1139
1139
|
retryRequestDelayMs: 250,
|
|
1140
1140
|
maxMsgRetryCount: 5,
|
|
1141
1141
|
|
|
1142
|
-
// ποΈ
|
|
1142
|
+
// ποΈ Behavior
|
|
1143
1143
|
markOnlineOnConnect: true,
|
|
1144
|
-
syncFullHistory: false, //
|
|
1144
|
+
syncFullHistory: false, // Enable for full sync (consumes data)
|
|
1145
1145
|
fireInitQueries: true,
|
|
1146
1146
|
generateHighQualityLinkPreview: true,
|
|
1147
1147
|
});
|
|
1148
1148
|
```
|
|
1149
1149
|
<div align="center">
|
|
1150
1150
|
|
|
1151
|
-
### π‘οΈ
|
|
1151
|
+
### π‘οΈ Security and Encryption
|
|
1152
1152
|
|
|
1153
|
-
|
|
|
1153
|
+
| Feature | Description |
|
|
1154
1154
|
|---------------------------|------------------------------------------|
|
|
1155
|
-
| π End-to-End Encryption |
|
|
1156
|
-
| π Key Management |
|
|
1157
|
-
| π Authentication |
|
|
1158
|
-
| π‘οΈ Data Protection |
|
|
1155
|
+
| π End-to-End Encryption | Signal protocol for secure messages |
|
|
1156
|
+
| π Key Management | Automatic key generation/rotation |
|
|
1157
|
+
| π Authentication | Security via QR code or pairing code |
|
|
1158
|
+
| π‘οΈ Data Protection | Secure local credentials storage |
|
|
1159
1159
|
|
|
1160
1160
|
---
|
|
1161
1161
|
|
|
1162
|
-
## π
|
|
1162
|
+
## π Support and Community
|
|
1163
1163
|
|
|
1164
|
-
|
|
1164
|
+
Join the community for help and contributions.
|
|
1165
1165
|
|
|
1166
|
-
### π
|
|
1166
|
+
### π Contacts and Resources
|
|
1167
1167
|
|
|
1168
|
-
|
|
|
1168
|
+
| Channel | Link/Info |
|
|
1169
1169
|
|------------------|------------------------------------------|
|
|
1170
1170
|
| **Email** | [samakavare1@gmail.com](mailto:samakavare1@gmail.com) |
|
|
1171
|
-
| **GitHub Issues**| [
|
|
1172
|
-
| **PayPal** | [
|
|
1173
|
-
| **
|
|
1171
|
+
| **GitHub Issues**| [Report Bug](https://github.com/realvare/based/issues) |
|
|
1172
|
+
| **PayPal** | [Donate](https://www.paypal.me/samakavare) |
|
|
1173
|
+
| **WhatsApp Channel**| [Channel](https://www.whatsapp.com/channel/0029VbB41Sa1Hsq1JhsC1Z1z) |
|
|
1174
1174
|
|
|
1175
1175
|
---
|
|
1176
1176
|
|
|
1177
|
-
## π
|
|
1177
|
+
## π Acknowledgments
|
|
1178
1178
|
|
|
1179
|
-
|
|
1179
|
+
Thanks to the projects that inspire Based:
|
|
1180
1180
|
|
|
1181
|
-
|
|
|
1181
|
+
| Project | Contribution |
|
|
1182
1182
|
|---------------------------|------------------------------------------|
|
|
1183
|
-
| [Baileys](https://github.com/WhiskeySockets/Baileys) |
|
|
1184
|
-
| [Yupra](https://www.npmjs.com/package/@yupra/baileys) |
|
|
1185
|
-
| [Signal Protocol](https://signal.org/) |
|
|
1183
|
+
| [Baileys](https://github.com/WhiskeySockets/Baileys) | Original WhatsApp Web API |
|
|
1184
|
+
| [Yupra](https://www.npmjs.com/package/@yupra/baileys) | LID/JID Fix |
|
|
1185
|
+
| [Signal Protocol](https://signal.org/) | End-to-end encryption |
|
|
1186
1186
|
|
|
1187
1187
|
---
|
|
1188
1188
|
|
|
1189
|
-
## β οΈ Disclaimer &
|
|
1189
|
+
## β οΈ Disclaimer & License
|
|
1190
1190
|
|
|
1191
|
-
### π
|
|
1191
|
+
### π Legal Note
|
|
1192
1192
|
|
|
1193
|
-
β οΈ **
|
|
1193
|
+
β οΈ **Important**: Not affiliated with WhatsApp Inc. or Meta. Educational/development use only.
|
|
1194
1194
|
|
|
1195
|
-
π‘οΈ **
|
|
1195
|
+
π‘οΈ **Responsible Use**: Avoid spam, WhatsApp ToS violations. Risk of account ban.
|
|
1196
1196
|
|
|
1197
|
-
### π
|
|
1197
|
+
### π MIT License
|
|
1198
1198
|
|
|
1199
1199
|
MIT License Β© 2025 [realvare](https://github.com/realvare)
|
|
1200
1200
|
|
|
1201
|
-
|
|
1201
|
+
See [LICENSE](LICENSE) for details.
|
|
1202
1202
|
|
|
1203
1203
|
---
|
|
1204
1204
|
|
|
@@ -1208,7 +1208,7 @@ Vedi [LICENSE](LICENSE) per dettagli.
|
|
|
1208
1208
|
<td align="center">
|
|
1209
1209
|
<img src="https://i.ibb.co/Cp0SQznC/sam2.png" width="120" height="120" alt="pfp" style="bysamakavare"/>
|
|
1210
1210
|
<br><br>
|
|
1211
|
-
<h2>π¨βπ»
|
|
1211
|
+
<h2>π¨βπ» Created by <a href="https://github.com/realvare" style="color: #8a2be2; text-decoration: none;">realvare</a></h2>
|
|
1212
1212
|
<p><em>sam aka vare</em></p>
|
|
1213
1213
|
</td>
|
|
1214
1214
|
</tr>
|
|
@@ -1217,13 +1217,13 @@ Vedi [LICENSE](LICENSE) per dettagli.
|
|
|
1217
1217
|
<br>
|
|
1218
1218
|
<p align="center">
|
|
1219
1219
|
<a href="https://github.com/realvare/based">
|
|
1220
|
-
<img src="https://img.shields.io/badge/β
|
|
1220
|
+
<img src="https://img.shields.io/badge/β_Star_the_Project-8a2be2?style=for-the-badge&logo=github&logoColor=white&labelColor=2d1b69"/>
|
|
1221
1221
|
</a>
|
|
1222
1222
|
<a href="https://github.com/realvare/based/fork">
|
|
1223
1223
|
<img src="https://img.shields.io/badge/π_Fork_Repository-8a2be2?style=for-the-badge&logo=github&logoColor=white&labelColor=2d1b69"/>
|
|
1224
1224
|
</a>
|
|
1225
1225
|
<a href="https://paypal.me/samakavare">
|
|
1226
|
-
<img src="https://img.shields.io/badge/π°
|
|
1226
|
+
<img src="https://img.shields.io/badge/π°_Donate-8a2be2?style=for-the-badge&logo=paypal&logoColor=white&labelColor=2d1b69"/>
|
|
1227
1227
|
</a>
|
|
1228
1228
|
</p>
|
|
1229
1229
|
<p align="center">
|
|
@@ -1241,7 +1241,7 @@ Vedi [LICENSE](LICENSE) per dettagli.
|
|
|
1241
1241
|
</a>
|
|
1242
1242
|
</p>
|
|
1243
1243
|
<div align="center">
|
|
1244
|
-
<p><strong>
|
|
1244
|
+
<p><strong>If it was useful to you, leave a star and/or consider a donation! β§</strong></p>
|
|
1245
1245
|
|
|
1246
1246
|
<br>
|
|
1247
1247
|
<img src="https://capsule-render.vercel.app/api?type=waving&color=gradient&customColorList=24&height=120§ion=footer&text=&fontSize=30&fontColor=ffffff&animation=fadeIn&fontAlignY=35"/>
|