fca-priyansh 19.0.0 → 20.0.0

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 (135) hide show
  1. package/.gitlab-ci.yml +22 -0
  2. package/CountTime.json +1 -0
  3. package/Extra/Balancer.js +49 -49
  4. package/Extra/BroadcastSystem.js +1 -0
  5. package/Extra/Bypass/956/index.js +233 -233
  6. package/Extra/Bypass/test/aaaa.json +169 -169
  7. package/Extra/Bypass/test/index.js +187 -187
  8. package/Extra/Database/index.js +468 -468
  9. package/Extra/ExtraAddons.js +82 -82
  10. package/Extra/ExtraFindUID.js +61 -61
  11. package/Extra/ExtraGetThread.js +365 -365
  12. package/Extra/ExtraScreenShot.js +430 -430
  13. package/Extra/ExtraUptimeRobot.js +142 -38
  14. package/Extra/Html/Classic/script.js +118 -118
  15. package/Extra/Html/Classic/style.css +7 -7
  16. package/Extra/Security/Base/Step_1.js +5 -5
  17. package/Extra/Security/Base/Step_2.js +22 -22
  18. package/Extra/Security/Base/Step_3.js +22 -22
  19. package/Extra/Security/Base/index.js +190 -190
  20. package/Extra/Security/Index.js +4 -4
  21. package/Extra/Security/Step_1.js +5 -5
  22. package/Extra/Security/Step_2.js +22 -22
  23. package/Extra/Security/Step_3.js +22 -22
  24. package/Extra/Src/Change_Environment.js +24 -24
  25. package/Extra/Src/Check_Update.js +66 -66
  26. package/Extra/Src/History.js +114 -114
  27. package/Extra/Src/Instant_Update.js +64 -64
  28. package/Extra/Src/Last-Run.js +64 -64
  29. package/Extra/Src/Premium.js +81 -81
  30. package/Extra/Src/Websocket.js +212 -212
  31. package/Extra/Src/uuid.js +137 -137
  32. package/Func/AcceptAgreement.js +31 -31
  33. package/Func/ClearCache.js +64 -64
  34. package/Func/ReportV1.js +54 -54
  35. package/LICENSE +21 -21
  36. package/Language/index.json +228 -228
  37. package/Main.js +1 -1290
  38. package/README.md +198 -198
  39. package/broadcast.js +1 -44
  40. package/errorHandler.js +151 -0
  41. package/index.js +1 -448
  42. package/logger.js +69 -66
  43. package/package.json +99 -98
  44. package/src/Dev_Horizon_Data.js +124 -124
  45. package/src/Dev_getThreadInfoOLD.js +421 -421
  46. package/src/Dev_shareTest2.js +68 -68
  47. package/src/Dev_shareTest3.js +71 -71
  48. package/src/Premium.js +24 -24
  49. package/src/Screenshot.js +82 -82
  50. package/src/addExternalModule.js +16 -16
  51. package/src/addUserToGroup.js +79 -79
  52. package/src/changeAdminStatus.js +79 -79
  53. package/src/changeArchivedStatus.js +41 -41
  54. package/src/changeAvt.js +84 -84
  55. package/src/changeBio.js +65 -65
  56. package/src/changeBlockedStatus.js +36 -36
  57. package/src/changeGroupImage.js +106 -106
  58. package/src/changeNickname.js +45 -45
  59. package/src/changeThreadColor.js +62 -62
  60. package/src/changeThreadEmoji.js +42 -42
  61. package/src/changeThreadTheme.js +263 -0
  62. package/src/comment.js +244 -0
  63. package/src/createNewGroup.js +70 -70
  64. package/src/createPoll.js +60 -60
  65. package/src/deleteMessage.js +45 -45
  66. package/src/deleteThread.js +43 -43
  67. package/src/editMessage.js +71 -53
  68. package/src/follow.js +119 -0
  69. package/src/forwardAttachment.js +48 -48
  70. package/src/friend.js +383 -0
  71. package/src/getAccessToken.js +27 -27
  72. package/src/getCurrentUserID.js +7 -7
  73. package/src/getEmojiUrl.js +27 -27
  74. package/src/getFriendsList.js +73 -73
  75. package/src/getMessage.js +102 -102
  76. package/src/getPendingFriendRequests.js +45 -0
  77. package/src/getThreadHistory.js +537 -537
  78. package/src/getThreadInfo.js +424 -423
  79. package/src/getThreadInfoOLD.js +421 -421
  80. package/src/getThreadList.js +213 -213
  81. package/src/getThreadMain.js +219 -219
  82. package/src/getThreadPictures.js +59 -59
  83. package/src/getUID.js +58 -58
  84. package/src/getUserID.js +62 -62
  85. package/src/getUserInfo.js +112 -112
  86. package/src/getUserInfoMain.js +64 -64
  87. package/src/getUserInfoV2.js +31 -31
  88. package/src/getUserInfoV3.js +62 -62
  89. package/src/getUserInfoV4.js +54 -54
  90. package/src/getUserInfoV5.js +60 -60
  91. package/src/handleFriendRequest.js +46 -46
  92. package/src/handleMessageRequest.js +49 -49
  93. package/src/httpGet.js +49 -49
  94. package/src/httpPost.js +48 -48
  95. package/src/httpPostFormData.js +40 -40
  96. package/src/listenMqtt.js +1 -956
  97. package/src/listenMqttV1.js +832 -846
  98. package/src/logout.js +68 -68
  99. package/src/markAsDelivered.js +48 -48
  100. package/src/markAsRead.js +70 -70
  101. package/src/markAsReadAll.js +42 -42
  102. package/src/markAsSeen.js +51 -51
  103. package/src/muteThread.js +47 -47
  104. package/src/notes.js +279 -0
  105. package/src/removeUserFromGroup.js +49 -49
  106. package/src/resolvePhotoUrl.js +37 -37
  107. package/src/searchForThread.js +43 -43
  108. package/src/sendMention.js +325 -0
  109. package/src/sendMessage.js +1 -386
  110. package/src/sendMqttMessage.js +70 -70
  111. package/src/sendTypingIndicator.js +79 -80
  112. package/src/setMessageReaction.js +109 -109
  113. package/src/setPostReaction.js +101 -101
  114. package/src/setTitle.js +74 -74
  115. package/src/share.js +98 -0
  116. package/src/shareContact.js +55 -55
  117. package/src/shareLink.js +58 -58
  118. package/src/stickers.js +525 -0
  119. package/src/story.js +267 -0
  120. package/src/threadColors.js +38 -38
  121. package/src/unfriend.js +43 -43
  122. package/src/unsendMessage.js +47 -47
  123. package/src/unsendMqttMessage.js +65 -65
  124. package/test/data/shareAttach.js +146 -146
  125. package/test/data/test.txt +7 -7
  126. package/test/example-config.json +18 -18
  127. package/test/test-page.js +140 -140
  128. package/test/test.js +385 -385
  129. package/test/testv2.js +2 -2
  130. package/userAgentManager.js +129 -0
  131. package/utils.js +1 -3077
  132. package/.github/workflows/publish.yml +0 -20
  133. package/Extra/Src/Release_Memory.js +0 -160
  134. package/Extra/Src/test.js +0 -28
  135. package/SECURITY.md +0 -17
