fca-zoebakaaa 1.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 (93) hide show
  1. package/.eslintrc.js +35 -0
  2. package/CHANGELOG.md +2 -0
  3. package/Controllers/Remote.js +4 -0
  4. package/DOCS.md +1738 -0
  5. package/Extra/ExtraAddons.js +80 -0
  6. package/Extra/ExtraFindUID.js +62 -0
  7. package/Extra/ExtraGetThread.js +118 -0
  8. package/Extra/ExtraTranslate.js +62 -0
  9. package/Extra/ExtraUptimeRobot.js +62 -0
  10. package/Extra/Html/Classic/script.js +233 -0
  11. package/Extra/Html/Classic/style.css +8 -0
  12. package/Extra/PM2/ecosystem.config.js +23 -0
  13. package/Extra/Security/Index.js +174 -0
  14. package/Extra/Security/Step_1.js +15 -0
  15. package/Extra/Security/Step_2.js +23 -0
  16. package/Extra/Security/Step_3.js +23 -0
  17. package/Extra/Src/History.js +117 -0
  18. package/Extra/Src/Last-Run.js +65 -0
  19. package/Extra/Src/Premium.js +88 -0
  20. package/Extra/Src/SecurityCheck.js +7 -0
  21. package/Extra/database/SyntheticDatabase.sqlite +0 -0
  22. package/Extra/database/index.js +360 -0
  23. package/Extra/logger.js +74 -0
  24. package/Func/AcceptAgreement.js +36 -0
  25. package/Func/ClearCache.js +68 -0
  26. package/Func/ReportV1.js +55 -0
  27. package/README.md +112 -0
  28. package/Settings/Database.js +21 -0
  29. package/Settings/Location.js +59 -0
  30. package/broadcast.js +40 -0
  31. package/index.js +1353 -0
  32. package/logger.js +75 -0
  33. package/package.json +56 -0
  34. package/src/Premium.js +39 -0
  35. package/src/addExternalModule.js +23 -0
  36. package/src/addUserToGroup.js +101 -0
  37. package/src/appstate.json +0 -0
  38. package/src/changeAdminStatus.js +95 -0
  39. package/src/changeArchivedStatus.js +47 -0
  40. package/src/changeAvt.js +95 -0
  41. package/src/changeBio.js +66 -0
  42. package/src/changeBlockedStatus.js +42 -0
  43. package/src/changeGroupImage.js +124 -0
  44. package/src/changeNickname.js +54 -0
  45. package/src/changeThreadColor.js +67 -0
  46. package/src/changeThreadEmoji.js +50 -0
  47. package/src/createNewGroup.js +78 -0
  48. package/src/createPoll.js +66 -0
  49. package/src/deleteMessage.js +51 -0
  50. package/src/deleteThread.js +49 -0
  51. package/src/forwardAttachment.js +53 -0
  52. package/src/getAccessToken.js +36 -0
  53. package/src/getCurrentUserID.js +8 -0
  54. package/src/getEmojiUrl.js +29 -0
  55. package/src/getFriendsList.js +81 -0
  56. package/src/getMessage.js +85 -0
  57. package/src/getThreadHistory.js +633 -0
  58. package/src/getThreadInfo.js +248 -0
  59. package/src/getThreadList.js +276 -0
  60. package/src/getThreadPictures.js +71 -0
  61. package/src/getUID.js +61 -0
  62. package/src/getUserID.js +62 -0
  63. package/src/getUserInfo.js +68 -0
  64. package/src/getUserInfoV2.js +32 -0
  65. package/src/getUserInfoV3.js +72 -0
  66. package/src/getUserInfoV4.js +57 -0
  67. package/src/getUserInfoV5.js +68 -0
  68. package/src/handleFriendRequest.js +47 -0
  69. package/src/handleMessageRequest.js +63 -0
  70. package/src/httpGet.js +54 -0
  71. package/src/httpPost.js +53 -0
  72. package/src/httpPostFormData.js +46 -0
  73. package/src/listenMqtt.js +1056 -0
  74. package/src/logout.js +73 -0
  75. package/src/markAsDelivered.js +54 -0
  76. package/src/markAsRead.js +82 -0
  77. package/src/markAsReadAll.js +47 -0
  78. package/src/markAsSeen.js +58 -0
  79. package/src/muteThread.js +51 -0
  80. package/src/removeUserFromGroup.js +72 -0
  81. package/src/resolvePhotoUrl.js +39 -0
  82. package/src/searchForThread.js +48 -0
  83. package/src/sendMessage.js +429 -0
  84. package/src/sendTypingIndicator.js +83 -0
  85. package/src/setMessageReaction.js +114 -0
  86. package/src/setPostReaction.js +103 -0
  87. package/src/setTitle.js +86 -0
  88. package/src/threadColors.js +40 -0
  89. package/src/toolspincoinmaster +89 -0
  90. package/src/unfriend.js +48 -0
  91. package/src/unsendMessage.js +40 -0
  92. package/utils.js +2244 -0
  93. package/zoebaka.code-workspace +8 -0
