sagor-fca 0.0.6 → 0.0.8

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 (239) hide show
  1. package/README.md +19 -222
  2. package/func/checkUpdate.js +13 -0
  3. package/func/logAdapter.js +30 -0
  4. package/func/logger.js +66 -0
  5. package/func/utils.js +5 -0
  6. package/index.d.ts +751 -0
  7. package/index.js +17 -2
  8. package/module/config.js +38 -0
  9. package/module/login.js +111 -0
  10. package/module/loginHelper.js +1296 -0
  11. package/module/options.js +37 -0
  12. package/package.json +57 -68
  13. package/src/api/action/addExternalModule.js +19 -0
  14. package/src/api/action/changeAvatar.js +137 -0
  15. package/src/api/action/changeBio.js +48 -0
  16. package/src/api/action/enableAutoSaveAppState.js +72 -0
  17. package/src/api/action/getCurrentUserID.js +11 -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 +62 -0
  21. package/src/api/action/setPostReaction.js +106 -0
  22. package/src/api/action/unfriend.js +54 -0
  23. package/src/api/feed/commentOnPost.js +120 -0
  24. package/src/api/feed/getPostInfo.js +98 -0
  25. package/src/api/groups/getGroupJoinRequests.js +126 -0
  26. package/src/api/groups/handleGroupJoinRequest.js +134 -0
  27. package/src/api/http/httpGet.js +27 -0
  28. package/src/api/http/httpPost.js +31 -0
  29. package/src/api/http/postFormData.js +22 -0
  30. package/src/api/live/getLiveStreamInfo.js +35 -0
  31. package/src/api/live/reactLiveStream.js +31 -0
  32. package/src/api/marketplace/getMarketplaceItemDetail.js +35 -0
  33. package/src/api/marketplace/getMarketplaceItems.js +30 -0
  34. package/src/api/messaging/addUserToGroup.js +68 -0
  35. package/src/api/messaging/changeAdminStatus.js +126 -0
  36. package/src/api/messaging/changeArchivedStatus.js +55 -0
  37. package/src/api/messaging/changeBlockedStatus.js +48 -0
  38. package/src/api/messaging/changeGroupImage.js +91 -0
  39. package/src/api/messaging/changeNickname.js +70 -0
  40. package/src/api/messaging/changeThreadColor.js +79 -0
  41. package/src/api/messaging/changeThreadEmoji.js +111 -0
  42. package/src/api/messaging/createNewGroup.js +88 -0
  43. package/src/api/messaging/createPoll.js +46 -0
  44. package/src/api/messaging/createThemeAI.js +98 -0
  45. package/src/api/messaging/deleteMessage.js +136 -0
  46. package/src/api/messaging/deleteThread.js +56 -0
  47. package/src/api/messaging/editMessage.js +68 -0
  48. package/src/api/messaging/forwardAttachment.js +57 -0
  49. package/src/api/messaging/getEmojiUrl.js +29 -0
  50. package/src/api/messaging/getFriendsList.js +82 -0
  51. package/src/api/messaging/getMessage.js +829 -0
  52. package/src/api/messaging/getThemePictures.js +62 -0
  53. package/src/api/messaging/handleMessageRequest.js +65 -0
  54. package/src/api/messaging/markAsDelivered.js +57 -0
  55. package/src/api/{markAsRead.js → messaging/markAsRead.js} +19 -26
  56. package/src/api/messaging/markAsReadAll.js +49 -0
  57. package/src/api/messaging/markAsSeen.js +61 -0
  58. package/src/api/messaging/muteThread.js +50 -0
  59. package/src/api/messaging/notes.js +98 -0
  60. package/src/api/messaging/removeUserFromGroup.js +62 -0
  61. package/src/api/messaging/resolvePhotoUrl.js +43 -0
  62. package/src/api/messaging/scheduler.js +264 -0
  63. package/src/api/messaging/searchForThread.js +53 -0
  64. package/src/api/messaging/sendMessage.js +270 -0
  65. package/src/api/messaging/sendTypingIndicator.js +74 -0
  66. package/src/api/messaging/setMessageReaction.js +90 -0
  67. package/src/api/messaging/setTitle.js +124 -0
  68. package/src/api/messaging/shareContact.js +49 -0
  69. package/src/api/messaging/threadColors.js +128 -0
  70. package/src/api/messaging/unsendMessage.js +81 -0
  71. package/src/api/messaging/uploadAttachment.js +492 -0
  72. package/src/api/privacy/getPrivacySettings.js +32 -0
  73. package/src/api/privacy/setPrivacySettings.js +31 -0
  74. package/src/api/professional/getProfessionalInfo.js +35 -0
  75. package/src/api/professional/toggleProfessionalMode.js +31 -0
  76. package/src/api/reels/getReels.js +30 -0
  77. package/src/api/reels/reactReel.js +31 -0
  78. package/src/api/socket/core/connectMqtt.js +265 -0
  79. package/src/api/socket/core/emitAuth.js +79 -0
  80. package/src/api/socket/core/getSeqID.js +168 -0
  81. package/src/api/socket/core/getTaskResponseData.js +27 -0
  82. package/src/api/socket/core/parseDelta.js +377 -0
  83. package/src/api/socket/detail/buildStream.js +215 -0
  84. package/src/api/socket/detail/constants.js +29 -0
  85. package/src/api/socket/listenMqtt.js +377 -0
  86. package/src/api/socket/middleware/index.js +80 -0
  87. package/src/api/threads/getThreadHistory.js +664 -0
  88. package/src/api/threads/getThreadInfo.js +296 -0
  89. package/src/api/threads/getThreadList.js +293 -0
  90. package/src/api/threads/getThreadPictures.js +53 -0
  91. package/src/api/users/getUserID.js +48 -0
  92. package/src/api/users/getUserInfo.js +402 -0
  93. package/src/api/{getUserInfoV2.js → users/getUserInfoV2.js} +14 -26
  94. package/src/core/sendReqMqtt.js +69 -0
  95. package/src/database/helpers.js +36 -0
  96. package/src/database/models/index.js +46 -47
  97. package/src/database/models/thread.js +34 -21
  98. package/src/database/models/user.js +30 -23
  99. package/src/database/threadData.js +57 -66
  100. package/src/database/userData.js +50 -52
  101. package/src/remote/remoteClient.js +71 -0
  102. package/src/utils/broadcast.js +61 -0
  103. package/src/utils/client.js +10 -0
  104. package/src/utils/constants.js +35 -391
  105. package/src/utils/cookies.js +73 -0
  106. package/src/utils/format/attachment.js +357 -0
  107. package/src/utils/format/cookie.js +9 -0
  108. package/src/utils/format/date.js +50 -0
  109. package/src/utils/format/decode.js +44 -0
  110. package/src/utils/format/delta.js +194 -0
  111. package/src/utils/format/ids.js +64 -0
  112. package/src/utils/format/index.js +64 -0
  113. package/src/utils/format/message.js +88 -0
  114. package/src/utils/format/presence.js +132 -0
  115. package/src/utils/format/readTyp.js +44 -0
  116. package/src/utils/format/thread.js +42 -0
  117. package/src/utils/format/utils.js +141 -0
  118. package/src/utils/headers.js +79 -220
  119. package/src/utils/loginParser/autoLogin.js +125 -0
  120. package/src/utils/loginParser/helpers.js +43 -0
  121. package/src/utils/loginParser/index.js +10 -0
  122. package/src/utils/loginParser/parseAndCheckLogin.js +220 -0
  123. package/src/utils/loginParser/s +0 -0
  124. package/src/utils/loginParser/textUtils.js +28 -0
  125. package/src/utils/request/client.js +32 -0
  126. package/src/utils/request/config.js +25 -0
  127. package/src/utils/request/defaults.js +40 -0
  128. package/src/utils/request/helpers.js +31 -0
  129. package/src/utils/request/index.js +12 -0
  130. package/src/utils/request/methods.js +92 -0
  131. package/src/utils/request/proxy.js +23 -0
  132. package/src/utils/request/retry.js +87 -0
  133. package/src/utils/request/sanitize.js +41 -0
  134. package/src/utils/sessionKeeper.js +275 -0
  135. package/src/utils/userAgent.js +28 -0
  136. package/examples/login-with-cookies.js +0 -38
  137. package/examples/ping.js +0 -36
  138. package/examples/verify.js +0 -69
  139. package/src/api/addExternalModule.js +0 -24
  140. package/src/api/addUserToGroup.js +0 -108
  141. package/src/api/changeAdminStatus.js +0 -148
  142. package/src/api/changeArchivedStatus.js +0 -61
  143. package/src/api/changeAvatar.js +0 -103
  144. package/src/api/changeBio.js +0 -69
  145. package/src/api/changeBlockedStatus.js +0 -54
  146. package/src/api/changeGroupImage.js +0 -136
  147. package/src/api/changeThreadColor.js +0 -116
  148. package/src/api/changeThreadEmoji.js +0 -53
  149. package/src/api/comment.js +0 -207
  150. package/src/api/createAITheme.js +0 -129
  151. package/src/api/createNewGroup.js +0 -79
  152. package/src/api/createPoll.js +0 -73
  153. package/src/api/deleteMessage.js +0 -44
  154. package/src/api/deleteThread.js +0 -52
  155. package/src/api/e2ee.js +0 -17
  156. package/src/api/editMessage.js +0 -70
  157. package/src/api/emoji.js +0 -124
  158. package/src/api/fetchThemeData.js +0 -82
  159. package/src/api/follow.js +0 -81
  160. package/src/api/forwardMessage.js +0 -52
  161. package/src/api/friend.js +0 -243
  162. package/src/api/gcmember.js +0 -122
  163. package/src/api/gcname.js +0 -123
  164. package/src/api/gcrule.js +0 -119
  165. package/src/api/getAccess.js +0 -111
  166. package/src/api/getBotInfo.js +0 -88
  167. package/src/api/getBotInitialData.js +0 -43
  168. package/src/api/getFriendsList.js +0 -79
  169. package/src/api/getMessage.js +0 -423
  170. package/src/api/getTheme.js +0 -95
  171. package/src/api/getThemeInfo.js +0 -116
  172. package/src/api/getThreadHistory.js +0 -239
  173. package/src/api/getThreadInfo.js +0 -267
  174. package/src/api/getThreadList.js +0 -232
  175. package/src/api/getThreadPictures.js +0 -58
  176. package/src/api/getUserID.js +0 -117
  177. package/src/api/getUserInfo.js +0 -513
  178. package/src/api/handleMessageRequest.js +0 -50
  179. package/src/api/httpGet.js +0 -63
  180. package/src/api/httpPost.js +0 -89
  181. package/src/api/httpPostFormData.js +0 -69
  182. package/src/api/listenMqtt.js +0 -892
  183. package/src/api/listenSpeed.js +0 -179
  184. package/src/api/logout.js +0 -63
  185. package/src/api/markAsDelivered.js +0 -47
  186. package/src/api/markAsReadAll.js +0 -40
  187. package/src/api/markAsSeen.js +0 -70
  188. package/src/api/mqttDeltaValue.js +0 -278
  189. package/src/api/muteThread.js +0 -45
  190. package/src/api/nickname.js +0 -132
  191. package/src/api/notes.js +0 -163
  192. package/src/api/pinMessage.js +0 -150
  193. package/src/api/produceMetaTheme.js +0 -180
  194. package/src/api/realtime.js +0 -182
  195. package/src/api/removeUserFromGroup.js +0 -117
  196. package/src/api/resolvePhotoUrl.js +0 -58
  197. package/src/api/searchForThread.js +0 -154
  198. package/src/api/sendMessage.js +0 -354
  199. package/src/api/sendMessageMqtt.js +0 -249
  200. package/src/api/sendTypingIndicator.js +0 -48
  201. package/src/api/setMessageReaction.js +0 -27
  202. package/src/api/setMessageReactionMqtt.js +0 -61
  203. package/src/api/setThreadTheme.js +0 -260
  204. package/src/api/setThreadThemeMqtt.js +0 -94
  205. package/src/api/share.js +0 -107
  206. package/src/api/shareContact.js +0 -66
  207. package/src/api/stickers.js +0 -257
  208. package/src/api/story.js +0 -181
  209. package/src/api/theme.js +0 -233
  210. package/src/api/unfriend.js +0 -47
  211. package/src/api/unsendMessage.js +0 -17
  212. package/src/database/appStateBackup.js +0 -189
  213. package/src/engine/client.js +0 -92
  214. package/src/engine/models/buildAPI.js +0 -113
  215. package/src/engine/models/loginHelper.js +0 -487
  216. package/src/engine/models/setOptions.js +0 -88
  217. package/src/security/e2ee.js +0 -109
  218. package/src/types/index.d.ts +0 -498
  219. package/src/utils/antiSuspension.js +0 -516
  220. package/src/utils/auth-helpers.js +0 -149
  221. package/src/utils/autoReLogin.js +0 -233
  222. package/src/utils/axios.js +0 -368
  223. package/src/utils/cache.js +0 -54
  224. package/src/utils/clients.js +0 -279
  225. package/src/utils/formatters/data/formatAttachment.js +0 -370
  226. package/src/utils/formatters/data/formatDelta.js +0 -109
  227. package/src/utils/formatters/index.js +0 -159
  228. package/src/utils/formatters/value/formatCookie.js +0 -91
  229. package/src/utils/formatters/value/formatDate.js +0 -36
  230. package/src/utils/formatters/value/formatID.js +0 -16
  231. package/src/utils/formatters.js +0 -1369
  232. package/src/utils/index.js +0 -153
  233. package/src/utils/monitoring.js +0 -333
  234. package/src/utils/rateLimiter.js +0 -251
  235. package/src/utils/tokenRefresh.js +0 -291
  236. package/src/utils/user-agents.js +0 -238
  237. package/src/utils/validation.js +0 -157
  238. /package/src/{database/models/s → api/messaging/sendVoiceMessage.js} +0 -0
  239. /package/src/{engine/models → utils/format}/s +0 -0
