sagor-fca 0.0.6 → 0.0.7

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.
Files changed (234) hide show
  1. package/README.md +20 -223
  2. package/func/checkUpdate.js +16 -0
  3. package/func/logAdapter.js +33 -0
  4. package/func/logger.js +48 -0
  5. package/func/utils.js +5 -0
  6. package/index.d.ts +751 -0
  7. package/index.js +10 -2
  8. package/module/config.js +40 -0
  9. package/module/login.js +134 -0
  10. package/module/loginHelper.js +1296 -0
  11. package/module/options.js +48 -0
  12. package/package.json +57 -68
  13. package/src/api/{addExternalModule.js → action/addExternalModule.js} +9 -8
  14. package/src/api/action/changeAvatar.js +137 -0
  15. package/src/api/action/changeBio.js +75 -0
  16. package/src/api/action/enableAutoSaveAppState.js +73 -0
  17. package/src/api/action/getCurrentUserID.js +7 -0
  18. package/src/api/action/handleFriendRequest.js +57 -0
  19. package/src/api/action/logout.js +76 -0
  20. package/src/api/action/refreshFb_dtsg.js +48 -0
  21. package/src/api/action/setPostReaction.js +106 -0
  22. package/src/api/action/unfriend.js +54 -0
  23. package/src/api/groups/getGroupJoinRequests.js +0 -0
  24. package/src/api/groups/handleGroupJoinRequest.js +0 -0
  25. package/src/api/http/httpGet.js +46 -0
  26. package/src/api/http/httpPost.js +52 -0
  27. package/src/api/http/postFormData.js +47 -0
  28. package/src/api/live/getLiveStreamInfo.js +35 -0
  29. package/src/api/live/reactLiveStream.js +31 -0
  30. package/src/api/marketplace/getMarketplaceItemDetail.js +35 -0
  31. package/src/api/marketplace/getMarketplaceItems.js +30 -0
  32. package/src/api/messaging/addUserToGroup.js +68 -0
  33. package/src/api/messaging/changeAdminStatus.js +126 -0
  34. package/src/api/messaging/changeArchivedStatus.js +55 -0
  35. package/src/api/messaging/changeBlockedStatus.js +48 -0
  36. package/src/api/messaging/changeGroupImage.js +91 -0
  37. package/src/api/messaging/changeNickname.js +70 -0
  38. package/src/api/messaging/changeThreadColor.js +79 -0
  39. package/src/api/messaging/changeThreadEmoji.js +111 -0
  40. package/src/api/messaging/createNewGroup.js +88 -0
  41. package/src/api/messaging/createPoll.js +46 -0
  42. package/src/api/messaging/createThemeAI.js +98 -0
  43. package/src/api/messaging/deleteMessage.js +136 -0
  44. package/src/api/messaging/deleteThread.js +56 -0
  45. package/src/api/messaging/editMessage.js +68 -0
  46. package/src/api/messaging/forwardAttachment.js +57 -0
  47. package/src/api/messaging/getEmojiUrl.js +29 -0
  48. package/src/api/messaging/getFriendsList.js +82 -0
  49. package/src/api/messaging/getMessage.js +829 -0
  50. package/src/api/messaging/getThemePictures.js +62 -0
  51. package/src/api/messaging/handleMessageRequest.js +65 -0
  52. package/src/api/messaging/markAsDelivered.js +57 -0
  53. package/src/api/{markAsRead.js → messaging/markAsRead.js} +19 -26
  54. package/src/api/messaging/markAsReadAll.js +49 -0
  55. package/src/api/messaging/markAsSeen.js +61 -0
  56. package/src/api/messaging/muteThread.js +50 -0
  57. package/src/api/messaging/removeUserFromGroup.js +62 -0
  58. package/src/api/messaging/resolvePhotoUrl.js +43 -0
  59. package/src/api/messaging/scheduler.js +264 -0
  60. package/src/api/messaging/searchForThread.js +53 -0
  61. package/src/api/messaging/sendMessage.js +270 -0
  62. package/src/api/messaging/sendTypingIndicator.js +74 -0
  63. package/src/api/messaging/sendVoiceMessage.js +0 -0
  64. package/src/api/messaging/setMessageReaction.js +90 -0
  65. package/src/api/messaging/setTitle.js +124 -0
  66. package/src/api/messaging/shareContact.js +49 -0
  67. package/src/api/messaging/threadColors.js +128 -0
  68. package/src/api/messaging/unsendMessage.js +81 -0
  69. package/src/api/messaging/uploadAttachment.js +492 -0
  70. package/src/api/privacy/getPrivacySettings.js +32 -0
  71. package/src/api/privacy/setPrivacySettings.js +31 -0
  72. package/src/api/professional/getProfessionalInfo.js +35 -0
  73. package/src/api/professional/toggleProfessionalMode.js +31 -0
  74. package/src/api/reels/getReels.js +30 -0
  75. package/src/api/reels/reactReel.js +31 -0
  76. package/src/api/socket/core/connectMqtt.js +259 -0
  77. package/src/api/socket/core/emitAuth.js +103 -0
  78. package/src/api/socket/core/getSeqID.js +320 -0
  79. package/src/api/socket/core/getTaskResponseData.js +25 -0
  80. package/src/api/socket/core/parseDelta.js +377 -0
  81. package/src/api/socket/detail/buildStream.js +215 -0
  82. package/src/api/socket/detail/constants.js +28 -0
  83. package/src/api/socket/listenMqtt.js +377 -0
  84. package/src/api/socket/middleware/index.js +216 -0
  85. package/src/api/threads/getThreadHistory.js +664 -0
  86. package/src/api/threads/getThreadInfo.js +296 -0
  87. package/src/api/threads/getThreadList.js +293 -0
  88. package/src/api/threads/getThreadPictures.js +78 -0
  89. package/src/api/users/getUserID.js +74 -0
  90. package/src/api/users/getUserInfo.js +402 -0
  91. package/src/api/{getUserInfoV2.js → users/getUserInfoV2.js} +14 -26
  92. package/src/core/sendReqMqtt.js +96 -0
  93. package/src/database/helpers.js +53 -0
  94. package/src/database/models/index.js +76 -44
  95. package/src/database/models/thread.js +22 -3
  96. package/src/database/models/user.js +17 -3
  97. package/src/database/threadData.js +46 -53
  98. package/src/database/userData.js +46 -38
  99. package/src/remote/remoteClient.js +123 -0
  100. package/src/utils/broadcast.js +51 -0
  101. package/src/utils/client.js +10 -0
  102. package/src/utils/constants.js +15 -401
  103. package/src/utils/cookies.js +68 -0
  104. package/src/utils/format/attachment.js +357 -0
  105. package/src/utils/format/cookie.js +9 -0
  106. package/src/utils/format/date.js +50 -0
  107. package/src/utils/format/decode.js +44 -0
  108. package/src/utils/format/delta.js +194 -0
  109. package/src/utils/format/ids.js +64 -0
  110. package/src/utils/format/index.js +64 -0
  111. package/src/utils/format/message.js +88 -0
  112. package/src/utils/format/presence.js +132 -0
  113. package/src/utils/format/readTyp.js +44 -0
  114. package/src/utils/format/thread.js +42 -0
  115. package/src/utils/format/utils.js +141 -0
  116. package/src/utils/headers.js +77 -221
  117. package/src/utils/loginParser/autoLogin.js +125 -0
  118. package/src/utils/loginParser/helpers.js +43 -0
  119. package/src/utils/loginParser/index.js +10 -0
  120. package/src/utils/loginParser/parseAndCheckLogin.js +220 -0
  121. package/src/utils/loginParser/textUtils.js +28 -0
  122. package/src/utils/request/client.js +26 -0
  123. package/src/utils/request/config.js +24 -0
  124. package/src/utils/request/defaults.js +46 -0
  125. package/src/utils/request/helpers.js +46 -0
  126. package/src/utils/request/index.js +17 -0
  127. package/src/utils/request/methods.js +174 -0
  128. package/src/utils/request/proxy.js +21 -0
  129. package/src/utils/request/retry.js +77 -0
  130. package/src/utils/request/sanitize.js +49 -0
  131. package/src/utils/userAgent.js +28 -0
  132. package/examples/login-with-cookies.js +0 -38
  133. package/examples/ping.js +0 -36
  134. package/examples/verify.js +0 -69
  135. package/src/api/addUserToGroup.js +0 -108
  136. package/src/api/changeAdminStatus.js +0 -148
  137. package/src/api/changeArchivedStatus.js +0 -61
  138. package/src/api/changeAvatar.js +0 -103
  139. package/src/api/changeBio.js +0 -69
  140. package/src/api/changeBlockedStatus.js +0 -54
  141. package/src/api/changeGroupImage.js +0 -136
  142. package/src/api/changeThreadColor.js +0 -116
  143. package/src/api/changeThreadEmoji.js +0 -53
  144. package/src/api/comment.js +0 -207
  145. package/src/api/createAITheme.js +0 -129
  146. package/src/api/createNewGroup.js +0 -79
  147. package/src/api/createPoll.js +0 -73
  148. package/src/api/deleteMessage.js +0 -44
  149. package/src/api/deleteThread.js +0 -52
  150. package/src/api/e2ee.js +0 -17
  151. package/src/api/editMessage.js +0 -70
  152. package/src/api/emoji.js +0 -124
  153. package/src/api/fetchThemeData.js +0 -82
  154. package/src/api/follow.js +0 -81
  155. package/src/api/forwardMessage.js +0 -52
  156. package/src/api/friend.js +0 -243
  157. package/src/api/gcmember.js +0 -122
  158. package/src/api/gcname.js +0 -123
  159. package/src/api/gcrule.js +0 -119
  160. package/src/api/getAccess.js +0 -111
  161. package/src/api/getBotInfo.js +0 -88
  162. package/src/api/getBotInitialData.js +0 -43
  163. package/src/api/getFriendsList.js +0 -79
  164. package/src/api/getMessage.js +0 -423
  165. package/src/api/getTheme.js +0 -95
  166. package/src/api/getThemeInfo.js +0 -116
  167. package/src/api/getThreadHistory.js +0 -239
  168. package/src/api/getThreadInfo.js +0 -267
  169. package/src/api/getThreadList.js +0 -232
  170. package/src/api/getThreadPictures.js +0 -58
  171. package/src/api/getUserID.js +0 -117
  172. package/src/api/getUserInfo.js +0 -513
  173. package/src/api/handleMessageRequest.js +0 -50
  174. package/src/api/httpGet.js +0 -63
  175. package/src/api/httpPost.js +0 -89
  176. package/src/api/httpPostFormData.js +0 -69
  177. package/src/api/listenMqtt.js +0 -892
  178. package/src/api/listenSpeed.js +0 -179
  179. package/src/api/logout.js +0 -63
  180. package/src/api/markAsDelivered.js +0 -47
  181. package/src/api/markAsReadAll.js +0 -40
  182. package/src/api/markAsSeen.js +0 -70
  183. package/src/api/mqttDeltaValue.js +0 -278
  184. package/src/api/muteThread.js +0 -45
  185. package/src/api/nickname.js +0 -132
  186. package/src/api/notes.js +0 -163
  187. package/src/api/pinMessage.js +0 -150
  188. package/src/api/produceMetaTheme.js +0 -180
  189. package/src/api/realtime.js +0 -182
  190. package/src/api/removeUserFromGroup.js +0 -117
  191. package/src/api/resolvePhotoUrl.js +0 -58
  192. package/src/api/searchForThread.js +0 -154
  193. package/src/api/sendMessage.js +0 -354
  194. package/src/api/sendMessageMqtt.js +0 -249
  195. package/src/api/sendTypingIndicator.js +0 -48
  196. package/src/api/setMessageReaction.js +0 -27
  197. package/src/api/setMessageReactionMqtt.js +0 -61
  198. package/src/api/setThreadTheme.js +0 -260
  199. package/src/api/setThreadThemeMqtt.js +0 -94
  200. package/src/api/share.js +0 -107
  201. package/src/api/shareContact.js +0 -66
  202. package/src/api/stickers.js +0 -257
  203. package/src/api/story.js +0 -181
  204. package/src/api/theme.js +0 -233
  205. package/src/api/unfriend.js +0 -47
  206. package/src/api/unsendMessage.js +0 -17
  207. package/src/database/appStateBackup.js +0 -189
  208. package/src/engine/client.js +0 -92
  209. package/src/engine/models/buildAPI.js +0 -113
  210. package/src/engine/models/loginHelper.js +0 -487
  211. package/src/engine/models/setOptions.js +0 -88
  212. package/src/security/e2ee.js +0 -109
  213. package/src/types/index.d.ts +0 -498
  214. package/src/utils/antiSuspension.js +0 -516
  215. package/src/utils/auth-helpers.js +0 -149
  216. package/src/utils/autoReLogin.js +0 -233
  217. package/src/utils/axios.js +0 -368
  218. package/src/utils/cache.js +0 -54
  219. package/src/utils/clients.js +0 -279
  220. package/src/utils/formatters/data/formatAttachment.js +0 -370
  221. package/src/utils/formatters/data/formatDelta.js +0 -109
  222. package/src/utils/formatters/index.js +0 -159
  223. package/src/utils/formatters/value/formatCookie.js +0 -91
  224. package/src/utils/formatters/value/formatDate.js +0 -36
  225. package/src/utils/formatters/value/formatID.js +0 -16
  226. package/src/utils/formatters.js +0 -1369
  227. package/src/utils/index.js +0 -153
  228. package/src/utils/monitoring.js +0 -333
  229. package/src/utils/rateLimiter.js +0 -251
  230. package/src/utils/tokenRefresh.js +0 -291
  231. package/src/utils/user-agents.js +0 -238
  232. package/src/utils/validation.js +0 -157
  233. /package/src/{database/models/s → api/feed/commentOnPost.js} +0 -0
  234. /package/src/{engine/models/s → api/feed/getPostInfo.js} +0 -0
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  <div align="center">
4
4
 
