fca-shankar-bot 20.2.0 → 20.3.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 (53) hide show
  1. package/.replit +14 -1
  2. package/Extra/Balancer.js +49 -0
  3. package/Extra/ExtraAddons.js +4 -4
  4. package/Extra/ExtraGetThread.js +27 -27
  5. package/Extra/ExtraScreenShot.js +3 -3
  6. package/Extra/ExtraUptimeRobot.js +4 -4
  7. package/Extra/Src/Change_Environment.js +2 -2
  8. package/Extra/Src/Check_Update.js +3 -3
  9. package/Extra/Src/Instant_Update.js +2 -2
  10. package/Extra/Src/Premium.js +7 -7
  11. package/Extra/Src/Release_Memory.js +7 -7
  12. package/Extra/Src/Websocket.js +12 -12
  13. package/Func/ClearCache.js +2 -2
  14. package/LICENSE +21 -0
  15. package/Language/index.json +22 -16
  16. package/Main.js +515 -349
  17. package/README.md +198 -0
  18. package/SECURITY.md +17 -0
  19. package/broadcast.js +44 -0
  20. package/index.js +215 -31
  21. package/logger.js +51 -122
  22. package/package.json +17 -15
  23. package/src/Dev_Horizon_Data.js +2 -2
  24. package/src/editMessage.js +45 -38
  25. package/src/listenMqtt.js +395 -373
  26. package/src/listenMqttV1.js +11 -11
  27. package/src/sendMessage.js +2 -2
  28. package/src/sendMqttMessage.js +51 -251
  29. package/src/setMessageReaction.js +64 -66
  30. package/src/shareContact.js +50 -75
  31. package/src/unsendMessage.js +32 -126
  32. package/src/unsendMqttMessage.js +66 -0
  33. package/test/data/shareAttach.js +146 -0
  34. package/test/data/something.mov +0 -0
  35. package/test/data/test.png +0 -0
  36. package/test/data/test.txt +7 -0
  37. package/test/example-config.json +18 -0
  38. package/test/test-page.js +140 -0
  39. package/test/test.js +385 -0
  40. package/test/testv2.js +3 -0
  41. package/utils.js +50 -11
  42. package/.cache/replit/env/latest +0 -49
  43. package/.cache/replit/env/latest.json +0 -1
  44. package/.cache/replit/modules/nodejs-20.res +0 -1
  45. package/.cache/replit/modules/replit.res +0 -1
  46. package/.cache/replit/modules.stamp +0 -0
  47. package/.cache/replit/toolchain.json +0 -1
  48. package/CountTime.json +0 -1
  49. package/src/followUser.js +0 -171
  50. package/src/getFacebookInfo.js +0 -69
  51. package/src/listenMqtt.jk +0 -732
  52. package/src/postStory.js +0 -122
  53. package/src/refreshFb_dtsg.js +0 -81