package/README.md CHANGED
@@ -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 I'm SaGor bot👋";
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,13 @@
1
+ // ============================================================
2
+ // SAGOR-FCA v2.0 — Check Update (Suspended)
3
+ // © 2025 Sagor. All Rights Reserved.
4
+ // autoUpdate Disabled — Does not slow down takeoff Render
5
+ // ============================================================
6
+ "use strict";
7
+
8
+ async function checkAndUpdateVersion() {
9
+ // ✅ Permanently disabled — does not check for updates
10
+ return Promise.resolve();
11
+ }
12
+
13
+ module.exports = { checkAndUpdateVersion };
@@ -0,0 +1,30 @@
1
+ // ============================================================
2
+ // SAGOR-FCA v2.0 — Log Adapter
3
+ // © 2025 Sagor. All Rights Reserved.
4
+ // ============================================================
5
+ "use strict";
6
+
7
+ const logger = require("./logger");
8
+
9
+ function formatArgs(args) {
10
+ const [prefix, msg] = args;
11
+ if (msg === undefined) {
12
+ if (prefix instanceof Error) return prefix.stack || prefix.message || String(prefix);
13
+ return String(prefix ?? "");
14
+ }
15
+ const tag = prefix == null ? "" : String(prefix);
16
+ const text = msg instanceof Error
17
+ ? (msg.message || String(msg))
18
+ : (msg == null ? "" : String(msg));
19
+ return tag ? `${tag}: ${text}` : text;
20
+ }
21
+
22
+ const log = {
23
+ info: (...args) => logger(formatArgs(args), "info"),
24
+ warn: (...args) => logger(formatArgs(args), "warn"),
25
+ error: (...args) => logger(formatArgs(args), "error"),
26
+ verbose: (...args) => logger(formatArgs(args), "info"),
27
+ silly: (...args) => logger(formatArgs(args), "info"),
28
+ };
29
+
30
+ module.exports = log;
package/func/logger.js ADDED
@@ -0,0 +1,66 @@
1
+ // ============================================================
2
+ // SAGOR-FCA v2.0 — Logger
3
+ // © 2025 Sagor. All Rights Reserved.
4
+ // All rights reserved to Sagor
5
+ // ============================================================
6
+ "use strict";
7
+
8
+ const chalk = require("chalk");
9
+ const gradient = require("gradient-string");
10
+
11
+ const THEMES = [
12
+ "blue","dream2","dream","fiery","rainbow","pastel",
13
+ "cristal","red","aqua","pink","retro","sunlight",
14
+ "teen","summer","flower","ghost","hacker"
15
+ ];
16
+
17
+ function buildGradient(name) {
18
+ const t = String(name || "").toLowerCase();
19
+ if (t === "blue") return gradient([{color:"#1affa3",pos:.2},{color:"cyan",pos:.4},{color:"pink",pos:.6},{color:"cyan",pos:.8},{color:"#1affa3",pos:1}]);
20
+ if (t === "dream2") return gradient("blue","pink");
21
+ if (t === "dream") return gradient([{color:"blue",pos:.2},{color:"pink",pos:.3},{color:"gold",pos:.6},{color:"pink",pos:.8},{color:"blue",pos:1}]);
22
+ if (t === "fiery") return gradient("#fc2803","#fc6f03","#fcba03");
23
+ if (t === "rainbow") return gradient.rainbow;
24
+ if (t === "pastel") return gradient.pastel;
25
+ if (t === "cristal") return gradient.cristal;
26
+ if (t === "red") return gradient("red","orange");
27
+ if (t === "aqua") return gradient("#0030ff","#4e6cf2");
28
+ if (t === "pink") return gradient("#d94fff","purple");
29
+ if (t === "retro") return gradient.retro;
30
+ if (t === "sunlight") return gradient("orange","#ffff00","#ffe600");
31
+ if (t === "teen") return gradient.teen;
32
+ if (t === "summer") return gradient.summer;
33
+ if (t === "flower") return gradient("blue","purple","yellow","#81ff6e");
34
+ if (t === "ghost") return gradient.mind;
35
+ if (t === "hacker") return gradient("#47a127","#0eed19","#27f231");
36
+ return gradient("#243aff","#4687f0","#5800d4");
37
+ }
38
+
39
+ const themeName = THEMES[Math.floor(Math.random() * THEMES.length)];
40
+ const co = buildGradient(themeName);
41
+
42
+ // ✅ Recording the times for each message facilitates diagnosis.
43
+ function timestamp() {
44
+ return new Date().toLocaleTimeString("en-US", { hour12: false });
45
+ }
46
+
47
+ module.exports = function logger(text, type) {
48
+ const s = String(type || "info").toLowerCase();
49
+ const ts = timestamp();
50
+
51
+ if (s === "warn") {
52
+ process.stderr.write(co(`\r[ SAGOR-WARN ][ ${ts} ] > ${text}`) + "\n");
53
+ return;
54
+ }
55
+ if (s === "error") {
56
+ process.stderr.write(
57
+ chalk.bold.hex("#ff0000")(`\r[ SAGOR-ERROR ][ ${ts} ]`) + ` > ${text}\n`
58
+ );
59
+ return;
60
+ }
61
+ if (s === "info") {
62
+ process.stderr.write(chalk.bold(co(`\r[ SAGOR-FCA ][ ${ts} ] > ${text}`)) + "\n");
63
+ return;
64
+ }
65
+ process.stderr.write(chalk.bold(co(`\r[ ${s.toUpperCase()} ][ ${ts} ] > ${text}`)) + "\n");
66
+ };
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
+ };