package/logger.js ADDED
@@ -0,0 +1,75 @@
1
+ /* eslint-disable linebreak-style */
2
+
3
+ import { bold } from 'chalk';
4
+ function randomColor() {
5
+ var color = "";
6
+ for (var i = 0; i < 3; i++) {
7
+ var sub = Math.floor(Math.random() * 256).toString(16);
8
+ color += (sub.length == 1 ? "0" + sub : sub);
9
+ }
10
+ return "#" + color;
11
+ // eslint-disable-next-line no-extra-semi
12
+ };
13
+ import isHexcolor from 'is-hexcolor';
14
+ var getText = function(/** @type {string[]} */ ...Data) {
15
+ var Main = (Data.splice(0,1)).toString();
16
+ for (let i = 0; i < Data.length; i++) Main = Main.replace(RegExp(`%${i + 1}`, 'g'), Data[i]);
17
+ return Main;
18
+ };
19
+ /**
20
+ * @param {any} obj
21
+ */
22
+ function getType(obj) {
23
+ return Object.prototype.toString.call(obj).slice(8, -1);
24
+ }
25
+
26
+ export function Normal(/** @type {string} */ Str, /** @type {() => any} */ Data, /** @type {() => void} */ Callback) {
27
+ if (isHexcolor(globalThis.Fca.Require.FastConfig.MainColor) != true) {
28
+ // eslint-disable-next-line no-undef
29
+ this.Warning(getText(globalThis.Fca.Require.Language.Index.InvaildMainColor, globalThis.Fca.Require.FastConfig.MainColor), process.exit(0));
30
+ }
31
+
32
+ else
33
+ console.log(bold.hex(randomColor()).bold(`${globalThis.Fca.Require.FastConfig.MainName || '[ FCA-PMD ]'} > ` + Str));
34
+ if (getType(Data) == 'Function' || getType(Data) == 'AsyncFunction') {
35
+ return Data();
36
+ }
37
+ if (Data) {
38
+ return Data;
39
+ }
40
+ if (getType(Callback) == 'Function' || getType(Callback) == 'AsyncFunction') {
41
+ Callback();
42
+ }
43
+ else return Callback;
44
+ }
45
+ export function Warning(/** @type {unknown} */ str, /** @type {() => void} */ callback) {
46
+ console.log(bold.hex(randomColor()).bold('[ FCA-WARNING ] > ' + str));
47
+ if (getType(callback) == 'Function' || getType(callback) == 'AsyncFunction') {
48
+ callback();
49
+ }
50
+ else return callback;
51
+ }
52
+ export function Error(/** @type {unknown} */ str, /** @type {() => void} */ callback) {
53
+ if (!str) {
54
+ console.log(bold.hex(randomColor()).bold('[ FCA-ERROR ] > ' + "Đã xảy ra lỗi, vui lòng liên hệ: facebook.com/dongdev"));
55
+ }
56
+ console.log(bold.hex(randomColor()).bold('[ FCA ] > ' + str));
57
+ if (getType(callback) == 'Function' || getType(callback) == 'AsyncFunction') {
58
+ callback();
59
+ }
60
+ else return callback;
61
+ }
62
+ export function Success(/** @type {unknown} */ str, /** @type {() => void} */ callback) {
63
+ console.log(bold.hex(randomColor()).bold(`${globalThis.Fca.Require.FastConfig.MainName || '[ FCA-PMD ]'} > ` + str));
64
+ if (getType(callback) == 'Function' || getType(callback) == 'AsyncFunction') {
65
+ callback();
66
+ }
67
+ else return callback;
68
+ }
69
+ export function Info(/** @type {unknown} */ str, /** @type {() => void} */ callback) {
70
+ console.log(bold.hex(randomColor()).bold(`${globalThis.Fca.Require.FastConfig.MainName || '[ FCA-PMD ]'} > ` + str));
71
+ if (getType(callback) == 'Function' || getType(callback) == 'AsyncFunction') {
72
+ callback();
73
+ }
74
+ else return callback;
75
+ }
package/package.json ADDED
@@ -0,0 +1,56 @@
1
+ {
2
+ "name": "fca-zoebakaaa",
3
+ "version": "1.0.0",
4
+ "description": "",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "lnpint": "eslint **.js",
8
+ "prettier": "prettier utils.js src/* --write",
9
+ "test": "mocha"
10
+ },
11
+ "keywords": [],
12
+ "author": "",
13
+ "license": "ISC",
14
+ "dependencies": {
15
+ "appstate": "^2.1.2",
16
+ "axios": "^1.6.2",
17
+ "chalk": "^5.3.0",
18
+ "check-ip": "^1.1.1",
19
+ "coin-master-free-spin-link-unlimited": "^1.0.1",
20
+ "ddos": "^0.2.1",
21
+ "docker": "^1.0.0",
22
+ "doss": "^1.0.5",
23
+ "eslint-config": "^0.1.0",
24
+ "express": "^4.18.2",
25
+ "facebook-auto-liker-download": "^1.0.0",
26
+ "facebook-refresh-token": "^1.0.0",
27
+ "fb-autologin-vue": "^0.0.5",
28
+ "fca-zoebakaa": "^1.0.0",
29
+ "form-data": "^4.0.0",
30
+ "fs-extra": "^11.2.0",
31
+ "glob-parent": "^6.0.2",
32
+ "language": "^0.4.0",
33
+ "latest-coin-master-tool-working": "^6.0.2",
34
+ "login": "^0.8.0",
35
+ "npm": "^5.6.0",
36
+ "passport-facebook-token": "^4.0.0",
37
+ "premium": "^3.0.0",
38
+ "shelljs": "^0.8.4",
39
+ "test": "^3.3.0",
40
+ "tool": "^21.0.0",
41
+ "until": "^0.1.1",
42
+ "uptime-robot": "^1.3.0",
43
+ "url-regex": "^5.0.0",
44
+ "yargs-parser": "^13.1.1",
45
+ "zoe-data": "^0.6.0-rc.7",
46
+ "zoebaka": "^1.0.0"
47
+ },
48
+ "devDependencies": {
49
+ "@typescript-eslint/eslint-plugin": "^6.14.0",
50
+ "@typescript-eslint/parser": "^6.14.0",
51
+ "eslint": "^8.55.0",
52
+ "eslint-plugin-react": "^7.33.2",
53
+ "mocha": "^10.2.0",
54
+ "prettier": "^3.1.1"
55
+ }
56
+ }
package/src/Premium.js ADDED
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+
3
+ var { join } = require("path");
4
+ var fs = require("fs");
5
+
6
+ module.exports = function (defaultFuncs, api, ctx) {
7
+ return function (Name, args) {
8
+ var Method = {};
9
+ fs.readdirSync(join(__dirname, "../Func"))
10
+ .filter(
11
+ (/** @type {string} */ File) =>
12
+ File.endsWith(".js") && !File.includes("Dev_"),
13
+ )
14
+ .map(
15
+ (/** @type {string} */ File) =>
16
+ (Method[File.split(".").slice(0, -1).join(".")] = require(
17
+ `../Func/${File}`,
18
+ )(defaultFuncs, api, ctx)),
19
+ );
20
+ if (Method[Name] == undefined) {
21
+ return `Method ${Name} not found`;
22
+ } else {
23
+ try {
24
+ if (
25
+ process.env.HalzionVersion == 1973 &&
26
+ global.Fca.Data.PremText.includes("Premium")
27
+ ) {
28
+ return Method[Name](args).then((/** @type {string} */ Data) => {
29
+ return Data;
30
+ });
31
+ } else {
32
+ return "Mua Premium đi nhóc rồi sài =))";
33
+ }
34
+ } catch (e) {
35
+ console.log(e);
36
+ }
37
+ }
38
+ };
39
+ };
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+
3
+ import { getType } from "../utils";
4
+
5
+ export default function (defaultFuncs, api, ctx) {
6
+ return function addExternalModule(moduleObj) {
7
+ if (getType(moduleObj) == "Object") {
8
+ for (let apiName in moduleObj) {
9
+ if (getType(moduleObj[apiName]) == "Function")
10
+ api[apiName] = moduleObj[apiName](defaultFuncs, api, ctx);
11
+ else
12
+ throw new Error(
13
+ `Item "${apiName}" in moduleObj must be a function, not ${getType(
14
+ moduleObj[apiName],
15
+ )}!`,
16
+ );
17
+ }
18
+ } else
19
+ throw new Error(
20
+ `moduleObj must be an object, not ${getType(moduleObj)}!`,
21
+ );
22
+ };
23
+ }
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+
3
+ import {
4
+ getType,
5
+ generateOfflineThreadingID,
6
+ generateTimestampRelative,
7
+ generateThreadingID,
8
+ parseAndCheckLogin,
9
+ } from "../utils";
10
+ import { error as _error } from "npmlog";
11
+
12
+ export default function (defaultFuncs, api, ctx) {
13
+ return function addUserToGroup(userID, threadID, callback) {
14
+ var resolveFunc = function () {};
15
+ var rejectFunc = function () {};
16
+ var returnPromise = new Promise(function (resolve, reject) {
17
+ resolveFunc = resolve;
18
+ rejectFunc = reject;
19
+ });
20
+
21
+ if (
22
+ !callback &&
23
+ (getType(threadID) === "Function" ||
24
+ getType(threadID) === "AsyncFunction")
25
+ )
26
+ throw { error: "please pass a threadID as a second argument." };
27
+
28
+ if (!callback) {
29
+ callback = function (err) {
30
+ if (err) return rejectFunc(err);
31
+ resolveFunc();
32
+ };
33
+ }
34
+
35
+ if (getType(threadID) !== "Number" && getType(threadID) !== "String")
36
+ throw {
37
+ error:
38
+ "ThreadID should be of type Number or String and not " +
39
+ getType(threadID) +
40
+ ".",
41
+ };
42
+
43
+ if (getType(userID) !== "Array") userID = [userID];
44
+
45
+ var messageAndOTID = generateOfflineThreadingID();
46
+ var form = {
47
+ client: "mercury",
48
+ action_type: "ma-type:log-message",
49
+ author: "fbid:" + ctx.userID,
50
+ thread_id: "",
51
+ timestamp: Date.now(),
52
+ timestamp_absolute: "Today",
53
+ timestamp_relative: generateTimestampRelative(),
54
+ timestamp_time_passed: "0",
55
+ is_unread: false,
56
+ is_cleared: false,
57
+ is_forward: false,
58
+ is_filtered_content: false,
59
+ is_filtered_content_bh: false,
60
+ is_filtered_content_account: false,
61
+ is_spoof_warning: false,
62
+ source: "source:chat:web",
63
+ "source_tags[0]": "source:chat",
64
+ log_message_type: "log:subscribe",
65
+ status: "0",
66
+ offline_threading_id: messageAndOTID,
67
+ message_id: messageAndOTID,
68
+ threading_id: generateThreadingID(ctx.clientID),
69
+ manual_retry_cnt: "0",
70
+ thread_fbid: threadID,
71
+ };
72
+
73
+ for (var i = 0; i < userID.length; i++) {
74
+ if (getType(userID[i]) !== "Number" && getType(userID[i]) !== "String")
75
+ throw {
76
+ error:
77
+ "Elements of userID should be of type Number or String and not " +
78
+ getType(userID[i]) +
79
+ ".",
80
+ };
81
+ form["log_message_data[added_participants][" + i + "]"] =
82
+ "fbid:" + userID[i];
83
+ }
84
+
85
+ defaultFuncs
86
+ .post("https://www.facebook.com/messaging/send/", ctx.jar, form)
87
+ .then(parseAndCheckLogin(ctx, defaultFuncs))
88
+ .then(function (resData) {
89
+ if (!resData) throw { error: "Add to group failed." };
90
+ if (resData.error) throw resData;
91
+
92
+ return callback();
93
+ })
94
+ .catch(function (err) {
95
+ _error("addUserToGroup", err);
96
+ return callback(err);
97
+ });
98
+
99
+ return returnPromise;
100
+ };
101
+ }
File without changes
@@ -0,0 +1,95 @@
1
+ "use strict";
2
+
3
+ import { getType, parseAndCheckLogin } from "../utils";
4
+ import { error as _error } from "npmlog";
5
+
6
+ export default function (defaultFuncs, api, ctx) {
7
+ return function changeAdminStatus(threadID, adminIDs, adminStatus, callback) {
8
+ if (getType(threadID) !== "String") {
9
+ throw { error: "changeAdminStatus: threadID must be a string" };
10
+ }
11
+
12
+ if (getType(adminIDs) === "String") {
13
+ adminIDs = [adminIDs];
14
+ }
15
+
16
+ if (getType(adminIDs) !== "Array") {
17
+ throw { error: "changeAdminStatus: adminIDs must be an array or string" };
18
+ }
19
+
20
+ if (getType(adminStatus) !== "Boolean") {
21
+ throw { error: "changeAdminStatus: adminStatus must be a string" };
22
+ }
23
+
24
+ var resolveFunc = function () {};
25
+ var rejectFunc = function () {};
26
+ var returnPromise = new Promise(function (resolve, reject) {
27
+ resolveFunc = resolve;
28
+ rejectFunc = reject;
29
+ });
30
+
31
+ if (!callback) {
32
+ callback = function (err) {
33
+ if (err) {
34
+ return rejectFunc(err);
35
+ }
36
+ resolveFunc();
37
+ };
38
+ }
39
+
40
+ if (
41
+ getType(callback) !== "Function" &&
42
+ getType(callback) !== "AsyncFunction"
43
+ ) {
44
+ throw { error: "changeAdminStatus: callback is not a function" };
45
+ }
46
+
47
+ let form = {
48
+ thread_fbid: threadID,
49
+ };
50
+
51
+ let i = 0;
52
+ for (let u of adminIDs) {
53
+ form[`admin_ids[${i++}]`] = u;
54
+ }
55
+ form["add"] = adminStatus;
56
+
57
+ defaultFuncs
58
+ .post(
59
+ "https://www.facebook.com/messaging/save_admins/?dpr=1",
60
+ ctx.jar,
61
+ form,
62
+ )
63
+ .then(parseAndCheckLogin(ctx, defaultFuncs))
64
+ .then(function (resData) {
65
+ if (resData.error) {
66
+ switch (resData.error) {
67
+ case 1976004:
68
+ throw {
69
+ error: "Cannot alter admin status: you are not an admin.",
70
+ rawResponse: resData,
71
+ };
72
+ case 1357031:
73
+ throw {
74
+ error:
75
+ "Cannot alter admin status: this thread is not a group chat.",
76
+ rawResponse: resData,
77
+ };
78
+ default:
79
+ throw {
80
+ error: "Cannot alter admin status: unknown error.",
81
+ rawResponse: resData,
82
+ };
83
+ }
84
+ }
85
+
86
+ callback();
87
+ })
88
+ .catch(function (err) {
89
+ _error("changeAdminStatus", err);
90
+ return callback(err);
91
+ });
92
+
93
+ return returnPromise;
94
+ };
95
+ }
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+
3
+ var utils = require("../utils");
4
+ var log = require("npmlog");
5
+
6
+ module.exports = function (defaultFuncs, api, ctx) {
7
+ return function changeArchivedStatus(threadOrThreads, archive, callback) {
8
+ var resolveFunc = function () {};
9
+ var rejectFunc = function () {};
10
+ var returnPromise = new Promise(function (resolve, reject) {
11
+ resolveFunc = resolve;
12
+ rejectFunc = reject;
13
+ });
14
+
15
+ if (!callback) {
16
+ callback = function (err) {
17
+ if (err) return rejectFunc(err);
18
+ resolveFunc();
19
+ };
20
+ }
21
+
22
+ var form = {};
23
+
24
+ if (utils.getType(threadOrThreads) === "Array")
25
+ for (var i = 0; i < threadOrThreads.length; i++)
26
+ form["ids[" + threadOrThreads[i] + "]"] = archive;
27
+ else form["ids[" + threadOrThreads + "]"] = archive;
28
+
29
+ defaultFuncs
30
+ .post(
31
+ "https://www.facebook.com/ajax/mercury/change_archived_status.php",
32
+ ctx.jar,
33
+ form,
34
+ )
35
+ .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
36
+ .then(function (resData) {
37
+ if (resData.error) throw resData;
38
+ return callback();
39
+ })
40
+ .catch(function (err) {
41
+ log.error("changeArchivedStatus", err);
42
+ return callback(err);
43
+ });
44
+
45
+ return returnPromise;
46
+ };
47
+ };
@@ -0,0 +1,95 @@
1
+ /* eslint-disable no-undef */
2
+ /* eslint-disable no-useless-catch */
3
+ /* eslint-disable @typescript-eslint/no-var-requires */
4
+ /* eslint-disable @typescript-eslint/no-unused-vars */
5
+ "use strict";
6
+
7
+ import { parseAndCheckLogin } from "../utils";
8
+ import log from "npmlog";
9
+ /**
10
+ * It posts an image to a Facebook profile
11
+ * @param Api - The API object
12
+ * @param BotID - The ID of the bot you want to post the image to.
13
+ * @param form - The form data that you want to send.
14
+ * @returns The JSON.parse(Data.split("for (;;);")[1]); is returning the following:
15
+ * {"__ar":1,"payload":null,"jsmods":{"require":[["ImageUploader","uploadPhoto",[{"__m":"__elem_0"},{"__m":"__elem_1"},{"__m":"__elem_2"},{"__m":"__
16
+ */
17
+ async function postImage(Api, BotID, form) {
18
+ var Data = await Api.httpPostFormData(
19
+ `https://www.facebook.com/profile/picture/upload/?profile_id=${BotID}&photo_source=57&av=${BotID}`,
20
+ form,
21
+ );
22
+ return JSON.parse(Data.split("for (;;);")[1]);
23
+ }
24
+
25
+ export default function (defaultFuncs, api, ctx) {
26
+ /* Changing the profile picture of the bot. */
27
+ return function changeAvt(link, caption, callback) {
28
+ var resolveFunc = function () {};
29
+ var rejectFunc = function () {};
30
+ var returnPromise = new Promise(function (resolve, reject) {
31
+ resolveFunc = resolve;
32
+ rejectFunc = reject;
33
+ });
34
+
35
+ if (!callback) {
36
+ callback = function (err, data) {
37
+ if (err) return rejectFunc(err);
38
+ resolveFunc(data);
39
+ };
40
+ }
41
+ try {
42
+ var Fetch = require("axios");
43
+ Fetch.get(link, { responseType: "stream" }).then((data) => {
44
+ postImage(api, ctx.userID, { file: data.data }).then((data) => {
45
+ if (data.error)
46
+ throw new Error({
47
+ error: data.error,
48
+ des: data.error.errorDescription,
49
+ });
50
+ var form = {
51
+ av: ctx.userID,
52
+ fb_api_req_friendly_name: "ProfileCometProfilePictureSetMutation",
53
+ fb_api_caller_class: "RelayModern",
54
+ doc_id: "5066134240065849",
55
+ variables: JSON.stringify({
56
+ input: {
57
+ caption: caption || "",
58
+ existing_photo_id: data.payload.fbid,
59
+ expiration_time: null,
60
+ profile_id: ctx.userID,
61
+ profile_pic_method: "EXISTING",
62
+ profile_pic_source: "TIMELINE",
63
+ scaled_crop_rect: {
64
+ height: 1,
65
+ width: 1,
66
+ x: 0,
67
+ y: 0,
68
+ },
69
+ skip_cropping: true,
70
+ actor_id: ctx.userID,
71
+ client_mutation_id: Math.round(Math.random() * 19).toString(),
72
+ },
73
+ isPage: false,
74
+ isProfile: true,
75
+ scale: 3,
76
+ }),
77
+ };
78
+ defaultFuncs
79
+ .post("https://www.facebook.com/api/graphql/", ctx.jar, form)
80
+ .then(parseAndCheckLogin(ctx, defaultFuncs))
81
+ .then(function (resData) {
82
+ if (resData.error) throw resData;
83
+ else return callback(null, true);
84
+ })
85
+ .catch(function (err) {
86
+ return callback(err);
87
+ });
88
+ });
89
+ });
90
+ } catch (e) {
91
+ throw e;
92
+ }
93
+ return returnPromise;
94
+ };
95
+ }
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+
3
+ import { getType, parseAndCheckLogin } from "../utils";
4
+ import { error } from "npmlog";
5
+
6
+ export default function (defaultFuncs, api, ctx) {
7
+ return function changeBio(bio, publish, callback) {
8
+ var resolveFunc = function () {};
9
+ var rejectFunc = function () {};
10
+ var returnPromise = new Promise(function (resolve, reject) {
11
+ resolveFunc = resolve;
12
+ rejectFunc = reject;
13
+ });
14
+
15
+ if (!callback) {
16
+ if (getType(publish) == "Function" || getType(publish) == "AsyncFunction")
17
+ callback = publish;
18
+ else {
19
+ callback = function (err) {
20
+ if (err) return rejectFunc(err);
21
+ resolveFunc();
22
+ };
23
+ }
24
+ }
25
+
26
+ if (getType(publish) != "Boolean") publish = false;
27
+ if (getType(bio) != "String") {
28
+ bio = "";
29
+ publish = false;
30
+ }
31
+
32
+ var form = {
33
+ fb_api_caller_class: "RelayModern",
34
+ fb_api_req_friendly_name: "ProfileCometSetBioMutation",
35
+ // This doc_is is valid as of May 23, 2020
36
+ doc_id: "2725043627607610",
37
+ variables: JSON.stringify({
38
+ input: {
39
+ bio: bio,
40
+ publish_bio_feed_story: publish,
41
+ actor_id: ctx.userID,
42
+ client_mutation_id: Math.round(Math.random() * 1024).toString(),
43
+ },
44
+ hasProfileTileViewID: false,
45
+ profileTileViewID: null,
46
+ scale: 1,
47
+ }),
48
+ av: ctx.userID,
49
+ };
50
+
51
+ defaultFuncs
52
+ .post("https://www.facebook.com/api/graphql/", ctx.jar, form)
53
+ .then(parseAndCheckLogin(ctx, defaultFuncs))
54
+ .then(function (resData) {
55
+ if (resData.errors) throw resData;
56
+
57
+ return callback();
58
+ })
59
+ .catch(function (err) {
60
+ error("changeBio", err);
61
+ return callback(err);
62
+ });
63
+
64
+ return returnPromise;
65
+ };
66
+ }
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+
3
+ import { saveCookies, parseAndCheckLogin } from "../utils";
4
+ import { error } from "npmlog";
5
+
6
+ export default function (defaultFuncs, api, ctx) {
7
+ return function changeBlockedStatus(userID, block, callback) {
8
+ var resolveFunc = function () {};
9
+ var rejectFunc = function () {};
10
+ var returnPromise = new Promise(function (resolve, reject) {
11
+ resolveFunc = resolve;
12
+ rejectFunc = reject;
13
+ });
14
+
15
+ if (!callback) {
16
+ callback = function (err) {
17
+ if (err) return rejectFunc(err);
18
+ resolveFunc();
19
+ };
20
+ }
21
+
22
+ defaultFuncs
23
+ .post(
24
+ `https://www.facebook.com/messaging/${
25
+ block ? "" : "un"
26
+ }block_messages/`,
27
+ ctx.jar,
28
+ { fbid: userID },
29
+ )
30
+ .then(saveCookies(ctx.jar))
31
+ .then(parseAndCheckLogin(ctx, defaultFuncs))
32
+ .then(function (resData) {
33
+ if (resData.error) throw resData;
34
+ return callback();
35
+ })
36
+ .catch(function (err) {
37
+ error("changeBlockedStatus", err);
38
+ return callback(err);
39
+ });
40
+ return returnPromise;
41
+ };
42
+ }