sagor-fca 0.0.4 → 0.0.5

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 (221) hide show
  1. package/README.md +223 -0
  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 -479
  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 +46 -17
  13. package/src/{addExternalModule.js → api/action/addExternalModule.js} +8 -8
  14. package/src/{changeAvatar.js → api/action/changeAvatar.js} +34 -33
  15. package/src/{changeBio.js → api/action/changeBio.js} +20 -21
  16. package/src/api/action/enableAutoSaveAppState.js +73 -0
  17. package/src/{getCurrentUserID.js → api/action/getCurrentUserID.js} +1 -1
  18. package/src/api/action/handleFriendRequest.js +57 -0
  19. package/src/{logout.js → api/action/logout.js} +25 -24
  20. package/src/api/action/refreshFb_dtsg.js +48 -0
  21. package/src/{setPostReaction.js → api/action/setPostReaction.js} +24 -30
  22. package/src/{unfriend.js → api/action/unfriend.js} +15 -13
  23. package/src/api/feed/commentOnPost.js +0 -0
  24. package/src/api/feed/getPostInfo.js +0 -0
  25. package/src/api/groups/getGroupJoinRequests.js +0 -0
  26. package/src/api/groups/handleGroupJoinRequest.js +0 -0
  27. package/src/api/http/httpGet.js +46 -0
  28. package/src/api/http/httpPost.js +52 -0
  29. package/src/api/http/postFormData.js +47 -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/{changeBlockedStatus.js → api/messaging/changeBlockedStatus.js} +14 -15
  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/{createNewGroup.js → api/messaging/createNewGroup.js} +25 -25
  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/{deleteThread.js → api/messaging/deleteThread.js} +15 -15
  47. package/src/api/messaging/editMessage.js +68 -0
  48. package/src/api/messaging/forwardAttachment.js +57 -0
  49. package/src/{getEmojiUrl.js → api/messaging/getEmojiUrl.js} +2 -2
  50. package/src/{getFriendsList.js → api/messaging/getFriendsList.js} +17 -18
  51. package/src/{getMessage.js → api/messaging/getMessage.js} +161 -179
  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/messaging/markAsRead.js +88 -0
  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/removeUserFromGroup.js +62 -0
  60. package/src/{resolvePhotoUrl.js → api/messaging/resolvePhotoUrl.js} +12 -14
  61. package/src/api/messaging/scheduler.js +264 -0
  62. package/src/{searchForThread.js → api/messaging/searchForThread.js} +12 -12
  63. package/src/api/messaging/sendMessage.js +270 -0
  64. package/src/api/messaging/sendTypingIndicator.js +74 -0
  65. package/src/api/messaging/sendVoiceMessage.js +0 -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/{threadColors.js → api/messaging/threadColors.js} +2 -5
  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 +259 -0
  79. package/src/api/socket/core/emitAuth.js +103 -0
  80. package/src/api/socket/core/getSeqID.js +320 -0
  81. package/src/api/socket/core/getTaskResponseData.js +25 -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 +28 -0
  85. package/src/api/socket/listenMqtt.js +377 -0
  86. package/src/api/socket/middleware/index.js +216 -0
  87. package/src/{getThreadHistory.js → api/threads/getThreadHistory.js} +117 -133
  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 +78 -0
  91. package/src/api/users/getUserID.js +74 -0
  92. package/src/api/users/getUserInfo.js +402 -0
  93. package/src/api/users/getUserInfoV2.js +134 -0
  94. package/src/core/sendReqMqtt.js +96 -0
  95. package/src/database/helpers.js +53 -0
  96. package/src/database/models/index.js +88 -0
  97. package/src/database/models/thread.js +50 -0
  98. package/src/database/models/user.js +46 -0
  99. package/src/database/threadData.js +94 -0
  100. package/src/database/userData.js +98 -0
  101. package/src/remote/remoteClient.js +123 -0
  102. package/src/utils/broadcast.js +51 -0
  103. package/src/utils/client.js +10 -0
  104. package/src/utils/constants.js +23 -0
  105. package/src/utils/cookies.js +68 -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 +91 -0
  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/textUtils.js +28 -0
  124. package/src/utils/request/client.js +26 -0
  125. package/src/utils/request/config.js +24 -0
  126. package/src/utils/request/defaults.js +46 -0
  127. package/src/utils/request/helpers.js +46 -0
  128. package/src/utils/request/index.js +17 -0
  129. package/src/utils/request/methods.js +174 -0
  130. package/src/utils/request/proxy.js +21 -0
  131. package/src/utils/request/retry.js +77 -0
  132. package/src/utils/request/sanitize.js +49 -0
  133. package/src/utils/userAgent.js +28 -0
  134. package/src/OldMessage.js +0 -329
  135. package/src/Screenshot.js +0 -83
  136. package/src/addUserToGroup.js +0 -115
  137. package/src/changeAdminStatus.js +0 -103
  138. package/src/changeArchivedStatus.js +0 -55
  139. package/src/changeAvatarV2.js +0 -86
  140. package/src/changeAvt.js +0 -85
  141. package/src/changeBlockedStatusMqtt.js +0 -80
  142. package/src/changeCover.js +0 -72
  143. package/src/changeGroupImage.js +0 -135
  144. package/src/changeName.js +0 -79
  145. package/src/changeNickname.js +0 -59
  146. package/src/changeThreadColor.js +0 -65
  147. package/src/changeThreadEmoji.js +0 -55
  148. package/src/changeUsername.js +0 -59
  149. package/src/createCommentPost.js +0 -230
  150. package/src/createPoll.js +0 -71
  151. package/src/createPost.js +0 -276
  152. package/src/data/cache/data.json +0 -4
  153. package/src/data/cache/datahandle.js +0 -21
  154. package/src/data/getThreadInfo.json +0 -1
  155. package/src/deleteMessage.js +0 -56
  156. package/src/editMessage.js +0 -68
  157. package/src/editMessageOld.js +0 -67
  158. package/src/follow.js +0 -74
  159. package/src/forwardAttachment.js +0 -60
  160. package/src/friendList.js +0 -103
  161. package/src/getAccess.js +0 -112
  162. package/src/getAvatarUser.js +0 -78
  163. package/src/getBotInitialData.js +0 -42
  164. package/src/getCtx.js +0 -5
  165. package/src/getOptions.js +0 -5
  166. package/src/getRegion.js +0 -7
  167. package/src/getThreadHistoryDeprecated.js +0 -71
  168. package/src/getThreadInfo.js +0 -232
  169. package/src/getThreadInfoDeprecated.js +0 -56
  170. package/src/getThreadList.js +0 -213
  171. package/src/getThreadListDeprecated.js +0 -46
  172. package/src/getThreadPictures.js +0 -59
  173. package/src/getThreadTheme.js +0 -82
  174. package/src/getUID.js +0 -119
  175. package/src/getUserID.js +0 -61
  176. package/src/getUserInfo.js +0 -66
  177. package/src/handleFriendRequest.js +0 -46
  178. package/src/handleMessageRequest.js +0 -47
  179. package/src/httpGet.js +0 -49
  180. package/src/httpPost.js +0 -48
  181. package/src/httpPostFormData.js +0 -70
  182. package/src/listenMqtt.js +0 -870
  183. package/src/listenNotification.js +0 -85
  184. package/src/markAsDelivered.js +0 -47
  185. package/src/markAsRead.js +0 -70
  186. package/src/markAsReadAll.js +0 -40
  187. package/src/markAsSeen.js +0 -48
  188. package/src/metaTheme.js +0 -190
  189. package/src/muteThread.js +0 -45
  190. package/src/note.js +0 -228
  191. package/src/pinMessage.js +0 -59
  192. package/src/refreshFb_dtsg.js +0 -89
  193. package/src/removeSuspiciousAccount.js +0 -79
  194. package/src/removeUserFromGroup.js +0 -79
  195. package/src/reply.js +0 -442
  196. package/src/searchFriends.js +0 -139
  197. package/src/searchStickers.js +0 -53
  198. package/src/send.js +0 -46
  199. package/src/sendComment.js +0 -159
  200. package/src/sendFriendRequest.js +0 -102
  201. package/src/sendMessage.js +0 -243
  202. package/src/sendMessageMqtt.js +0 -322
  203. package/src/sendTypingIndicator.js +0 -101
  204. package/src/sendTypingIndicatorV2.js +0 -28
  205. package/src/setActiveStatus.js +0 -93
  206. package/src/setMessageReaction.js +0 -122
  207. package/src/setMessageReactionMqtt.js +0 -62
  208. package/src/setProfileGuard.js +0 -44
  209. package/src/setProfileLock.js +0 -98
  210. package/src/setStoryReaction.js +0 -134
  211. package/src/setStorySeen.js +0 -109
  212. package/src/setThreadTheme.js +0 -103
  213. package/src/setTitle.js +0 -90
  214. package/src/shareContact.js +0 -110
  215. package/src/shareLink.js +0 -59
  216. package/src/stopListenMqtt.js +0 -23
  217. package/src/storyManager.js +0 -358
  218. package/src/suggestFriend.js +0 -133
  219. package/src/unsendMessage.js +0 -45
  220. package/src/uploadAttachment.js +0 -93
  221. package/utils.js +0 -2867