5
- **Unofficial Facebook Chat API for Node.js**
5
+ **Unofficial Facebook Chat API for Node.js - The Ultimate Edition**
6
6
 
7
7
  </div>
8
8
 
@@ -52,67 +52,22 @@ If you do not agree with this policy, you are free to fork the repository and ma
52
52
 
53
53
  This **sagor-fca** extends the base functionality with advanced features for a more robust and versatile Facebook automation experience:
54
54
 
55
- **Authentication**
56
- - Cookie array login (`appState`) the safest method for long-running bots
57
- - Email/password login with TOTP/2FA support
58
- - Session fingerprint locking User-Agent, Sec-Ch-Ua, locale, timezone locked per session to prevent detection
59
- - AppState auto-backup and restore on restart
60
-
61
- **Real-time Messaging**
62
- - MQTT and HTTP messaging with automatic protocol fallback
63
- - Send text, attachments, stickers, emoji, mentions, and location
64
- - Message editing, unsend, forward, and delete
65
- - Message reactions via HTTP and MQTT
66
- - Pin/unpin messages, list pinned messages
67
-
68
- **Anti-Suspension System**
69
- - Circuit breaker halts activity after repeated suspension signals, resumes after cooldown
70
- - 60+ suspension signal patterns: checkpoints, spam flags, rate limits, identity verification, policy violations, session expiry, and more
71
- - Adaptive per-thread delay that increases with session volume
72
- - Hourly and daily message volume limits with automatic warning pauses
73
- - Warmup mode for fresh sessions — gradually increases allowed message rate
74
- - Humanized typing simulation before every send
75
- - Randomized request intervals and jitter to avoid periodicity detection
76
- - Session fingerprint locking to maintain consistent browser identity
77
- - PostSafe guard: detects auth failures and checkpoint responses in real-time
78
- - MQTT watchdog: detects stale connections and forces clean reconnect
79
-
80
- **Stability & Reliability**
81
- - MQTT auto-reconnect with exponential backoff and jitter
82
- - Auto re-login using refreshed AppState when session expires
83
- - TokenRefreshManager with randomized intervals to keep sessions alive
84
- - Sliding-window rate limiter with per-endpoint tracking
85
- - SQLite-backed thread and user data cache for fast lookups
86
-
87
- **Thread & Group Management**
88
- - Get thread info, history, pictures, and lists
89
- - Create groups, add/remove members, change admin status
90
- - Update group image, name, color, emoji
91
- - Archive, mute, delete threads
92
- - Create polls, manage notes and rules
93
- - Search threads by name, handle message requests
94
-
95
- **User & Friends**
96
- - Get user info (basic and extended), resolve user IDs
97
- - Get full friends list, send/cancel friend requests, unfriend, block/unblock
98
-
99
- **Social**
100
- - Comment on posts, share posts, follow/unfollow users
101
-
102
- **Themes & Stickers**
103
- - Browse 90+ Messenger themes, apply themes via MQTT
104
- - Generate AI-powered themes with text prompts
105
- - Search stickers, browse packs, add packs, get AI stickers
106
-
107
- **E2EE (Opt-In)**
108
- - Application-layer end-to-end encryption for DMs using X25519 + HKDF + AES-256-GCM
109
-
110
- **Monitoring**
111
- - `api.getHealthStatus()` — MQTT status, token refresh stats, rate limiter metrics
112
- - Built-in `ProductionMonitor` for request/error/performance telemetry
113
-
114
- **Proxy Support**
115
- - Full proxy support via the `proxy` login option
55
+ | Category | Feature | Description |
56
+ | :--- | :--- | :--- |
57
+ | **Core Messenger** | Full Messenger API | Send messages, files, stickers, and more. |
58
+ | | Real-time Events | Listen to messages, reactions, and thread events. |
59
+ | | User Account Support | Works with personal Facebook accounts (not just Pages). |
60
+ | | AppState Support | Save login state to avoid re-authentication. |
61
+ | | MQTT Protocol | Real-time messaging via MQTT. |
62
+ | | TypeScript Support | Includes TypeScript definitions. |
63
+ | **Story Interaction** | `getStories`, `reactStory`, `viewStory` | Friends' stories can be viewed, reacted to, and marked as 'Seen'. |
64
+ | **Group Management** | `getGroupJoinRequests`, `handleGroupJoinRequest` | View and manage pending group join requests. |
65
+ | **Feed Interaction** | `getPostInfo`, `commentOnPost` | Retrieve detailed information about a specific post and comment on it. |
66
+ | **Advanced Messaging** | `sendVoiceMessage` | Send audio files as native voice notes. |
67
+ | **Reels Interaction** | `getReels`, `reactReel` | Fetch and react to Facebook Reels. |
68
+ | **Professional Mode** | `getProfessionalInfo`, `toggleProfessionalMode` | View professional profile information and toggle Professional Mode. |
69
+ | **Security & Anti-Ban** | Request Throttling | Configurable delay between requests to avoid detection. |
70
+ | | User-Agent Rotation | Automatic rotation of User-Agents for each request. |
116
71
 
