@nexustechpro/baileys 2.0.6 → 2.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +72 -1
- package/lib/Defaults/index.js +3 -2
- package/lib/Signal/libsignal.js +552 -358
- package/lib/Socket/chats.js +192 -273
- package/lib/Socket/messages-recv.js +4 -2
- package/lib/Socket/messages-send.js +42 -18
- package/lib/Socket/newsletter.js +87 -36
- package/lib/Socket/nexus-handler.js +44 -42
- package/lib/Socket/socket.js +23 -10
- package/lib/Store/make-in-memory-store.js +29 -20
- package/lib/Utils/auth-utils.js +2 -2
- package/lib/Utils/chat-utils.js +319 -620
- package/lib/Utils/decode-wa-message.js +11 -26
- package/lib/Utils/key-store.js +1 -1
- package/lib/Utils/link-preview.js +134 -71
- package/lib/Utils/messages-media.js +97 -26
- package/lib/Utils/messages.js +723 -820
- package/lib/Utils/use-multi-file-auth-state.js +183 -90
- package/lib/index.js +1 -1
- package/package.json +10 -8
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<div align="center">
|
|
2
2
|
|
|
3
|
-

|
|
4
4
|
|
|
5
5
|
# @nexustechpro/baileys
|
|
6
6
|
|
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
- [Media Download](#-media-download)
|
|
39
39
|
- [Group Management](#-group-management)
|
|
40
40
|
- [User Operations](#-user-operations)
|
|
41
|
+
- [Check Number Status](#ban-checker)
|
|
41
42
|
- [Privacy Controls](#-privacy-controls)
|
|
42
43
|
- [Chat Operations](#-chat-operations)
|
|
43
44
|
- [Newsletter / Channels](#-newsletter--channels)
|
|
@@ -940,6 +941,24 @@ await sock.sendMessage('status@broadcast', {
|
|
|
940
941
|
})
|
|
941
942
|
```
|
|
942
943
|
|
|
944
|
+
#### React to a Status
|
|
945
|
+
```javascript
|
|
946
|
+
// Method 1 — via sendMessage
|
|
947
|
+
await sock.sendMessage('status@broadcast', {
|
|
948
|
+
react: {
|
|
949
|
+
text: '❤️',
|
|
950
|
+
key: message.key // the key of the status message
|
|
951
|
+
}
|
|
952
|
+
}, {
|
|
953
|
+
statusJidList: [message.key.participant] // the person who posted the status
|
|
954
|
+
})
|
|
955
|
+
|
|
956
|
+
// Method 2 — via sendReaction shorthand
|
|
957
|
+
await sock.sendReaction('status@broadcast', message.key, '❤️', {
|
|
958
|
+
statusJidList: [message.key.participant]
|
|
959
|
+
})
|
|
960
|
+
```
|
|
961
|
+
|
|
943
962
|
#### Status Mention (tag someone in your story)
|
|
944
963
|
|
|
945
964
|
Mention specific users or groups in a story. They get a private notification.
|
|
@@ -1152,6 +1171,58 @@ const blocked = await sock.fetchBlocklist()
|
|
|
1152
1171
|
|
|
1153
1172
|
---
|
|
1154
1173
|
|
|
1174
|
+
## 💬 Check Number Status
|
|
1175
|
+
|
|
1176
|
+
```javascript
|
|
1177
|
+
// Via socket instance
|
|
1178
|
+
const result = await sock.checkStatusWA('1234567890')
|
|
1179
|
+
|
|
1180
|
+
// Or direct import (no socket needed)
|
|
1181
|
+
import { checkStatusWA } from '@nexustechpro/baileys'
|
|
1182
|
+
const result = await checkStatusWA('1234567890')
|
|
1183
|
+
|
|
1184
|
+
// Response examples:
|
|
1185
|
+
// Active number
|
|
1186
|
+
{ number: '+1234567890', status: 'active', isBanned: false, isNeedOfficialWa: false, banInfo: null }
|
|
1187
|
+
|
|
1188
|
+
// Banned number
|
|
1189
|
+
{
|
|
1190
|
+
number: '+1234567890',
|
|
1191
|
+
status: 'banned',
|
|
1192
|
+
isBanned: true,
|
|
1193
|
+
isNeedOfficialWa: false,
|
|
1194
|
+
banInfo: {
|
|
1195
|
+
banType: 'temporary', // 'temporary' | 'permanent'
|
|
1196
|
+
violationType: '2',
|
|
1197
|
+
violationReason: 'Type 2',
|
|
1198
|
+
canAppeal: true, // false if permanent
|
|
1199
|
+
appealToken: 'xxxxx',
|
|
1200
|
+
banTime: 1716840000,
|
|
1201
|
+
banDate: '2024-05-28T00:00:00.000Z',
|
|
1202
|
+
appealStatus: 'PENDING',
|
|
1203
|
+
appealCreatedAt: '2024-05-27T00:00:00.000Z'
|
|
1204
|
+
}
|
|
1205
|
+
}
|
|
1206
|
+
|
|
1207
|
+
// Blocked by custom screen (needs official WhatsApp)
|
|
1208
|
+
{ number: '+1234567890', status: 'blocked', isBanned: false, isNeedOfficialWa: true, banInfo: null }
|
|
1209
|
+
|
|
1210
|
+
// Rate limited
|
|
1211
|
+
{ number: '+1234567890', status: 'rate_limited', isBanned: false, isNeedOfficialWa: false, banInfo: null }
|
|
1212
|
+
|
|
1213
|
+
// Usage example
|
|
1214
|
+
import { checkStatusWA } from '@nexustechpro/baileys'
|
|
1215
|
+
const check = await checkStatusWA('1234567890')
|
|
1216
|
+
if (check.isBanned) {
|
|
1217
|
+
console.log(`Banned: ${check.banInfo.banType}`)
|
|
1218
|
+
if (check.banInfo.canAppeal) console.log(`Appeal token: ${check.banInfo.appealToken}`)
|
|
1219
|
+
} else {
|
|
1220
|
+
console.log(`Status: ${check.status}`)
|
|
1221
|
+
}
|
|
1222
|
+
```
|
|
1223
|
+
|
|
1224
|
+
---
|
|
1225
|
+
|
|
1155
1226
|
## 🔒 Privacy Controls
|
|
1156
1227
|
|
|
1157
1228
|
```javascript
|
package/lib/Defaults/index.js
CHANGED
|
@@ -4,6 +4,7 @@ import { proto } from '../../WAProto/index.js';
|
|
|
4
4
|
import { makeLibSignalRepository } from '../Signal/libsignal.js';
|
|
5
5
|
import { Browsers } from '../Utils/browser-utils.js';
|
|
6
6
|
import logger from '../Utils/logger.js';
|
|
7
|
+
import urlRegexSafe from 'url-regex-safe';
|
|
7
8
|
const require = createRequire(import.meta.url);
|
|
8
9
|
const PHONENUMBER_MCC = require('./phonenumber-mcc.json');
|
|
9
10
|
export { PHONENUMBER_MCC };
|
|
@@ -36,8 +37,7 @@ export const DICT_VERSION = 3;
|
|
|
36
37
|
export const KEY_BUNDLE_TYPE = Buffer.from([5]);
|
|
37
38
|
export const NOISE_WA_HEADER = Buffer.from([87, 65, 6, DICT_VERSION]);
|
|
38
39
|
|
|
39
|
-
export const URL_REGEX =
|
|
40
|
-
|
|
40
|
+
export const URL_REGEX = urlRegexSafe({ strict: true, re2: false });
|
|
41
41
|
export const WA_CERT_DETAILS = {
|
|
42
42
|
SERIAL: 0,
|
|
43
43
|
ISSUER: 'WhatsAppLongTerm1',
|
|
@@ -158,6 +158,7 @@ export const INITIAL_PREKEY_COUNT = 95;
|
|
|
158
158
|
|
|
159
159
|
export const UPLOAD_TIMEOUT = 30000;
|
|
160
160
|
export const MIN_UPLOAD_INTERVAL = 5000;
|
|
161
|
+
export const HISTORY_SYNC_PAUSED_TIMEOUT_MS = 120000;
|
|
161
162
|
|
|
162
163
|
export const DEFAULT_CACHE_TTLS = {
|
|
163
164
|
SIGNAL_STORE: 5 * 60,
|