### Install FBVibeX via npm Source: https://github.com/haji-mix/fbvibex/blob/main/README.md Installs the FBVibeX library using the npm package manager, making it available for use in your project. ```Bash npm install fbvibex ``` -------------------------------- ### Install Project Dependencies Source: https://github.com/haji-mix/fbvibex/blob/main/README.md Installs all listed dependencies and development dependencies from the `package.json` file, ensuring all required packages are available for the project. ```Bash npm install ``` -------------------------------- ### Install FBVibeX from GitHub (Bleeding Edge) Source: https://github.com/haji-mix/fbvibex/blob/main/README.md Installs the latest development version of FBVibeX directly from its GitHub repository, providing access to the newest features and fixes. ```Bash npm install git+https://github.com/haji-mix/fbvibex.git ``` -------------------------------- ### Create an Echo Bot with fbvibex Source: https://github.com/haji-mix/fbvibex/blob/main/README.md This example demonstrates how to set up an Echo Bot using the fbvibex library. It covers logging in with app state, configuring bot options, and listening for messages to respond with an echo or thread information. The bot requires 'appstate.json' for credentials and uses 'fbvibex' for API interactions and 'fs/promises' for file operations. ```typescript import login from 'fbvibex'; import fs from 'fs/promises'; import type { API, LoginCredentials, LoginOptions } from 'fbvibex'; async function startBot() { const credentials: LoginCredentials = { appState: JSON.parse(await fs.readFile('appstate.json', 'utf8')), // Or use: { email: 'your_email@example.com', password: 'your_password' } }; const options: LoginOptions = { online: true, listenEvents: true, autoMarkRead: true, forceLogin: true, logLevel: 'silent', }; try { const api = await login(credentials, options); console.log('Bot’s live and vibin’! 😎'); // Listen for messages via WebSocket (requires src/listen.js) api.listenMqtt((err: Error | null, event: any) => { if (err) { console.error('Listen error:', err); return; } if (event.type === 'message') { if (event.body.toLowerCase() === 'test') { api.sendMessage(`Echo: ${event.body} πŸ”Š`, event.threadID); } if (event.body.toLowerCase() === '/info') { api.getThreadInfo(event.threadID, (err, info) => { if (err) return console.error('Thread info error:', err); api.sendMessage(`Thread Name: ${info.threadName} 😎`, event.threadID); }); } } }); } catch (error) { console.error('Login error:', error); } } startBot(); ``` ```javascript import login from 'fbvibex'; import fs from 'fs/promises'; async function startBot() { const credentials = { appState: JSON.parse(await fs.readFile('appstate.json', 'utf8')), }; const options = { online: true, listenEvents: true, autoMarkRead: true, forceLogin: true, logLevel: 'silent', }; try { const api = await login(credentials, options); console.log('Bot’s live and vibin’! 😎'); // Listen for messages via WebSocket (requires src/listen.js) api.listenMqtt((err, event) => { if (err) { console.error('Listen error:', err); return; } if (event.type === 'message') { if (event.body.toLowerCase() === 'test') { api.sendMessage(`Echo: ${event.body} πŸ”Š`, event.threadID); } if (event.body.toLowerCase() === '/info') { api.getThreadInfo(event.threadID, (err, info) => { if (err) return console.error('Thread info error:', err); api.sendMessage(`Thread Name: ${info.threadName} 😎`, event.threadID); }); } } }); } catch (error) { console.error('Login error:', error); } } startBot(); ``` -------------------------------- ### FBVibeX Contribution Guidelines Source: https://github.com/haji-mix/fbvibex/blob/main/README.md Provides a step-by-step guide for developers interested in contributing to the FBVibeX project, covering the standard Git workflow for feature development and pull request submission. ```Git 1. Fork the repository. 2. Create a feature branch: git checkout -b feature/epic-feature 3. Submit a pull request with a clear description. ``` -------------------------------- ### Run fbvibex Bot Source: https://github.com/haji-mix/fbvibex/blob/main/README.md These commands show how to execute the fbvibex bot for both JavaScript and TypeScript projects. Ensure you have the necessary npm scripts ('start' for JS, 'start:ts' for TS) configured in your 'package.json'. ```bash npm start ``` ```bash npm run start:ts ``` -------------------------------- ### Configure package.json for ES Modules and Dependencies Source: https://github.com/haji-mix/fbvibex/blob/main/README.md Configures the `package.json` file to enable ES module support, defines start scripts for both JavaScript and TypeScript, and lists all necessary dependencies and development dependencies for an FBVibeX bot project. ```JSON { "name": "fbvibex-bot", "type": "module", "scripts": { "start": "node src/bot.js", "start:ts": "ts-node-esm src/bot.ts" }, "dependencies": { "fbvibex": "^1.0.0", "cheerio": "^1.0.0", "node-cron": "^3.0.3", "npmlog": "^7.0.1" }, "devDependencies": { "@types/node": "^22.7.4", "typescript": "^5.6.2", "ts-node": "^10.9.2" } } ``` -------------------------------- ### Initialize New FBVibeX Project Directory Source: https://github.com/haji-mix/fbvibex/blob/main/README.md Creates a new directory for the FBVibeX bot project and initializes a new Node.js project within it with default settings, preparing it for development. ```Bash mkdir fbvibex-bot cd fbvibex-bot npm init -y ``` -------------------------------- ### fbvibex Core API Reference Source: https://github.com/haji-mix/fbvibex/blob/main/README.md This section provides a detailed reference for the 'fbvibex' library's core 'login' function and the methods available on the returned 'API' object. It includes parameter types, return values, and brief descriptions for each API call, outlining their purpose and required dependencies. ```APIDOC login(credentials, options?): Logs you into FB and returns a dope API object. πŸ”‘ Parameters: credentials: { appState?: Cookie[] | string | { cookies: Cookie[] }, email?: string, password?: string } options?: { online?: boolean, listenEvents?: boolean, forceLogin?: boolean, ... } Returns: Promise ``` ```APIDOC API Methods: setOptions(options): Tunes your bot’s vibe (e.g., online, listenEvents). βš™οΈ getAppState(): Grabs session cookies for later use. πŸ’Ύ getCookie(): Returns cookies as a semicolon-separated string. πŸͺ listen(callback): Catches messages/events in real-time via WebSocket (requires src/listen.js). πŸ“‘ sendMessage(message, threadID, callback?): Drops a message in the chat (requires src/sendMessage.js). βœ‰οΈ getThreadInfo(threadID, callback): Fetches details about a chat thread, like name or members (requires src/getThreadInfo.js). ℹ️ sendTypingIndicator(threadID, state): Shows or hides the typing indicator in a thread (requires src/sendTypingIndicator.js). ⌨️ reactToMessage(messageID, reaction, callback?): Adds a reaction (e.g., πŸ‘) to a message (requires src/reactToMessage.js). 😍 getUserInfo(userIDs, callback): Grabs user details like name or profile (requires src/getUserInfo.js). πŸ‘€ ``` -------------------------------- ### FBVibeX Configuration Options Reference Source: https://github.com/haji-mix/fbvibex/blob/main/README.md Provides a detailed reference for all configurable options in FBVibeX, including their data types, default values, and a brief explanation of their purpose. ```APIDOC Configuration Options: online: Type: boolean Default: true Description: Sets bot online status. listenEvents: Type: boolean Default: true Description: Enables WebSocket event listening. forceLogin: Type: boolean Default: false Description: Forces a fresh login. autoMarkRead: Type: boolean Default: true Description: Auto-marks messages as read. logLevel: Type: string Default: - Description: Sets logging level (e.g., 'silent'). bypassRegion: Type: string Default: - Description: Overrides region (e.g., 'PRN'). ``` -------------------------------- ### FBVibeX API: Login and Session Management Source: https://github.com/haji-mix/fbvibex/blob/main/README.md Explains methods for managing user sessions, including how to log in without direct credentials by utilizing `appState` and how to maintain session longevity by refreshing `fb_dtsg` and saving `appState`. ```APIDOC Login without credentials: Method: Utilize 'c3c-ufc-utility' extension to obtain 'appState' after manual Facebook login. Session persistence: Mechanism: Auto-refresh 'fb_dtsg' token. Action: Save 'appState' using 'api.getAppState()' for future reuse. ``` -------------------------------- ### Configure tsconfig.json for TypeScript Project Source: https://github.com/haji-mix/fbvibex/blob/main/README.md Sets up the TypeScript compiler options for the FBVibeX project, enabling modern ESNext features, Node module resolution, strict type checking, and defining input/output directories for compilation. ```JSON { "compilerOptions": { "target": "ES2022", "module": "ESNext", "moduleResolution": "Node", "esModuleInterop": true, "allowSyntheticDefaultImports": true, "strict": true, "outDir": "./dist", "rootDir": "./src" }, "include": ["src/**/*"] } ``` -------------------------------- ### FBVibeX Feature: TypeScript Support Source: https://github.com/haji-mix/fbvibex/blob/main/README.md Highlights the availability of TypeScript support within FBVibeX, enabled by the `index.d.ts` declaration file, which facilitates type-safe coding practices. ```APIDOC TypeScript support is provided via 'index.d.ts' for type-safe coding. ``` -------------------------------- ### FBVibeX API: Sending Media Attachments Source: https://github.com/haji-mix/fbvibex/blob/main/README.md Describes the capability to send various media attachments, such as images and files, using the `sendMessage` method. Notes the dependency on `src/sendMessage.js` for this functionality. ```APIDOC sendMessage method: Functionality: Supports sending attachments (images, files). Dependency: Requires 'src/sendMessage.js'. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.