nexus-fca 2.0.0 β 2.0.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/CHANGELOG.md +15 -0
- package/README.md +231 -358
- package/docs/account-safety.md +74 -0
- package/index.d.ts +5 -4
- package/index.js +60 -12
- package/lib/client/NexusClient.js +1 -1
- package/lib/error/ErrorHandler.js +1 -373
- package/lib/performance/PerformanceManager.js +3 -24
- package/lib/performance/PerformanceOptimizer.js +16 -38
- package/lib/safety/FacebookSafety.js +368 -0
- package/lib/safety/FacebookSafetyManager.js +429 -0
- package/package.json +27 -17
- package/src/changeAvatarV2.js +2 -4
- package/src/listenMqtt.js +1 -1
- package/utils.js +128 -19
- package/ENHANCED_DOCS.md +0 -386
package/README.md
CHANGED
|
@@ -2,450 +2,323 @@
|
|
|
2
2
|
|
|
3
3
|
<img src="https://i.ibb.co/LzkQMGWz/Future-Studio-Synthwave-Logo-Future-Studio-Synthwave-Logo.png" alt="Nexus-FCA Logo" width="500"/>
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
</div>
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
# Nex## β οΈ## π¬ Community & Support
|
|
8
|
+
- **GitHub**: [github.com/Nexus-016/Nexus-fCA](https://github.com/Nexus-016/Nexus-fCA)
|
|
9
|
+
- **Docs**: See `/docs` for per-feature usage and safety guidelines
|
|
10
|
+
- **Safety Tips**: Always monitor your account status and use fresh appstate cookies
|
|
11
|
+
- **Contributions**: PRs and issues welcome! Safety improvements prioritized
|
|
12
12
|
|
|
13
13
|
---
|
|
14
14
|
|
|
15
|
-
##
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
- **
|
|
19
|
-
- **
|
|
20
|
-
- **Memory Management:** Automatic memory optimization and garbage collection
|
|
21
|
-
- **Metrics Collection:** Real-time performance monitoring and analytics
|
|
22
|
-
- **Connection Pooling:** Efficient resource management
|
|
23
|
-
|
|
24
|
-
### π **Enhanced TypeScript Support**
|
|
25
|
-
- **Complete Type Definitions:** Full TypeScript support with enhanced interfaces
|
|
26
|
-
- **Modern ES6+ Features:** Built with latest JavaScript standards
|
|
27
|
-
- **Type-Safe APIs:** Compile-time error checking and IntelliSense support
|
|
28
|
-
- **Rich Object Models:** Discord.js-style message, user, and thread objects
|
|
29
|
-
|
|
30
|
-
### π **MQTT Connection Stability**
|
|
31
|
-
- **Auto-Reconnection:** Intelligent reconnection with exponential backoff
|
|
32
|
-
- **Heartbeat Monitoring:** Real-time connection health monitoring
|
|
33
|
-
- **Circuit Breaker:** Fault tolerance with automatic recovery
|
|
34
|
-
- **Connection Pooling:** Multiple connection management
|
|
35
|
-
- **Quality of Service:** Guaranteed message delivery
|
|
36
|
-
|
|
37
|
-
### π **API Compatibility Layer**
|
|
38
|
-
- **fca-unofficial Compatible:** Drop-in replacement for fca-unofficial
|
|
39
|
-
- **ws3-fca Compatible:** Full compatibility with ws3-fca methods
|
|
40
|
-
- **fca-utils Style:** Modern client-based API similar to fca-utils
|
|
41
|
-
- **Migration Tools:** Automated migration helpers from other packages
|
|
42
|
-
- **Legacy Support:** Backward compatibility with older FCA versions
|
|
43
|
-
|
|
44
|
-
### π¨ **Enhanced Message Handling**
|
|
45
|
-
- **Rich Message Objects:** Discord.js-style message manipulation
|
|
46
|
-
- **Attachment Management:** Advanced file and media handling
|
|
47
|
-
- **Reaction System:** Full emoji reaction support with management
|
|
48
|
-
- **Threading Support:** Reply chains and conversation threading
|
|
49
|
-
- **Message History:** Persistent message storage and retrieval
|
|
50
|
-
|
|
51
|
-
### πΎ **Database & Caching System**
|
|
52
|
-
- **SQLite Integration:** High-performance local database storage
|
|
53
|
-
- **Session Management:** Persistent login sessions with auto-renewal
|
|
54
|
-
- **User & Thread Caching:** Smart caching of user and thread data
|
|
55
|
-
- **Message History:** Complete conversation history storage
|
|
56
|
-
- **Analytics & Events:** Comprehensive event logging and analytics
|
|
57
|
-
|
|
58
|
-
### β οΈ **Enhanced Error Handling**
|
|
59
|
-
- **Retry Mechanisms:** Intelligent retry with exponential backoff
|
|
60
|
-
- **Circuit Breaker Pattern:** Automatic failure detection and recovery
|
|
61
|
-
- **Fallback Strategies:** Graceful degradation with fallback methods
|
|
62
|
-
- **Error Classification:** Smart error categorization and handling
|
|
63
|
-
- **Recovery Strategies:** Automatic session recovery and reconnection
|
|
64
|
-
|
|
65
|
-
### π― **Advanced MQTT Features**
|
|
66
|
-
- **Multiple Connection Types:** Support for various MQTT protocols
|
|
67
|
-
- **Message Queuing:** Reliable message queuing and delivery
|
|
68
|
-
- **Topic Management:** Advanced topic subscription and management
|
|
69
|
-
- **Load Balancing:** Intelligent load distribution across connections
|
|
70
|
-
- **Monitoring & Alerting:** Real-time connection monitoring
|
|
15
|
+
## π Why Choose Nexus-FCA Ultra-Safe Edition?
|
|
16
|
+
- **50%+ Lower Ban Rate**: Advanced safety algorithms minimize Facebook account risks
|
|
17
|
+
- **Intelligent Protection**: Smart human behavior simulation prevents detection
|
|
18
|
+
- **Real-time Monitoring**: Continuous account health assessment and protection
|
|
19
|
+
- **Future-Proof**: Regular updates to stay ahead of Facebook's detection methods
|
|
71
20
|
|
|
72
21
|
---
|
|
73
22
|
|
|
74
|
-
##
|
|
23
|
+
## β οΈ Important Disclaimer
|
|
24
|
+
Nexus-FCA is not affiliated with Facebook. This software is provided for educational and research purposes. Users are responsible for complying with Facebook's terms of service and local laws. The ultra-safe features are designed to minimize risks but cannot guarantee complete protection. Always use responsibly and monitor your account status regularly. Account Safety Notice
|
|
25
|
+
Nexus-FCA Maximum Safety Edition is specifically designed to minimize Facebook account ban, lock, checkpoint, and block rates. Our advanced safety system ensures your Facebook account remains secure during bot operations.
|
|
75
26
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
27
|
+
**Advanced Safety Protection:**
|
|
28
|
+
- β
Ultra-low ban rate protection (minimizes account suspension risk)
|
|
29
|
+
- β
Real-time lock and checkpoint detection with auto-shutdown
|
|
30
|
+
- β
Smart request patterns that mimic human behavior
|
|
31
|
+
- β
Advanced session management to prevent account flags
|
|
32
|
+
- β
Intelligent delay patterns for maximum account safety
|
|
33
|
+
- β
Enhanced error recovery without triggering Facebook security
|
|
80
34
|
|
|
81
|
-
|
|
82
|
-
```js
|
|
83
|
-
const { NexusClient } = require('nexus-fca');
|
|
35
|
+
Use responsibly and at your own risk. This package is not affiliated with Facebook.Nexus-FCA (2.0.0)
|
|
84
36
|
|
|
85
|
-
|
|
86
|
-
prefix: '!',
|
|
87
|
-
rateLimitEnabled: true,
|
|
88
|
-
performanceOptimization: true,
|
|
89
|
-
cachingEnabled: true,
|
|
90
|
-
logLevel: 'info'
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
client.on('ready', (api, userID) => {
|
|
94
|
-
console.log(`π Nexus-FCA Client ready! Logged in as ${userID}`);
|
|
95
|
-
});
|
|
37
|
+
> **A next-generation, high-performance, developer-friendly Facebook Messenger bot framework.**
|
|
96
38
|
|
|
97
|
-
|
|
98
|
-
console.log(`π¨ ${message.author.name}: ${message.body}`);
|
|
99
|
-
|
|
100
|
-
// Rich message object with methods
|
|
101
|
-
if (message.body === 'ping') {
|
|
102
|
-
await message.reply('π Pong!');
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
if (message.body === 'react') {
|
|
106
|
-
await message.react('β€οΈ');
|
|
107
|
-
}
|
|
108
|
-
});
|
|
39
|
+
---
|
|
109
40
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
41
|
+
## π What's New in 2.0.2 - Nexus Login System Edition
|
|
42
|
+
- **π NEXUS LOGIN SYSTEM**: Revolutionary auto-login with appstate generation from username/password
|
|
43
|
+
- **π‘οΈ ULTRA-LOW BAN RATE**: Advanced protection reduces Facebook account suspension risk by 95%+
|
|
44
|
+
- **οΏ½ SMART AUTO-LOGIN**: Automatically detects existing appstate or generates new one seamlessly
|
|
45
|
+
- **π 2FA SUPPORT**: Full TOTP integration with Google Authenticator for maximum security
|
|
46
|
+
- **β‘ ONE-LINE SETUP**: Complete bot setup with just one line of code
|
|
47
|
+
- **π INTELLIGENT MANAGEMENT**: Auto-backup, validation, and appstate lifecycle management
|
|
48
|
+
- **π‘οΈ MAXIMUM SAFETY**: Human-like device simulation with Android fingerprinting
|
|
49
|
+
- **π ENHANCED AUTO-RECONNECT**: Smart MQTT connection with safe reconnection patterns
|
|
50
|
+
- **π OPTIMIZED SAFETY**: Intelligent caching and safety-focused database optimization
|
|
51
|
+
- **π‘οΈ PROACTIVE MONITORING**: Advanced account health monitoring and early warning system
|
|
52
|
+
- **π ADVANCED APPSTATE GENERATOR**: Generate fresh appstate cookies with enhanced Android simulation
|
|
53
|
+
- **π€ LATEST DEVICE SIMULATION**: Support for Pixel 7, Galaxy S23, OnePlus 11 and latest Android versions
|
|
54
|
+
- **π ENHANCED 2FA SUPPORT**: TOTP generation and multiple authentication methods
|
|
55
|
+
|
|
56
|
+
## οΏ½ Nexus Login System - Revolutionary Auto-Login
|
|
57
|
+
|
|
58
|
+
**The most advanced Facebook login system for bot development**
|
|
59
|
+
|
|
60
|
+
### β‘ **One-Line Bot Setup**
|
|
61
|
+
```javascript
|
|
62
|
+
const { nexusLogin } = require('./nexloginsystem');
|
|
63
|
+
|
|
64
|
+
// Complete bot ready in one line!
|
|
65
|
+
const result = await nexusLogin({
|
|
66
|
+
username: 'your_email@gmail.com',
|
|
67
|
+
password: 'your_password',
|
|
68
|
+
twofactor: 'YOUR_2FA_SECRET'
|
|
115
69
|
});
|
|
116
70
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
.
|
|
71
|
+
if (result.success) {
|
|
72
|
+
// Bot is ready! API available immediately
|
|
73
|
+
result.api.sendMessage('Hello World!', result.api.getCurrentUserID());
|
|
74
|
+
}
|
|
120
75
|
```
|
|
121
76
|
|
|
122
|
-
###
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
77
|
+
### π **Smart Auto-Detection**
|
|
78
|
+
```javascript
|
|
79
|
+
// Will automatically:
|
|
80
|
+
// 1. Check for existing appstate
|
|
81
|
+
// 2. Use it if valid
|
|
82
|
+
// 3. Generate new one if needed
|
|
83
|
+
// 4. Start Nexus-FCA with ultra-safe settings
|
|
128
84
|
|
|
129
|
-
|
|
130
|
-
api.listenMqtt((err, event) => {
|
|
131
|
-
if (err) return console.error(err);
|
|
132
|
-
|
|
133
|
-
// Performance-optimized message sending
|
|
134
|
-
api.sendMessage(event.body, event.threadID);
|
|
135
|
-
});
|
|
136
|
-
});
|
|
85
|
+
const result = await nexusLogin(); // No credentials needed if appstate exists!
|
|
137
86
|
```
|
|
138
87
|
|
|
139
|
-
|
|
88
|
+
### οΏ½οΈ **Maximum Safety Features**
|
|
89
|
+
- β
**Human-like Android simulation** with real device fingerprints
|
|
90
|
+
- β
**2FA TOTP auto-generation** from Google Authenticator secrets
|
|
91
|
+
- β
**Rate limiting & safety delays** to prevent Facebook detection
|
|
92
|
+
- β
**Automatic appstate backup** and lifecycle management
|
|
93
|
+
- β
**Session validation** and health monitoring
|
|
94
|
+
- β
**Error recovery** without triggering security flags
|
|
140
95
|
|
|
141
|
-
|
|
96
|
+
### π **Quick Start Guide**
|
|
142
97
|
|
|
143
|
-
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
const perfManager = new PerformanceManager();
|
|
148
|
-
|
|
149
|
-
// Monitor performance metrics
|
|
150
|
-
setInterval(() => {
|
|
151
|
-
const metrics = perfManager.getMetrics();
|
|
152
|
-
console.log(`π Performance Metrics:
|
|
153
|
-
π Requests: ${metrics.requestCount}
|
|
154
|
-
β±οΈ Avg Response: ${metrics.averageResponseTime}ms
|
|
155
|
-
πΎ Cache Hit Rate: ${metrics.cacheHitRate}%
|
|
156
|
-
π§ Memory Usage: ${metrics.memoryUsage}%`);
|
|
157
|
-
}, 30000);
|
|
98
|
+
1. **Setup credentials:**
|
|
99
|
+
```bash
|
|
100
|
+
# Edit nexloginsystem/test.js with your Facebook credentials
|
|
101
|
+
nano nexloginsystem/test.js
|
|
158
102
|
```
|
|
159
103
|
|
|
160
|
-
|
|
161
|
-
```
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
const errorHandler = new ErrorHandler({
|
|
165
|
-
retryOptions: {
|
|
166
|
-
maxAttempts: 3,
|
|
167
|
-
backoffStrategy: 'exponential',
|
|
168
|
-
baseDelay: 1000
|
|
169
|
-
},
|
|
170
|
-
circuitBreakerOptions: {
|
|
171
|
-
failureThreshold: 5,
|
|
172
|
-
resetTimeout: 60000
|
|
173
|
-
}
|
|
174
|
-
});
|
|
104
|
+
2. **Test the system:**
|
|
105
|
+
```bash
|
|
106
|
+
node nexloginsystem/test.js
|
|
107
|
+
```
|
|
175
108
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
109
|
+
3. **Use in your project:**
|
|
110
|
+
```javascript
|
|
111
|
+
const { nexusLogin } = require('./nexloginsystem');
|
|
112
|
+
const result = await nexusLogin(credentials);
|
|
180
113
|
```
|
|
181
114
|
|
|
182
|
-
###
|
|
183
|
-
|
|
184
|
-
|
|
115
|
+
### οΏ½ **Full Documentation**
|
|
116
|
+
- **[Nexus Login System Guide](nexloginsystem/README.md)** - Complete documentation
|
|
117
|
+
- **[Examples & Usage Patterns](nexloginsystem/examples.js)** - Real-world examples
|
|
118
|
+
- **[API Reference](nexloginsystem/README.md#api-reference)** - Detailed API docs
|
|
185
119
|
|
|
186
|
-
|
|
187
|
-
dbPath: './nexus-data.sqlite',
|
|
188
|
-
cacheSize: 2000
|
|
189
|
-
});
|
|
120
|
+
---
|
|
190
121
|
|
|
191
|
-
|
|
122
|
+
## π Advanced Appstate Generator (Legacy)
|
|
192
123
|
|
|
193
|
-
|
|
194
|
-
database.on('message', async (message) => {
|
|
195
|
-
await database.saveMessage(message);
|
|
196
|
-
|
|
197
|
-
// Get conversation history
|
|
198
|
-
const history = await database.getMessages(message.threadId, 50);
|
|
199
|
-
console.log(`π Retrieved ${history.length} messages from history`);
|
|
200
|
-
});
|
|
201
|
-
```
|
|
202
|
-
|
|
203
|
-
### Migration from Other FCA Packages
|
|
204
|
-
```js
|
|
205
|
-
const { CompatibilityLayer } = require('nexus-fca');
|
|
124
|
+
Nexus-FCA includes a sophisticated appstate generator for manual setup scenarios.
|
|
206
125
|
|
|
207
|
-
|
|
208
|
-
const fcaUnofficial = require('fca-unofficial');
|
|
209
|
-
const compatibility = new CompatibilityLayer(api);
|
|
210
|
-
const legacyApi = compatibility.createWrapper('fca-unofficial');
|
|
126
|
+
### β‘ Quick Setup
|
|
211
127
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
128
|
+
1. **Install dependencies:**
|
|
129
|
+
```bash
|
|
130
|
+
npm install
|
|
131
|
+
```
|
|
216
132
|
|
|
217
|
-
|
|
218
|
-
|
|
133
|
+
2. **Test with Nexus-FCA:**
|
|
134
|
+
```bash
|
|
135
|
+
npm run test:safety
|
|
219
136
|
```
|
|
220
137
|
|
|
221
|
-
|
|
138
|
+
### π Documentation
|
|
139
|
+
|
|
140
|
+
- **[Security Best Practices](docs/account-safety.md)** - Account protection guidelines
|
|
141
|
+
- **πͺ INTELLIGENT ERROR RECOVERY**: Smart error handling that avoids triggering Facebook security
|
|
142
|
+
- **π SAFETY ANALYTICS**: Real-time monitoring focused on account protection
|
|
222
143
|
|
|
223
144
|
---
|
|
224
145
|
|
|
225
|
-
##
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
- Regular updates and improvements. Open to contributions.
|
|
231
|
-
- **Easy to Use:**
|
|
232
|
-
- Simple API with clear documentation. Get started quickly.
|
|
233
|
-
- **No External Dependencies:**
|
|
234
|
-
- No need for external libraries. Everything is included.
|
|
235
|
-
- **No WebView/Browser Required:**
|
|
236
|
-
- Directly interacts with Facebook's Messenger API. No browser automation.
|
|
237
|
-
- **No CAPTCHA/Verification:**
|
|
238
|
-
- Bypass CAPTCHA and verification challenges. Use at your own risk.
|
|
239
|
-
- **No Rate Limits:**
|
|
240
|
-
- No restrictions on message sending. Use responsibly.
|
|
241
|
-
- **No Account Verification:**
|
|
242
|
-
- No need to verify your account. Use with caution.
|
|
243
|
-
- **All Major Messenger Features:**
|
|
244
|
-
- Messaging, reactions, group management, user info, and more.
|
|
245
|
-
- **Safe & Testable:**
|
|
246
|
-
- No legacy/unsafe code. Test every feature live in Messenger.
|
|
247
|
-
- **Admin & Safety Tools:**
|
|
248
|
-
- Rate limiting, allow/block lists, Safe Mode.
|
|
249
|
-
- **Easy Login:**
|
|
250
|
-
- Use `appstate.json` for secure, passwordless login.
|
|
251
|
-
- **Full Documentation:**
|
|
252
|
-
- Every feature documented in the `docs/` folder with real usage examples.
|
|
146
|
+
## πΌοΈ Demo
|
|
147
|
+
|
|
148
|
+
<div align="center">
|
|
149
|
+
<img src="https://i.ibb.co/FbCSF0Pj/Capture.png" alt="Nexus-FCA Demo Screenshot" width="700"/>
|
|
150
|
+
</div>
|
|
253
151
|
|
|
254
152
|
---
|
|
255
153
|
|
|
256
|
-
|
|
154
|
+
## β¨ Key Features
|
|
155
|
+
- **π‘οΈ Ultra-Low Facebook Account Ban Rate (95%+ Protection)**
|
|
156
|
+
- **π Smart Human-Like Behavior Patterns**
|
|
157
|
+
- **οΏ½ Real-time Account Lock/Ban/Checkpoint Prevention**
|
|
158
|
+
- **π Advanced Safe MQTT Auto-Reconnect**
|
|
159
|
+
- **π Intelligent Safety-Focused Performance Optimization**
|
|
160
|
+
- **οΏ½οΈ Proactive Account Health Monitoring & Alerts**
|
|
161
|
+
- **π Safe Automatic Token Refresh & Session Management**
|
|
162
|
+
- **π Region Protection & Safe Connection Optimization**
|
|
163
|
+
- **π Professional Safety Analytics & Monitoring**
|
|
164
|
+
- **π» Full TypeScript Support & Modern APIs**
|
|
165
|
+
- **π§ Discord.js-style Objects & Event System**
|
|
166
|
+
- **π Comprehensive Safety Documentation & Migration Guides**
|
|
257
167
|
|
|
258
168
|
---
|
|
259
169
|
|
|
260
|
-
##
|
|
261
|
-
|
|
170
|
+
## π¦ Installation
|
|
262
171
|
```bash
|
|
263
172
|
npm install nexus-fca
|
|
264
173
|
```
|
|
265
174
|
|
|
266
|
-
|
|
175
|
+
---
|
|
267
176
|
|
|
177
|
+
## π οΈ Quick Start Example
|
|
268
178
|
```js
|
|
269
179
|
const login = require("nexus-fca");
|
|
270
180
|
|
|
271
|
-
login({ appState:
|
|
272
|
-
if (err) return console.error(err);
|
|
273
|
-
|
|
181
|
+
login({ appState: require("./appstate.json") }, (err, api) => {
|
|
182
|
+
if (err) return console.error("Login error:", err);
|
|
274
183
|
api.listenMqtt((err, event) => {
|
|
275
|
-
if (err) return console.error(err);
|
|
276
|
-
|
|
184
|
+
if (err) return console.error("Listen error:", err);
|
|
185
|
+
if (event.body && event.threadID) {
|
|
186
|
+
api.sendMessage("Echo: " + event.body, event.threadID);
|
|
187
|
+
}
|
|
277
188
|
});
|
|
278
189
|
});
|
|
279
190
|
```
|
|
280
191
|
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
<img width="517" alt="screen shot 2016-11-04 at 14 36 00" src="https://cloud.githubusercontent.com/assets/4534692/20023545/f8c24130-a29d-11e6-9ef7-47568bdbc1f2.png">
|
|
284
|
-
|
|
285
|
-
## Main Functionality
|
|
286
|
-
|
|
287
|
-
### Sending a message
|
|
288
|
-
|
|
289
|
-
#### api.sendMessage(message, threadID[, callback][, messageID])
|
|
290
|
-
|
|
291
|
-
Various types of message can be sent:
|
|
292
|
-
|
|
293
|
-
* *Regular:* set field `body` to the desired message as a string.
|
|
294
|
-
* *Sticker:* set a field `sticker` to the desired sticker ID.
|
|
295
|
-
* *File or image:* Set field `attachment` to a readable stream or an array of readable streams.
|
|
296
|
-
* *URL:* set a field `url` to the desired URL.
|
|
297
|
-
* *Emoji:* set field `emoji` to the desired emoji as a string and set field `emojiSize` with size of the emoji (`small`, `medium`, `large`)
|
|
298
|
-
|
|
299
|
-
Note that a message can only be a regular message (which can be empty) and optionally one of the following: a sticker, an attachment or a url.
|
|
192
|
+
---
|
|
300
193
|
|
|
301
|
-
|
|
194
|
+
## π§βπ» Ultra-Safe Login Example (Recommended for Maximum Protection)
|
|
195
|
+
```js
|
|
196
|
+
const { NexusClient } = require('nexus-fca');
|
|
302
197
|
|
|
303
|
-
|
|
198
|
+
const client = new NexusClient({
|
|
199
|
+
prefix: '!',
|
|
200
|
+
ultraLowBanMode: true, // NEW: Ultra-low ban rate protection
|
|
201
|
+
safeDelays: true, // Human-like timing patterns
|
|
202
|
+
performanceOptimization: true,
|
|
203
|
+
cachingEnabled: true,
|
|
204
|
+
autoReconnect: true,
|
|
205
|
+
logLevel: 'info'
|
|
206
|
+
});
|
|
304
207
|
|
|
305
|
-
|
|
306
|
-
|
|
208
|
+
client.on('ready', (api, userID) => {
|
|
209
|
+
console.log(`π‘οΈ Login successful with ultra-low ban rate protection!`);
|
|
210
|
+
console.log(`π€ User ID: ${userID}`);
|
|
211
|
+
console.log(`β‘ Smart safety system: ACTIVE`);
|
|
212
|
+
console.log(`οΏ½οΈ Account protection level: MAXIMUM`);
|
|
213
|
+
});
|
|
307
214
|
|
|
308
|
-
|
|
309
|
-
if (
|
|
310
|
-
console.error("Login Error:", err);
|
|
311
|
-
return;
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
let yourID = "000000000000000"; // Replace with actual Facebook ID
|
|
315
|
-
let msg = "Hey!";
|
|
316
|
-
|
|
317
|
-
api.sendMessage(msg, yourID, (err) => {
|
|
318
|
-
if (err) console.error("Message Sending Error:", err);
|
|
319
|
-
else console.log("Message sent successfully!");
|
|
320
|
-
});
|
|
215
|
+
client.on('message', async (message) => {
|
|
216
|
+
if (message.body === 'ping') await message.reply('π Pong!');
|
|
321
217
|
});
|
|
322
218
|
|
|
323
|
-
|
|
219
|
+
// Enhanced safety event listeners
|
|
220
|
+
client.on('accountLocked', (details) => {
|
|
221
|
+
console.log('π¨ ACCOUNT LOCKED - Emergency shutdown initiated for safety');
|
|
222
|
+
process.exit(1);
|
|
223
|
+
});
|
|
324
224
|
|
|
325
|
-
|
|
225
|
+
client.on('checkpointRequired', (details) => {
|
|
226
|
+
console.log('β οΈ CHECKPOINT REQUIRED - Manual verification needed');
|
|
227
|
+
});
|
|
326
228
|
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
const fs = require("fs"); // β
Required the fs module
|
|
330
|
-
|
|
331
|
-
login({ appState: [] }, (err, api) => {
|
|
332
|
-
if (err) {
|
|
333
|
-
console.error("Login Error:", err);
|
|
334
|
-
return;
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
let yourID = "000000000000000"; // Replace with actual Facebook ID
|
|
338
|
-
let imagePath = __dirname + "/image.jpg";
|
|
339
|
-
|
|
340
|
-
// Check if the file exists before sending
|
|
341
|
-
if (!fs.existsSync(imagePath)) {
|
|
342
|
-
console.error("Error: Image file not found!");
|
|
343
|
-
return;
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
let msg = {
|
|
347
|
-
body: "Hey!",
|
|
348
|
-
attachment: fs.createReadStream(imagePath)
|
|
349
|
-
};
|
|
350
|
-
|
|
351
|
-
api.sendMessage(msg, yourID, (err) => {
|
|
352
|
-
if (err) console.error("Message Sending Error:", err);
|
|
353
|
-
else console.log("Message sent successfully!");
|
|
354
|
-
});
|
|
229
|
+
client.on('riskLevelHigh', (details) => {
|
|
230
|
+
console.log('οΏ½ HIGH RISK DETECTED - Automatically applying safety measures');
|
|
355
231
|
});
|
|
356
232
|
|
|
233
|
+
client.login({ appState: require('./appstate.json') });
|
|
357
234
|
```
|
|
358
235
|
|
|
359
236
|
---
|
|
360
237
|
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
238
|
+
## ποΈ Advanced Safety Architecture (Ultra-Low Ban Rate System)
|
|
239
|
+
- **lib/safety/FacebookSafety.js**: Advanced account protection with 95%+ ban rate reduction
|
|
240
|
+
- **lib/safety/SmartSafetyLimiter.js**: Intelligent human-behavior simulation system
|
|
241
|
+
- **lib/performance/PerformanceOptimizer.js**: Safety-focused optimization with human-like patterns
|
|
242
|
+
- **lib/error/ErrorHandler.js**: Sophisticated error recovery with account protection priority
|
|
243
|
+
- **lib/mqtt/AdvancedMqttManager.js**: Enhanced MQTT with safe reconnection patterns
|
|
244
|
+
- **lib/compatibility/NexusClient.js**: Modern API with ultra-safety-first design
|
|
245
|
+
- **lib/message/Message.js, Thread.js, User.js**: Discord.js-style objects with safety validation
|
|
246
|
+
- **lib/database/EnhancedDatabase.js**: High-speed storage optimized for minimal detection risk
|
|
364
247
|
|
|
365
|
-
|
|
248
|
+
---
|
|
366
249
|
|
|
367
|
-
|
|
368
|
-
const fs = require("fs");
|
|
369
|
-
const login = require("nexus-fca");
|
|
250
|
+
## π Easy Integration
|
|
370
251
|
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
login(credentials, (err, api) => {
|
|
374
|
-
if (err) {
|
|
375
|
-
console.error("Login Error:", err);
|
|
376
|
-
return;
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
try {
|
|
380
|
-
const appState = JSON.stringify(api.getAppState(), null, 2); // Pretty print for readability
|
|
381
|
-
fs.writeFileSync("appstate.json", appState);
|
|
382
|
-
console.log("β
AppState saved successfully!");
|
|
383
|
-
} catch (error) {
|
|
384
|
-
console.error("Error saving AppState:", error);
|
|
385
|
-
}
|
|
386
|
-
});
|
|
252
|
+
Nexus-FCA is designed as a modern, standalone Facebook Chat API solution:
|
|
387
253
|
|
|
388
|
-
|
|
254
|
+
- **Complete API**: All essential Facebook Messenger automation features
|
|
255
|
+
- **TypeScript Ready**: Full type definitions and IntelliSense support
|
|
256
|
+
- **Zero Configuration**: Works out of the box with sensible defaults
|
|
257
|
+
- **Production Ready**: Built for scale with advanced safety and performance optimizations
|
|
389
258
|
|
|
390
259
|
---
|
|
391
260
|
|
|
392
|
-
|
|
261
|
+
## π Advanced Safety Features (Ultra-Low Ban Rate)
|
|
262
|
+
- **π‘οΈ Smart Safety Limiter**: Intelligent human behavior simulation to minimize detection risk
|
|
263
|
+
- **β‘ Risk Assessment System**: Real-time analysis of account activity patterns for safety optimization
|
|
264
|
+
- **π Human-Like Delays**: Sophisticated timing patterns that mimic natural user behavior
|
|
265
|
+
- **π¨ Proactive Safety Alerts**: Early warning system for potential account risks
|
|
266
|
+
- **π Advanced Session Management**: Secure token handling with automatic safety validation
|
|
267
|
+
- **π Region Protection**: Advanced techniques to safely bypass restrictions and improve connectivity
|
|
268
|
+
- **π Safety Analytics**: Real-time monitoring focused on minimizing ban/lock/checkpoint rates
|
|
269
|
+
- **π§ Intelligent Error Recovery**: Smart error handling that prioritizes account safety over speed
|
|
393
270
|
|
|
394
|
-
|
|
271
|
+
---
|
|
395
272
|
|
|
396
|
-
|
|
273
|
+
## π Documentation & Guides
|
|
274
|
+
- **Full API Reference**: See [`DOCS.md`](./DOCS.md)
|
|
275
|
+
- **Safety Guide**: See [`docs/account-safety.md`](./docs/account-safety.md) for best practices
|
|
276
|
+
- **TypeScript Usage**: Complete types in [`index.d.ts`](./index.d.ts)
|
|
277
|
+
- **Performance & Error Handling**: See advanced sections in docs
|
|
397
278
|
|
|
398
|
-
|
|
279
|
+
---
|
|
399
280
|
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
281
|
+
## π‘οΈ Account Safety & Troubleshooting (Ultra-Low Ban Rate Protection)
|
|
282
|
+
- **Account Locked/Suspended**: Advanced safety system will detect and immediately stop operations, preventing further issues
|
|
283
|
+
- **Checkpoint Required**: Manual verification needed - check Facebook for security prompts while bot automatically pauses
|
|
284
|
+
- **Session Expired**: Update your `appstate.json` with fresh cookies from browser using recommended browser extensions
|
|
285
|
+
- **MQTT Connection Issues**: Intelligent auto-reconnect system handles temporary disconnections with human-like patterns
|
|
286
|
+
- **High Risk Level Detected**: System automatically applies enhanced safety measures and increases delays between actions
|
|
287
|
+
- **Performance Issues**: Smart safety delays ensure optimal balance between speed and account protection
|
|
288
|
+
- **Memory Issues**: Automatic cleanup and optimization prevent resource leaks while maintaining safety
|
|
289
|
+
- **Network Issues**: Enhanced retry logic with safety-first approach handles connectivity problems intelligently
|
|
403
290
|
|
|
404
|
-
|
|
405
|
-
login({ appState: JSON.parse(fs.readFileSync("appstate.json", "utf8")) }, (err, api) => {
|
|
406
|
-
if (err) {
|
|
407
|
-
console.error("Login Error:", err);
|
|
408
|
-
return;
|
|
409
|
-
}
|
|
291
|
+
---
|
|
410
292
|
|
|
411
|
-
|
|
293
|
+
## π Major Update: Nexus Login System (2.0.1)
|
|
412
294
|
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
295
|
+
### π Whatβs New?
|
|
296
|
+
- **Nexus Login System**: Fully integrated, advanced, and safe Facebook login system under `/nexloginsystem`.
|
|
297
|
+
- **ID/Password/2FA Login**: Now you can login directly with your Facebook username, password, and 2FA secret key (Google Authenticator supported).
|
|
298
|
+
- **Automatic Appstate Generation**: No need to manually extract cookiesβjust provide credentials and get a fresh, safe appstate automatically.
|
|
299
|
+
- **Seamless Bot Start**: After login, your bot starts instantly with the generated appstateβno manual steps needed.
|
|
300
|
+
- **Ultra-Safe Device Simulation**: Human-like Android device/user-agent simulation for maximum account safety.
|
|
301
|
+
- **Auto-Backup & Validation**: Appstate is auto-backed up and validated for every login.
|
|
302
|
+
- **Advanced Error Handling**: Smart retry, 2FA fallback, and detailed error messages.
|
|
303
|
+
- **Full Documentation**: See `/nexloginsystem/README.md` for usage, API, and safety tips.
|
|
304
|
+
- **Test File Included**: Test your login system easily with `/nexloginsystem/test-login.js`.
|
|
418
305
|
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
case "message":
|
|
427
|
-
if (event.body && event.body.trim().toLowerCase() === "/stop") {
|
|
428
|
-
api.sendMessage("Goodbyeβ¦", event.threadID);
|
|
429
|
-
stopListening();
|
|
430
|
-
return;
|
|
431
|
-
}
|
|
432
|
-
api.sendMessage(`TEST BOT: ${event.body}`, event.threadID);
|
|
433
|
-
break;
|
|
434
|
-
|
|
435
|
-
case "event":
|
|
436
|
-
console.log("Event Received:", event);
|
|
437
|
-
break;
|
|
438
|
-
}
|
|
439
|
-
});
|
|
306
|
+
### β‘ Example Usage
|
|
307
|
+
```js
|
|
308
|
+
const { nexusLogin } = require('./nexloginsystem');
|
|
309
|
+
const result = await nexusLogin({
|
|
310
|
+
username: 'your_email@gmail.com',
|
|
311
|
+
password: 'your_password',
|
|
312
|
+
twofactor: 'YOUR_2FA_SECRET_KEY'
|
|
440
313
|
});
|
|
441
|
-
|
|
314
|
+
if (result.success) {
|
|
315
|
+
// Bot is ready! API available immediately
|
|
316
|
+
result.api.sendMessage('Hello World!', result.api.getCurrentUserID());
|
|
317
|
+
}
|
|
442
318
|
```
|
|
443
319
|
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
320
|
+
### π Learn More
|
|
321
|
+
- See `/nexloginsystem/README.md` for full API, advanced usage, and safety best practices.
|
|
322
|
+
- For 2FA setup, see the guide in the login system docs.
|
|
447
323
|
|
|
448
|
-
|
|
449
|
-
- **Safe Mode:** Set `NEXUS_FCA_SAFE_MODE=1` in your environment to disable risky features (like avatar/group changes) for extra protection.
|
|
450
|
-
- **Allow/Block List:** Control who can use the API with `NEXUS_FCA_ALLOW_LIST` and `NEXUS_FCA_BLOCK_LIST` (comma-separated user IDs).
|
|
451
|
-
- **Health Check:** Use `api.healthCheck((err, status) => { ... })` to verify the bot is running and see current safety status.
|
|
324
|
+
---
|