package/src/postStory.js DELETED
@@ -1,122 +0,0 @@
1
- "use strict";
2
-
3
- const utils = require("../utils");
4
- const log = require("npmlog");
5
- const fs = require("fs-extra");
6
-
7
- module.exports = function(defaultFuncs, api, ctx) {
8
- /**
9
- * Post story đơn giản chỉ cần truyền vào attachment
10
- * @param {Object} attachment - File attachment (stream/buffer)
11
- * @param {Object} options - Các tùy chọn bổ sung
12
- * @returns {Promise}
13
- */
14
- function postStory(attachment, options = {}) {
15
- return new Promise(async (resolve, reject) => {
16
- try {
17
- // Validate attachment
18
- if (!attachment) {
19
- throw new Error('Attachment is required');
20
- }
21
-
22
- let attachmentData;
23
- if (Buffer.isBuffer(attachment)) {
24
- // Nếu là buffer thì tạo stream từ buffer
25
- attachmentData = attachment;
26
- } else if (typeof attachment === 'string' && fs.existsSync(attachment)) {
27
- // Nếu là đường dẫn file
28
- attachmentData = fs.createReadStream(attachment);
29
- } else if (attachment.readable) {
30
- // Nếu đã là stream
31
- attachmentData = attachment;
32
- } else {
33
- throw new Error('Invalid attachment type');
34
- }
35
-
36
- // Form data cơ bản
37
- const form = {
38
- file: attachmentData,
39
- voice_clip: 'true',
40
- story_status: options.caption || "",
41
- audience: JSON.stringify({
42
- privacy: {
43
- allow: options.allowList || [],
44
- deny: options.denyList || [],
45
- order: options.privacyOrder || [],
46
- base_state: options.privacy || "EVERYONE"
47
- }
48
- })
49
- };
50
-
51
- // Upload attachment lên Facebook
52
- const response = await defaultFuncs
53
- .postFormData("https://upload.facebook.com/ajax/mercury/upload.php", ctx.jar, form)
54
- .then(utils.parseAndCheckLogin(ctx, defaultFuncs));
55
-
56
- if (!response || response.error) {
57
- throw response.error || new Error('Failed to upload attachment');
58
- }
59
-
60
- // Lấy metadata từ response
61
- const metadata = response.payload.metadata[0];
62
-
63
- // Chuẩn bị data cho story
64
- const storyData = {
65
- input: {
66
- message: {
67
- text: options.caption || "",
68
- ranges: []
69
- },
70
- source: options.source || "MOBILE",
71
- audiences: {
72
- stories: [{
73
- "privacy_data": {
74
- "privacy_state": options.privacy || "EVERYONE",
75
- "allow": options.allowList || [],
76
- "deny": options.denyList || []
77
- }
78
- }]
79
- },
80
- attachments: [{
81
- "photo": metadata.photo_id ? {
82
- "id": metadata.photo_id,
83
- "can_viewer_edit": true
84
- } : null,
85
- "video": metadata.video_id ? {
86
- "id": metadata.video_id,
87
- "can_viewer_edit": true
88
- } : null,
89
- }],
90
- actor_id: ctx.userID,
91
- client_mutation_id: ctx.clientMutationId++
92
- }
93
- };
94
-
95
- // Post story
96
- const storyResponse = await defaultFuncs
97
- .post("https://www.facebook.com/api/graphql/", ctx.jar, {
98
- doc_id: "2421899371426364", // Story creation doc_id
99
- variables: JSON.stringify(storyData)
100
- })
101
- .then(utils.parseAndCheckLogin(ctx, defaultFuncs));
102
-
103
- if (!storyResponse || storyResponse.error) {
104
- throw storyResponse.error || new Error('Failed to post story');
105
- }
106
-
107
- resolve({
108
- success: true,
109
- story_id: storyResponse.data?.story_create?.story?.id,
110
- story_url: storyResponse.data?.story_create?.story?.url,
111
- timestamp: Date.now()
112
- });
113
-
114
- } catch (error) {
115
- log.error("postStory", error);
116
- reject(error);
117
- }
118
- });
119
- }
120
-
121
- return postStory;
122
- };
@@ -1,81 +0,0 @@
1
- "use strict";
2
-
3
- const utils = require("../utils");
4
- const log = require("npmlog");
5
-
6
- module.exports = function (defaultFuncs, api, ctx) {
7
- /**
8
- * Refreshes the fb_dtsg and jazoest values.
9
- * @param {Function} callback
10
- * @returns {Promise}
11
- * @description if you don't update the value of fb_dtsg and jazoest for a long time an error "Please try closing and re-opening your browser window" will appear
12
- * @description you should refresh it every 48h or less
13
- */
14
- return function refreshFb_dtsg(obj, callback) {
15
- let resolveFunc = function () { };
16
- let rejectFunc = function () { };
17
- const returnPromise = new Promise(function (resolve, reject) {
18
- resolveFunc = resolve;
19
- rejectFunc = reject;
20
- });
21
-
22
- if (utils.getType(obj) === "Function" || utils.getType(obj) === "AsyncFunction") {
23
- callback = obj;
24
- obj = {};
25
- }
26
-
27
- if (!obj) {
28
- obj = {};
29
- }
30
-
31
- if (utils.getType(obj) !== "Object") {
32
- throw new utils.CustomError("the first parameter must be an object or a callback function");
33
- }
34
-
35
- if (!callback) {
36
- callback = function (err, friendList) {
37
- if (err) {
38
- return rejectFunc(err);
39
- }
40
- resolveFunc(friendList);
41
- };
42
- }
43
-
44
- if (Object.keys(obj).length == 0) {
45
- utils
46
- .get('https://m.facebook.com/', ctx.jar, null, ctx.globalOptions, { noRef: true })
47
- .then(function (resData) {
48
- const html = resData.body;
49
- const fb_dtsg = utils.getFrom(html, 'name="fb_dtsg" value="', '"');
50
- const jazoest = utils.getFrom(html, 'name="jazoest" value="', '"');
51
- if (!fb_dtsg) {
52
- throw new utils.CustomError("Could not find fb_dtsg in HTML after requesting https://www.facebook.com/");
53
- }
54
- ctx.fb_dtsg = fb_dtsg;
55
- ctx.jazoest = jazoest;
56
- callback(null, {
57
- data: {
58
- fb_dtsg: fb_dtsg,
59
- jazoest: jazoest
60
- },
61
- message: "refreshed fb_dtsg and jazoest"
62
- });
63
- })
64
- .catch(function (err) {
65
- log.error("refreshFb_dtsg", err);
66
- return callback(err);
67
- });
68
- }
69
- else {
70
- Object.keys(obj).forEach(function (key) {
71
- ctx[key] = obj[key];
72
- });
73
- callback(null, {
74
- data: obj,
75
- message: "refreshed " + Object.keys(obj).join(", ")
76
- });
77
- }
78
-
79
- return returnPromise;
80
- };
81
- };