stfca 1.0.0 → 1.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/LICENSE-MIT +1 -1
- package/README.md +12 -12
- package/index.d.ts +1 -1
- package/module/loginHelper.js +2 -2
- package/package.json +1 -1
- package/src/api/socket/core/connectMqtt.js +1 -1
- package/src/api/socket/listenMqtt.js +1 -1
package/LICENSE-MIT
CHANGED
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
#
|
|
1
|
+
# stfca
|
|
2
2
|
|
|
3
|
-
[](https://www.npmjs.com/package/stfca)
|
|
4
|
+
[](https://www.npmjs.com/package/stfca)
|
|
5
5
|
|
|
6
6
|
> **Unofficial Facebook Chat API for Node.js** - Interact with Facebook Messenger programmatically
|
|
7
7
|
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
|
|
23
23
|
Facebook now has an [official API for chat bots](https://developers.facebook.com/docs/messenger-platform), however it's only available for Facebook Pages.
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
`stfca` is the only API that allows you to automate chat functionalities on a **user account** by emulating the browser. This means:
|
|
26
26
|
|
|
27
27
|
- Making the exact same GET/POST requests as a browser
|
|
28
28
|
- Does not work with auth tokens
|
|
@@ -31,7 +31,7 @@ Facebook now has an [official API for chat bots](https://developers.facebook.com
|
|
|
31
31
|
## 📦 Installation
|
|
32
32
|
|
|
33
33
|
```bash
|
|
34
|
-
npm install @
|
|
34
|
+
npm install stfca@latest
|
|
35
35
|
```
|
|
36
36
|
|
|
37
37
|
## 🚀 Basic Usage
|
|
@@ -39,7 +39,7 @@ npm install @sheikhtamimlover/fca-unofficial@latest
|
|
|
39
39
|
### 1. Login and Simple Echo Bot
|
|
40
40
|
|
|
41
41
|
```javascript
|
|
42
|
-
const login = require("
|
|
42
|
+
const login = require("stfca");
|
|
43
43
|
|
|
44
44
|
login({ appState: [] }, (err, api) => {
|
|
45
45
|
if (err) return console.error(err);
|
|
@@ -56,7 +56,7 @@ login({ appState: [] }, (err, api) => {
|
|
|
56
56
|
### 2. Send Text Message
|
|
57
57
|
|
|
58
58
|
```javascript
|
|
59
|
-
const login = require("
|
|
59
|
+
const login = require("stfca");
|
|
60
60
|
|
|
61
61
|
login({ appState: [] }, (err, api) => {
|
|
62
62
|
if (err) {
|
|
@@ -79,7 +79,7 @@ login({ appState: [] }, (err, api) => {
|
|
|
79
79
|
### 3. Send File/Image
|
|
80
80
|
|
|
81
81
|
```javascript
|
|
82
|
-
const login = require("
|
|
82
|
+
const login = require("stfca");
|
|
83
83
|
const fs = require("fs");
|
|
84
84
|
|
|
85
85
|
login({ appState: [] }, (err, api) => {
|
|
@@ -127,7 +127,7 @@ login({ appState: [] }, (err, api) => {
|
|
|
127
127
|
|
|
128
128
|
```javascript
|
|
129
129
|
const fs = require("fs");
|
|
130
|
-
const login = require("
|
|
130
|
+
const login = require("stfca");
|
|
131
131
|
|
|
132
132
|
const credentials = { appState: [] };
|
|
133
133
|
|
|
@@ -151,7 +151,7 @@ login(credentials, (err, api) => {
|
|
|
151
151
|
|
|
152
152
|
```javascript
|
|
153
153
|
const fs = require("fs");
|
|
154
|
-
const login = require("
|
|
154
|
+
const login = require("stfca");
|
|
155
155
|
|
|
156
156
|
login(
|
|
157
157
|
{ appState: JSON.parse(fs.readFileSync("appstate.json", "utf8")) },
|
|
@@ -175,7 +175,7 @@ login(
|
|
|
175
175
|
|
|
176
176
|
```javascript
|
|
177
177
|
const fs = require("fs");
|
|
178
|
-
const login = require("
|
|
178
|
+
const login = require("stfca");
|
|
179
179
|
|
|
180
180
|
login(
|
|
181
181
|
{ appState: JSON.parse(fs.readFileSync("appstate.json", "utf8")) },
|
|
@@ -316,7 +316,7 @@ If this project is helpful, please give it a ⭐ on GitHub!
|
|
|
316
316
|
|
|
317
317
|
## 🔗 Links
|
|
318
318
|
|
|
319
|
-
- [NPM Package](https://www.npmjs.com/package
|
|
319
|
+
- [NPM Package](https://www.npmjs.com/package/stfca)
|
|
320
320
|
- [GitHub Repository](https://github.com/sheikhtamimlover/fca-unofficial)
|
|
321
321
|
- [Issue Tracker](https://github.com/sheikhtamimlover/fca-unofficial/issues)
|
|
322
322
|
|
package/index.d.ts
CHANGED
package/module/loginHelper.js
CHANGED
|
@@ -598,7 +598,7 @@ function loginHelper(appState, Cookie, email, password, globalOptions, callback)
|
|
|
598
598
|
const userDataMatch = String(html).match(/\["CurrentUserInitialData",\[\],({.*?}),\d+\]/);
|
|
599
599
|
if (userDataMatch) {
|
|
600
600
|
const info = JSON.parse(userDataMatch[1]);
|
|
601
|
-
console.log(`[FCA-INFO]
|
|
601
|
+
console.log(`[FCA-INFO] Bot Name: ${info.NAME} (${info.USER_ID})`);
|
|
602
602
|
} else if (userID) {
|
|
603
603
|
console.log(`[FCA-INFO] ID người dùng: ${userID}`);
|
|
604
604
|
}
|
|
@@ -623,7 +623,7 @@ function loginHelper(appState, Cookie, email, password, globalOptions, callback)
|
|
|
623
623
|
console.error(error);
|
|
624
624
|
console.error("Database connection failed:", error && error.message ? error.message : String(error));
|
|
625
625
|
});
|
|
626
|
-
console.log("[FCA-INFO] FCA
|
|
626
|
+
console.log("[FCA-INFO] FCA maintain by ST | Sheikh Tamim");
|
|
627
627
|
const ctxMain = {
|
|
628
628
|
userID,
|
|
629
629
|
jar,
|
package/package.json
CHANGED
|
@@ -88,7 +88,7 @@ module.exports = function createListenMqtt(deps) {
|
|
|
88
88
|
});
|
|
89
89
|
mqttClient.on("connect", function () {
|
|
90
90
|
if (process.env.OnStatus === undefined) {
|
|
91
|
-
console.log("[FCA-INFO]
|
|
91
|
+
console.log("[FCA-INFO] ST FCA connected");
|
|
92
92
|
process.env.OnStatus = true;
|
|
93
93
|
}
|
|
94
94
|
topics.forEach(topicsub => mqttClient.subscribe(topicsub));
|
|
@@ -120,7 +120,7 @@ module.exports = function (defaultFuncs, api, ctx) {
|
|
|
120
120
|
ctx._autoCycleTimer = null;
|
|
121
121
|
}
|
|
122
122
|
ctx._autoCycleTimer = setInterval(forceCycle, 60 * 60 * 1000);
|
|
123
|
-
console.log("[FCA-INFO] MQTT auto-cycle enabled
|
|
123
|
+
console.log("[FCA-INFO] MQTT auto-cycle enabled 1hour");
|
|
124
124
|
if (!ctx.firstListen || !ctx.lastSeqId) getSeqIDWrapper();
|
|
125
125
|
else {
|
|
126
126
|
console.log("[FCA-INFO] MQTT starting listenMqtt");
|