117
72
  ---
118
73
 
@@ -158,7 +113,7 @@ login({ appState: [] }, (err, api) => {
158
113
  }
159
114
 
160
115
  const yourID = "000000000000000"; // Replace with actual Facebook ID
161
- const msg = "Hello from Sagor-fca! 👋";
116
+ const msg = "Hello from sagor-fca! 👋";
162
117
 
163
118
  api.sendMessage(msg, yourID, (err) => {
164
119
  if (err) console.error("Message Sending Error:", err);
@@ -169,170 +124,12 @@ login({ appState: [] }, (err, api) => {
169
124
 
170
125
  ---
171
126
 
172
- ## Anti-Suspension Configuration
173
-
174
- The anti-suspension system is active by default. You can tune it through login options:
175
-
176
- ```js
177
- login({ appState }, {
178
- autoReconnect: true,
179
- listenEvents: true,
180
- autoMarkRead: true,
181
- simulateTyping: true, // humanized typing delays before send
182
- randomUserAgent: true, // rotate user agent on each session
183
- persona: "desktop", // "desktop" or "android"
184
- maxConcurrentRequests: 5, // max parallel HTTP requests
185
- maxRequestsPerMinute: 50, // sliding-window rate cap
186
- requestCooldownMs: 60000, // per-endpoint cooldown duration
187
- errorCacheTtlMs: 300000 // how long to suppress repeated errors
188
- }, (err, api) => {
189
- if (err) throw err;
190
-
191
- console.log(api.getHealthStatus());
192
- });
193
- ```
127
+ ## 📚 API Reference
194
128
 
195
-
196
- ## API Reference
197
-
198
- ### Authentication
199
- | Method | Description |
200
- |---|---|
201
- | `login(credentials, options, callback)` | Log in and receive the API object |
202
- | `api.logout()` | End the session |
203
- | `api.getAppState()` | Get current session cookies |
204
- | `api.getCurrentUserID()` | Get logged-in user ID |
205
-
206
- ### Messaging
207
- | Method | Description |
208
- |---|---|
209
- | `api.sendMessage(msg, threadID)` | Send (HTTP + MQTT fallback) |
210
- | `api.sendMessageMqtt(msg, threadID)` | Send over MQTT |
211
- | `api.editMessage(text, messageID)` | Edit a message |
212
- | `api.unsendMessage(messageID, threadID)` | Retract a message |
213
- | `api.forwardMessage(messageID, threadID)` | Forward a message |
214
- | `api.deleteMessage(messageIDs)` | Delete locally |
215
- | `api.shareContact(senderID, threadID)` | Share a contact card |
216
-
217
- ### Reactions & Status
218
- | Method | Description |
219
- |---|---|
220
- | `api.setMessageReaction(reaction, messageID)` | React via HTTP |
221
- | `api.setMessageReactionMqtt(reaction, messageID, threadID)` | React via MQTT |
222
- | `api.sendTypingIndicator(isTyping, threadID)` | Show/hide typing |
223
- | `api.markAsRead(threadID)` | Mark thread as read |
224
- | `api.markAsReadAll()` | Mark all threads as read |
225
- | `api.markAsSeen()` | Mark as seen |
226
- | `api.markAsDelivered(threadID, messageID)` | Mark as delivered |
227
-
228
- ### Threads
229
- | Method | Description |
230
- |---|---|
231
- | `api.getThreadInfo(threadID)` | Thread metadata |
232
- | `api.getThreadList(limit, timestamp, tags)` | List threads |
233
- | `api.getThreadHistory(threadID, amount, timestamp)` | Message history |
234
- | `api.getThreadPictures(threadID, offset, limit)` | Thread images |
235
- | `api.searchForThread(name)` | Search by name |
236
- | `api.createNewGroup(participantIDs, name?)` | Create group |
237
- | `api.deleteThread(threadID)` | Delete thread |
238
- | `api.muteThread(threadID, muteSeconds)` | Mute thread |
239
- | `api.changeArchivedStatus(threadID, archive)` | Archive/unarchive |
240
- | `api.pinMessage(action, threadID, messageID?)` | Pin/unpin/list |
241
- | `api.createPoll(title, threadID, options?)` | Create poll |
242
- | `api.handleMessageRequest(threadID, accept)` | Accept/decline |
243
-
244
- ### Group Admin
245
- | Method | Description |
246
- |---|---|
247
- | `api.addUserToGroup(userID, threadID)` | Add member |
248
- | `api.removeUserFromGroup(userID, threadID)` | Remove member |
249
- | `api.changeAdminStatus(threadID, userID, isAdmin)` | Promote/demote |
250
- | `api.changeGroupImage(image, threadID)` | Group photo |
251
- | `api.gcname(name, threadID)` | Rename group |
252
-
253
- ### Users
254
- | Method | Description |
255
- |---|---|
256
- | `api.getUserInfo(id)` | Basic user info |
257
- | `api.getUserInfoV2(id)` | Extended user info |
258
- | `api.getUserID(name)` | Resolve name to ID |
259
- | `api.getFriendsList()` | Friends list |
260
- | `api.getBotInfo()` | Bot account info |
261
-
262
- ### Themes & Customization
263
- | Method | Description |
264
- |---|---|
265
- | `api.getTheme(threadID)` | List available themes |
266
- | `api.getThemeInfo(threadID)` | Current theme |
267
- | `api.setThreadThemeMqtt(threadID, themeID)` | Apply theme |
268
- | `api.createAITheme(prompt)` | AI theme |
269
- | `api.changeThreadColor(color, threadID)` | Thread color |
270
- | `api.changeThreadEmoji(emoji, threadID)` | Thread emoji |
271
- | `api.nickname(nickname, threadID, participantID)` | Set nickname |
272
- | `api.emoji(emoji, threadID)` | Thread emoji shorthand |
273
-
274
- ### Stickers
275
- | Method | Description |
276
- |---|---|
277
- | `api.stickers.search(query)` | Search stickers |
278
- | `api.stickers.listPacks()` | Installed packs |
279
- | `api.stickers.getStorePacks()` | Sticker store |
280
- | `api.stickers.addPack(packID)` | Add pack |
281
- | `api.stickers.getStickersInPack(packID)` | Stickers in pack |
282
- | `api.stickers.getAiStickers(options?)` | AI stickers |
283
-
284
- ### E2EE
285
- | Method | Description |
286
- |---|---|
287
- | `api.e2ee.enable()` | Enable E2EE |
288
- | `api.e2ee.disable()` | Disable E2EE |
289
- | `api.e2ee.getPublicKey()` | Get public key |
290
- | `api.e2ee.setPeerKey(threadID, key)` | Set peer key |
291
- | `api.e2ee.hasPeer(threadID)` | Has peer key |
292
- | `api.e2ee.clearPeerKey(threadID)` | Remove peer key |
293
-
294
- ### Social
295
- | Method | Description |
296
- |---|---|
297
- | `api.comment(msg, postID)` | Comment on post |
298
- | `api.share(postID)` | Share post |
299
- | `api.follow(userID, follow)` | Follow/unfollow |
300
- | `api.unfriend(userID)` | Unfriend |
301
- | `api.changeBlockedStatus(userID, block)` | Block/unblock |
302
-
303
- ### Health
304
- | Method | Description |
305
- |---|---|
306
- | `api.getHealthStatus()` | MQTT, token, rate limiter stats |
129
+ Detailed documentation for each API endpoint, including parameters and return types, can be found within the `src/api` directory of this repository. Key modules include `action`, `messaging`, `threads`, `users`, `stories`, `groups`, `feed`, `reels`, and `professional`.
307
130
 
308
131
  ---
309
132
 
310
- ## Login Options
311
-
312
- | Option | Type | Default | Description |
313
- |---|---|---|---|
314
- | `online` | `boolean` | `true` | Appear online |
315
- | `selfListen` | `boolean` | `false` | Receive own messages |
316
- | `listenEvents` | `boolean` | `true` | Receive thread events |
317
- | `listenTyping` | `boolean` | `false` | Receive typing events |
318
- | `updatePresence` | `boolean` | `false` | Broadcast presence |
319
- | `autoMarkDelivery` | `boolean` | `false` | Auto-mark delivered |
320
- | `autoMarkRead` | `boolean` | `true` | Auto-mark read |
321
- | `autoReconnect` | `boolean` | `true` | MQTT auto-reconnect |
322
- | `simulateTyping` | `boolean` | `true` | Humanized typing delays |
323
- | `randomUserAgent` | `boolean` | `false` | Random User-Agent |
324
- | `persona` | `"desktop"\|"android"` | `"desktop"` | Browser persona |
325
- | `proxy` | `string` | — | Proxy URL |
326
- | `forceLogin` | `boolean` | `false` | Force fresh login |
327
- | `maxConcurrentRequests` | `number` | `5` | Max parallel requests |
328
- | `maxRequestsPerMinute` | `number` | `50` | Rate cap per minute |
329
- | `requestCooldownMs` | `number` | `60000` | Endpoint cooldown |
330
- | `errorCacheTtlMs` | `number` | `300000` | Error suppression TTL |
331
- | `stealthMode` | `boolean` | `false` | Extra stealth headers |
332
-
333
- ---
334
-
335
-
336
133
  ## 💾 AppState Management
337
134
 
338
135
  AppState is crucial for maintaining login sessions without re-authenticating with email/password. It helps prevent frequent logouts and reduces the risk of account flags.
@@ -0,0 +1,16 @@
1
+ const logger = require("./logger");
2
+
3
+ async function _checkAndUpdateVersionImpl() {
4
+ logger("Auto-update is disabled for fca-unofficial-updated to maintain custom fixes.", "info");
5
+ return;
6
+ }
7
+
8
+ function checkAndUpdateVersion(callback) {
9
+ if (typeof callback === "function") {
10
+ _checkAndUpdateVersionImpl().then(() => callback(null)).catch(err => callback(err));
11
+ return;
12
+ }
13
+ return _checkAndUpdateVersionImpl();
14
+ }
15
+
16
+ module.exports = { checkAndUpdateVersion };
@@ -0,0 +1,33 @@
1
+ const logger = require("./logger");
2
+
3
+ function formatArgs(args) {
4
+ const [prefix, msg] = args;
5
+
6
+ // Single argument: log as-is
7
+ if (msg === undefined) {
8
+ if (prefix instanceof Error) {
9
+ return prefix.stack || prefix.message || String(prefix);
10
+ }
11
+ return String(prefix);
12
+ }
13
+
14
+ // Two arguments: mimic npmlog("tag", message)
15
+ const tag = prefix == null ? "" : String(prefix);
16
+ if (msg instanceof Error) {
17
+ const base = msg.message || String(msg);
18
+ return tag ? `${tag}: ${base}` : base;
19
+ }
20
+ const text = msg == null ? "" : String(msg);
21
+ return tag ? `${tag}: ${text}` : text;
22
+ }
23
+
24
+ const log = {
25
+ info: (...args) => logger(formatArgs(args), "info"),
26
+ warn: (...args) => logger(formatArgs(args), "warn"),
27
+ error: (...args) => logger(formatArgs(args), "error"),
28
+ verbose: (...args) => logger(formatArgs(args), "info"),
29
+ silly: (...args) => logger(formatArgs(args), "info")
30
+ };
31
+
32
+ module.exports = log;
33
+
package/func/logger.js ADDED
@@ -0,0 +1,48 @@
1
+ const chalk = require("chalk");
2
+ const gradient = require("gradient-string");
3
+
4
+ const themes = [
5
+ "blue", "dream2", "dream", "fiery", "rainbow", "pastel", "cristal", "red", "aqua", "pink", "retro", "sunlight", "teen", "summer", "flower", "ghost", "hacker"
6
+ ];
7
+
8
+ function buildGradient(name) {
9
+ const t = String(name || "").toLowerCase();
10
+ if (t === "blue") return gradient([{ color: "#1affa3", pos: 0.2 }, { color: "cyan", pos: 0.4 }, { color: "pink", pos: 0.6 }, { color: "cyan", pos: 0.8 }, { color: "#1affa3", pos: 1 }]);
11
+ if (t === "dream2") return gradient("blue", "pink");
12
+ if (t === "dream") return gradient([{ color: "blue", pos: 0.2 }, { color: "pink", pos: 0.3 }, { color: "gold", pos: 0.6 }, { color: "pink", pos: 0.8 }, { color: "blue", pos: 1 }]);
13
+ if (t === "fiery") return gradient("#fc2803", "#fc6f03", "#fcba03");
14
+ if (t === "rainbow") return gradient.rainbow;
15
+ if (t === "pastel") return gradient.pastel;
16
+ if (t === "cristal") return gradient.cristal;
17
+ if (t === "red") return gradient("red", "orange");
18
+ if (t === "aqua") return gradient("#0030ff", "#4e6cf2");
19
+ if (t === "pink") return gradient("#d94fff", "purple");
20
+ if (t === "retro") return gradient.retro;
21
+ if (t === "sunlight") return gradient("orange", "#ffff00", "#ffe600");
22
+ if (t === "teen") return gradient.teen;
23
+ if (t === "summer") return gradient.summer;
24
+ if (t === "flower") return gradient("blue", "purple", "yellow", "#81ff6e");
25
+ if (t === "ghost") return gradient.mind;
26
+ if (t === "hacker") return gradient("#47a127", "#0eed19", "#27f231");
27
+ return gradient("#243aff", "#4687f0", "#5800d4");
28
+ }
29
+
30
+ const themeName = themes[Math.floor(Math.random() * themes.length)];
31
+ const co = buildGradient(themeName);
32
+
33
+ module.exports = (text, type) => {
34
+ const s = String(type || "info").toLowerCase();
35
+ if (s === "warn") {
36
+ process.stderr.write(co(`\r[ FCA-WARN ] > ${text}`) + "\n");
37
+ return;
38
+ }
39
+ if (s === "error") {
40
+ process.stderr.write(chalk.bold.hex("#ff0000")(`\r[ FCA-ERROR ]`) + ` > ${text}\n`);
41
+ return;
42
+ }
43
+ if (s === "info") {
44
+ process.stderr.write(chalk.bold(co(`\r[ FCA-SAGOR ] > ${text}`)) + "\n");
45
+ return;
46
+ }
47
+ process.stderr.write(chalk.bold(co(`\r[ ${s.toUpperCase()} ] > ${text}`)) + "\n");
48
+ };
package/func/utils.js ADDED
@@ -0,0 +1,5 @@
1
+ module.exports = {
2
+ sleep: function(ms) {
3
+ return new Promise(resolve => setTimeout(resolve, ms));
4
+ }
5
+ };