package/README.md ADDED
@@ -0,0 +1,223 @@
1
+ # 💬 sagor-fca
2
+
3
+ <div align="center">
4
+
5
+ **Unofficial Facebook Chat API for Node.js - The Ultimate Edition**
6
+
7
+ </div>
8
+
9
+ ---
10
+
11
+ ## 📋 Table of Contents
12
+
13
+ - [⚠️ Disclaimer & Support Policy](#️-disclaimer--support-policy)
14
+ - [✨ Features](#-features)
15
+ - [🚀 Quick Start](#-quick-start)
16
+ - [📚 API Reference](#-api-reference)
17
+ - [💾 AppState Management](#-appstate-management)
18
+ - [🔄 Auto Login](#-auto-login)
19
+ - [🔐 Security & Anti-Ban](#-security--anti-ban)
20
+ - [🤝 Contributing](#-contributing)
21
+ - [📄 License](#-license)
22
+ - [👨‍💻 Author](#-author)
23
+
24
+ ---
25
+
26
+ ## ⚠️ Disclaimer & Support Policy
27
+
28
+ <div align="center">
29
+
30
+ **READ THIS BEFORE USING OR OPENING AN ISSUE.**
31
+
32
+ </div>
33
+
34
+ This repository is provided **"AS IS"** and is entirely open-source. By using this project, you explicitly agree to the following terms:
35
+
36
+ 1. **Use at your own risk:** We are NOT responsible if your account gets banned for spammy activities (sending messages too fast, unsolicited mass messaging, suspicious URLs, or rapid login/logout).
37
+ 2. **No Spoon-Feeding:** This is a tool for developers. If you cannot read source code, navigate directories, or use basic search tools (`Ctrl + Shift + F`), you should not be using this library.
38
+ 3. **No Free Programming Lessons:** The maintainers provide core updates and security patches for the community for free. We do **not** provide free JavaScript/TypeScript tutorials, nor will we tell you exactly which line of code to edit for your specific bot.
39
+ 4. **Custom Features = Paid Service:** Brainpower and time are not free. If you need custom logic, reverse-engineer specific endpoints, or 1-on-1 support for your personal project, **that is a paid service**.
40
+
41
+ If you do not agree with this policy, you are free to fork the repository and maintain it yourself.
42
+
43
+ **Recommendations to minimize ban risks:**
44
+
45
+ - Utilize **AppState** over direct email/password authentication whenever possible.
46
+ - Implement strict **rate limiting** within your bot's operations.
47
+ - Ensure your application adheres to Facebook's platform policies.
48
+
49
+ ---
50
+
51
+ ## ✨ Features
52
+
53
+ This **sagor-fca** extends the base functionality with advanced features for a more robust and versatile Facebook automation experience:
54
+
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. |
71
+
72
+ ---
73
+
74
+ ## 🚀 Quick Start
75
+
76
+ ### Installation
77
+
78
+ To install `sagor-fca`, ensure you have Node.js (version 12.0.0 or higher) installed. Then, use npm:
79
+
80
+ ```bash
81
+ npm install sagor-fca
82
+ ```
83
+
84
+ ### Basic Usage (Echo Bot)
85
+
86
+ Here's a simple example to get started with an echo bot:
87
+
88
+ ```javascript
89
+ const login = require("sagor-fca");
90
+
91
+ login({ appState: [] }, (err, api) => {
92
+ if (err) return console.error(err);
93
+
94
+ api.listenMqtt((err, event) => {
95
+ if (err) return console.error(err);
96
+
97
+ if (event.type === "message") {
98
+ api.sendMessage(event.body, event.threadID);
99
+ }
100
+ });
101
+ });
102
+ ```
103
+
104
+ ### Sending a Text Message
105
+
106
+ ```javascript
107
+ const login = require("sagor-fca");
108
+
109
+ login({ appState: [] }, (err, api) => {
110
+ if (err) {
111
+ console.error("Login Error:", err);
112
+ return;
113
+ }
114
+
115
+ const yourID = "000000000000000"; // Replace with actual Facebook ID
116
+ const msg = "Hello from sagor-fca! 👋";
117
+
118
+ api.sendMessage(msg, yourID, (err) => {
119
+ if (err) console.error("Message Sending Error:", err);
120
+ else console.log("✅ Message sent successfully!");
121
+ });
122
+ });
123
+ ```
124
+
125
+ ---
126
+
127
+ ## 📚 API Reference
128
+
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`.
130
+
131
+ ---
132
+
133
+ ## 💾 AppState Management
134
+
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.
136
+
137
+ ### Saving AppState
138
+
139
+ ```javascript
140
+ const fs = require("fs");
141
+ const login = require("sagor-fca");
142
+
143
+ login({ email: "YOUR_EMAIL", password: "YOUR_PASSWORD" }, (err, api) => {
144
+ if (err) {
145
+ console.error("Login Error:", err);
146
+ return;
147
+ }
148
+
149
+ try {
150
+ const appState = JSON.stringify(api.getAppState(), null, 2);
151
+ fs.writeFileSync("appstate.json", appState);
152
+ console.log("✅ AppState saved successfully!");
153
+ } catch (error) {
154
+ console.error("❌ Error saving AppState:", error);
155
+ }
156
+ });
157
+ ```
158
+
159
+ ### Using Saved AppState
160
+
161
+ ```javascript
162
+ const fs = require("fs");
163
+ const login = require("sagor-fca");
164
+
165
+ login(
166
+ { appState: JSON.parse(fs.readFileSync("appstate.json", "utf8")) },
167
+ (err, api) => {
168
+ if (err) {
169
+ console.error("Login Error:", err);
170
+ return;
171
+ }
172
+
173
+ console.log("✅ Logged in successfully using AppState!");
174
+ // Your bot logic here
175
+ },
176
+ );
177
+ ```
178
+
179
+ ---
180
+
181
+ ## 🔄 Auto Login
182
+
183
+ This library supports automatic re-login if your session expires, ensuring continuous operation of your bot. Configure `fca-config.json` in your project root:
184
+
185
+ ```json
186
+ {
187
+ "autoLogin": true,
188
+ "credentials": {
189
+ "email": "YOUR_EMAIL_OR_PHONE",
190
+ "password": "YOUR_PASSWORD",
191
+ "twofactor": "" // Base32 secret for 2FA, leave empty if not used
192
+ }
193
+ }
194
+ ```
195
+
196
+ If `autoLogin` is `true` and credentials are provided, the library will attempt to re-authenticate if the current session becomes invalid.
197
+
198
+ ---
199
+
200
+ ## 🔐 Security & Anti-Ban
201
+
202
+ To enhance the longevity and stability of your bot, `sagor-fca` includes built-in anti-ban measures:
203
+
204
+ - **Request Throttling:** A default delay of 500ms is introduced between API requests. This can be configured in `src/utils/request/config.js` via `requestThrottlingMs`.
205
+ - **User-Agent Rotation:** The library automatically rotates through a list of up-to-date browser User-Agents (as of March 2026) to mimic legitimate browser traffic, reducing the likelihood of detection and blocking by Facebook.
206
+
207
+ ---
208
+
209
+ ## 🤝 Contributing
210
+
211
+ Contributions are welcome! If you have suggestions for improvements, new features, or bug fixes, please feel free to open an issue or submit a pull request to the repository.
212
+
213
+ ---
214
+
215
+ ## 📄 License
216
+
217
+ This project is open-source and available under the [MIT License](LICENSE).
218
+
219
+ ---
220
+
221
+ ## 👨‍💻 Author
222
+
223
+ Developed and maintained by **SAGOR**.
@@ -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
+ };