@@ -0,0 +1,151 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * Optimized Error Handler for FCA
5
+ * Shows only ONE clear, actionable error message
6
+ */
7
+
8
+ const chalk = require('chalk');
9
+
10
+ function handleLoginError(error, callback) {
11
+ // Determine the specific error type and show only ONE clear message
12
+ let errorMessage = null;
13
+ let errorType = 'unknown';
14
+ let errorString = error ? error.toString() : '';
15
+
16
+ // Check error object properties
17
+ const errorObj = error && typeof error === 'object' ? error : {};
18
+ const fullError = errorString + JSON.stringify(errorObj);
19
+
20
+ // Priority 1: Check for empty appstate
21
+ if (fullError.includes('empty appstate') || fullError.includes('EMPTY_APPSTATE')) {
22
+ errorType = 'empty_appstate';
23
+ errorMessage = chalk.red.bold('\nāŒ APPSTATE FILE IS EMPTY\n\n') +
24
+ chalk.yellow('šŸ“ Solution:\n') +
25
+ ' 1. Your appstate.json file is empty\n' +
26
+ ' 2. Add valid Facebook cookies to the file\n' +
27
+ ' 3. Format should be JSON array: [{"key":"c_user", ...}]\n' +
28
+ ' 4. Use cookie extension to get cookies from facebook.com\n' +
29
+ ' 5. Restart the bot\n';
30
+ }
31
+ // Priority 2: Check for invalid JSON format
32
+ else if (fullError.includes('JSON') && (fullError.includes('parse') || fullError.includes('Unexpected') || fullError.includes('position'))) {
33
+ errorType = 'invalid_json';
34
+ errorMessage = chalk.red.bold('\nāŒ APPSTATE JSON FORMAT IS INVALID\n\n') +
35
+ chalk.yellow('šŸ“ Problem:\n') +
36
+ ' • Your appstate.json has incorrect JSON format\n' +
37
+ ' • There might be syntax errors or missing brackets\n\n' +
38
+ chalk.yellow('šŸ“ Solution:\n') +
39
+ ' 1. Open appstate.json in a text editor\n' +
40
+ ' 2. Check for proper JSON format\n' +
41
+ ' 3. Use online JSON validator (jsonlint.com)\n' +
42
+ ' 4. OR delete file and create fresh appstate.json\n' +
43
+ ' 5. Get new cookies using browser extension\n' +
44
+ ' 6. Restart the bot\n';
45
+ }
46
+ // Priority 3: Check for missing appstate file
47
+ else if (fullError.includes('ENOENT') && (fullError.includes('appstate') || fullError.includes('Cannot find module'))) {
48
+ errorType = 'missing_appstate';
49
+ errorMessage = chalk.red.bold('\nāŒ APPSTATE FILE MISSING\n\n') +
50
+ chalk.yellow('šŸ“ Solution:\n') +
51
+ ' 1. Create appstate.json file in your project root\n' +
52
+ ' 2. Add your Facebook cookies to the file\n' +
53
+ ' 3. Restart the bot\n';
54
+ }
55
+ // Priority 4: Check for runtime session expiration
56
+ else if (fullError.includes('Runtime session expired') ||
57
+ fullError.includes('Cannot read properties of undefined (reading \'uri\')')) {
58
+ errorType = 'runtime_session_expired';
59
+ errorMessage = chalk.red.bold('\nāŒ SESSION EXPIRED DURING RUNTIME\n\n') +
60
+ chalk.yellow('šŸ“ Problem:\n') +
61
+ ' • Your Facebook session expired while bot was running\n' +
62
+ ' • This happens when cookies become invalid after login\n\n' +
63
+ chalk.yellow('šŸ“ Solution:\n') +
64
+ ' 1. Open facebook.com in incognito/private browser\n' +
65
+ ' 2. Login to your Facebook account\n' +
66
+ ' 3. Use cookie extension to get fresh cookies\n' +
67
+ ' 4. Replace appstate.json with new cookies\n' +
68
+ ' 5. Restart the bot\n' +
69
+ ' 6. If problem persists, check Facebook security settings\n';
70
+ }
71
+ // Priority 5: Check for expired/invalid cookies at login
72
+ else if (fullError.includes('ErrAppState') ||
73
+ fullError.includes('Wrong') ||
74
+ fullError.includes('ctx')) {
75
+ errorType = 'expired_cookies';
76
+ errorMessage = chalk.red.bold('\nāŒ APPSTATE COOKIES EXPIRED OR INVALID\n\n') +
77
+ chalk.yellow('šŸ“ Solution:\n') +
78
+ ' 1. Open facebook.com in incognito/private browser\n' +
79
+ ' 2. Login to your Facebook account\n' +
80
+ ' 3. Use cookie extension to get fresh cookies\n' +
81
+ ' 4. Replace appstate.json with new cookies\n' +
82
+ ' 5. Restart the bot\n';
83
+ }
84
+ // Priority 6: Check for 2FA errors
85
+ else if (fullError.includes('2FA') || fullError.includes('TwoAuth') || fullError.includes('approvals')) {
86
+ errorType = '2fa_error';
87
+ errorMessage = chalk.red.bold('\nāŒ TWO-FACTOR AUTHENTICATION ERROR\n\n') +
88
+ chalk.yellow('šŸ“ Solution:\n') +
89
+ ' 1. Make sure you entered correct 2FA code\n' +
90
+ ' 2. Try using authenticator app code\n' +
91
+ ' 3. Check PriyanshFca.json settings for Login2Fa\n';
92
+ }
93
+ // Priority 7: Check for checkpoint errors (excluding automation checkpoint which is auto-handled)
94
+ else if ((fullError.includes('checkpoint') || fullError.includes('CheckPoint')) && !fullError.includes('601051028565049')) {
95
+ errorType = 'checkpoint';
96
+ errorMessage = chalk.red.bold('\nāŒ FACEBOOK CHECKPOINT DETECTED\n\n') +
97
+ chalk.yellow('šŸ“ Solution:\n') +
98
+ ' 1. Open facebook.com in your browser\n' +
99
+ ' 2. Complete any security verification required\n' +
100
+ ' 3. Get NEW cookies after verification\n' +
101
+ ' 4. Update appstate.json\n';
102
+ }
103
+ // Priority 8: Network error
104
+ else if (fullError.includes('ECONNREFUSED') ||
105
+ fullError.includes('ETIMEDOUT') ||
106
+ fullError.includes('ENOTFOUND')) {
107
+ errorType = 'network_error';
108
+ errorMessage = chalk.red.bold('\nāŒ NETWORK CONNECTION ERROR\n\n') +
109
+ chalk.yellow('šŸ“ Solution:\n') +
110
+ ' 1. Check your internet connection\n' +
111
+ ' 2. Try again in a few moments\n' +
112
+ ' 3. Check if Facebook is accessible\n';
113
+ }
114
+ // Priority 9: Invalid account credentials
115
+ else if (fullError.includes('InvaildAccount') || fullError.includes('Wrong Password')) {
116
+ errorType = 'invalid_credentials';
117
+ errorMessage = chalk.red.bold('\nāŒ INVALID ACCOUNT OR PASSWORD\n\n') +
118
+ chalk.yellow('šŸ“ Solution:\n') +
119
+ ' 1. Check your email/phone and password\n' +
120
+ ' 2. Make sure account is not locked\n' +
121
+ ' 3. Use appstate login instead\n';
122
+ }
123
+
124
+ // If we identified the error, show ONLY that one message
125
+ if (errorMessage) {
126
+ console.log('\n' + chalk.gray('='.repeat(60)));
127
+ console.log(errorMessage);
128
+ console.log(chalk.gray('='.repeat(60)) + '\n');
129
+
130
+ // Call callback with simplified error
131
+ if (callback && typeof callback === 'function') {
132
+ callback({ error: errorType, message: errorMessage.replace(/\u001b\[\d+m/g, '') });
133
+ }
134
+
135
+ // Exit cleanly
136
+ process.exit(1);
137
+ } else {
138
+ // Unknown error - show minimal info without stack trace spam
139
+ console.log('\n' + chalk.gray('='.repeat(60)));
140
+ console.log(chalk.red.bold('\nāŒ LOGIN ERROR\n'));
141
+ console.log(chalk.yellow('Error details:'), chalk.white(errorString.substring(0, 200)));
142
+ console.log(chalk.gray('='.repeat(60)) + '\n');
143
+
144
+ if (callback && typeof callback === 'function') {
145
+ callback(error);
146
+ }
147
+ process.exit(1);
148
+ }
149
+ }
150
+
151
+ module.exports = handleLoginError;