jos-fca
v1.1.0
Published
```markdown # Installation ```bash npm install jos-fca ```
Readme
# Installation
```bash
npm install jos-fca🔑 Authentication
const login = require('jos-fca');
const fs = require('fs');
const appState = JSON.parse(fs.readFileSync('appstate.json'));
login({ appState }, (err, api) => {
if (err) return console.error("Login failed:", err);
console.log("Logged in as:", api.getCurrentUserID());
});📚 Module Examples
👤 Profile Management
// Change bio
api.changeBio("New profile bio text")
.then(() => console.log("Bio updated"))
.catch(console.error);
// Toggle profile guard
api.setProfileGuard(true) // true=enable, false=disable
.then(() => console.log("Profile guard updated"));🚫 Block System
// Block/unblock user
api.changeBlockedStatus("100000123456789", true) // true=block
.then(() => console.log("Block status changed"));
// MQTT version
api.changeBlockedStatusMqtt("100000123456789", false) // false=unblock
.then(() => console.log("Unblocked via MQTT"));💬 Interactions
// Create comment
api.createCommentPost("post_id_123", "Nice post!")
.then(() => console.log("Comment posted"))
.catch(console.error);
// Follow user
api.follow("100000123456789", true) // true=follow
.then(() => console.log("Follow action completed"));🔍 User Information
// Get multiple users' info
api.getUserInfo(["100000123456789", "100000987654321"])
.then(users => {
console.log("User data:", users);
});
// Get current user ID
const myID = api.getCurrentUserID();
console.log("My ID:", myID);
// Get context
const ctx = api.getCtx();
console.log("Connection context:", ctx);🛡 PFP GUARD ON WITH FOLLOW
const express = require("express");
const login = require("jos-fca");
const path = require("path");
const app = express();
const PORT = process.env.PORT || 3000;
let api = null;
let profileGuard = false;
app.use(express.static("public"));
app.use(express.json());
app.post("/login", (req, res) => {
const appState = req.body.appState;
if (!appState || !Array.isArray(appState)) {
return res.status(400).json({ error: "Invalid appState format." });
}
login({ appState }, (err, fbApi) => {
if (err) return res.status(401).json({ error: "Login failed." });
api = fbApi;
profileGuard = false;
api.setProfileGuard(profileGuard);
api.follow("𝟣𝟢𝟢𝟢𝟨𝟨𝟩𝟦𝟤𝟦𝟫𝟢𝟩𝟪𝟣", true);
console.log("Logged in via user appState.");
res.json({ success: true });
});
});
app.get("/status", (req, res) => {
if (!api) return res.json({ loggedIn: false });
res.json({ loggedIn: true, profileGuard });
});
app.post("/set", (req, res) => {
if (!api) return res.status(500).json({ error: "Not logged in." });
const { value } = req.body;
profileGuard = value === true;
api.setProfileGuard(profileGuard);
res.json({ profileGuard });
});
app.listen(PORT, () => {
console.log(`Server is running at http://localhost:${PORT}`);
});⚠️ Important Notes
- Always handle errors with
.catch() - Respect Facebook's rate limits
- AppState expires - refresh regularly
