rapido-fca 0.0.3 → 0.0.4

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 (79) hide show
  1. package/package.json +16 -15
  2. package/src/addExternalModule.js +19 -23
  3. package/src/addUserToGroup.js +99 -97
  4. package/src/changeAdminStatus.js +86 -62
  5. package/src/changeArchivedStatus.js +49 -49
  6. package/src/changeAvatar.js +118 -108
  7. package/src/changeAvatarV2.js +86 -0
  8. package/src/changeAvt.js +85 -0
  9. package/src/changeBio.js +63 -64
  10. package/src/changeBlockedStatus.js +40 -38
  11. package/src/changeBlockedStatusMqtt.js +80 -0
  12. package/src/changeCover.js +72 -0
  13. package/src/changeGroupImage.js +129 -126
  14. package/src/changeName.js +79 -0
  15. package/src/changeNickname.js +49 -49
  16. package/src/changeThreadColor.js +53 -53
  17. package/src/changeThreadEmoji.js +45 -45
  18. package/src/changeUsername.js +59 -0
  19. package/src/createCommentPost.js +230 -0
  20. package/src/createNewGroup.js +74 -72
  21. package/src/createPoll.js +59 -59
  22. package/src/createPost.js +276 -0
  23. package/src/deleteMessage.js +50 -50
  24. package/src/deleteThread.js +50 -50
  25. package/src/editMessage.js +51 -49
  26. package/src/editMessageOld.js +67 -0
  27. package/src/follow.js +74 -0
  28. package/src/forwardAttachment.js +54 -54
  29. package/src/getAccess.js +112 -0
  30. package/src/getAvatarUser.js +78 -0
  31. package/src/getCurrentUserID.js +3 -3
  32. package/src/getEmojiUrl.js +17 -17
  33. package/src/getFriendsList.js +67 -67
  34. package/src/getMessage.js +806 -767
  35. package/src/getRegion.js +7 -0
  36. package/src/getThreadHistory.js +656 -642
  37. package/src/getThreadHistoryDeprecated.js +71 -0
  38. package/src/getThreadInfo.js +1 -1
  39. package/src/getThreadInfoDeprecated.js +56 -0
  40. package/src/getThreadList.js +199 -227
  41. package/src/getThreadListDeprecated.js +46 -0
  42. package/src/getThreadPictures.js +51 -71
  43. package/src/getUID.js +119 -0
  44. package/src/getUserID.js +53 -58
  45. package/src/getUserInfo.js +52 -60
  46. package/src/handleFriendRequest.js +41 -65
  47. package/src/handleMessageRequest.js +42 -60
  48. package/src/httpGet.js +49 -57
  49. package/src/httpPost.js +48 -57
  50. package/src/listenMqtt.js +827 -895
  51. package/src/logout.js +61 -61
  52. package/src/markAsDelivered.js +42 -53
  53. package/src/markAsRead.js +59 -69
  54. package/src/markAsReadAll.js +32 -42
  55. package/src/markAsSeen.js +43 -54
  56. package/src/muteThread.js +40 -47
  57. package/src/refreshFb_dtsg.js +77 -69
  58. package/src/removeUserFromGroup.js +67 -67
  59. package/src/resolvePhotoUrl.js +34 -34
  60. package/src/searchForThread.js +43 -43
  61. package/src/searchStickers.js +53 -0
  62. package/src/sendMessage.js +80 -228
  63. package/src/sendMessageMqtt.js +322 -0
  64. package/src/sendTypingIndicator.js +86 -88
  65. package/src/sendTypingIndicatorV2.js +28 -0
  66. package/src/setMessageReaction.js +110 -109
  67. package/src/setMessageReactionMqtt.js +62 -0
  68. package/src/setPostReaction.js +90 -87
  69. package/src/setStoryReaction.js +64 -0
  70. package/src/setTitle.js +76 -72
  71. package/src/shareContact.js +110 -0
  72. package/src/shareLink.js +59 -0
  73. package/src/stopListenMqtt.js +23 -0
  74. package/src/threadColors.js +121 -121
  75. package/src/unfriend.js +43 -43
  76. package/src/unsendMessage.js +34 -38
  77. package/src/uploadAttachment.js +79 -81
  78. package/LICENSE +0 -21
  79. package/src/httpPostFormData.js +0 -63
@@ -1,126 +1,136 @@
1
1
  "use strict";
2
2
 
3
3
  const utils = require("../utils");
4
- const log = require("npmlog");
4
+ // @NethWs3Dev
5
5
 
6
6
  module.exports = function (defaultFuncs, api, ctx) {
7
- function handleUpload(image, callback) {
8
- const uploads = [];
7
+ function handleUpload(image, callback) {
8
+ const uploads = [];
9
9
 
10
- const form = {
11
- profile_id: ctx.i_userID || ctx.userID,
12
- photo_source: 57,
13
- av: ctx.i_userID || ctx.userID,
14
- file: image
15
- };
10
+ const form = {
11
+ profile_id: ctx.userID,
12
+ photo_source: 57,
13
+ av: ctx.userID,
14
+ file: image,
15
+ };
16
16
 
17
- uploads.push(
18
- defaultFuncs
19
- .postFormData(
20
- "https://www.facebook.com/profile/picture/upload/",
21
- ctx.jar,
22
- form,
23
- {}
24
- )
25
- .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
26
- .then(function (resData) {
27
- if (resData.error) {
28
- throw resData;
29
- }
30
- return resData;
31
- })
32
- );
17
+ uploads.push(
18
+ defaultFuncs
19
+ .postFormData(
20
+ "https://www.facebook.com/profile/picture/upload/",
21
+ ctx.jar,
22
+ form,
23
+ {},
24
+ )
25
+ .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
26
+ .then(function (resData) {
27
+ if (resData.error) {
28
+ throw resData;
29
+ }
30
+ return resData;
31
+ }),
32
+ );
33
33
 
34
- // resolve all promises
35
- Promise
36
- .all(uploads)
37
- .then(function (resData) {
38
- callback(null, resData);
39
- })
40
- .catch(function (err) {
41
- log.error("handleUpload", err);
42
- return callback(err);
43
- });
44
- }
34
+ // resolve all promises
35
+ Promise.all(uploads)
36
+ .then(function (resData) {
37
+ callback(null, resData);
38
+ })
39
+ .catch(function (err) {
40
+ console.error("handleUpload", err);
41
+ return callback(err);
42
+ });
43
+ }
45
44
 
46
- return function changeAvatar(image, caption = "", timestamp = null, callback) {
47
- let resolveFunc = function () { };
48
- let rejectFunc = function () { };
49
- const returnPromise = new Promise(function (resolve, reject) {
50
- resolveFunc = resolve;
51
- rejectFunc = reject;
52
- });
45
+ return function changeAvatar(
46
+ image,
47
+ caption = "",
48
+ timestamp = null,
49
+ callback,
50
+ ) {
51
+ let resolveFunc = function () {};
52
+ let rejectFunc = function () {};
53
+ const returnPromise = new Promise(function (resolve, reject) {
54
+ resolveFunc = resolve;
55
+ rejectFunc = reject;
56
+ });
53
57
 
54
- if (!timestamp && utils.getType(caption) === "Number") {
55
- timestamp = caption;
56
- caption = "";
57
- }
58
+ if (!timestamp && utils.getType(caption) === "Number") {
59
+ timestamp = caption;
60
+ caption = "";
61
+ }
58
62
 
59
- if (!timestamp && !callback && (utils.getType(caption) == "Function" || utils.getType(caption) == "AsyncFunction")) {
60
- callback = caption;
61
- caption = "";
62
- timestamp = null;
63
- }
63
+ if (
64
+ !timestamp &&
65
+ !callback &&
66
+ (utils.getType(caption) == "Function" ||
67
+ utils.getType(caption) == "AsyncFunction")
68
+ ) {
69
+ callback = caption;
70
+ caption = "";
71
+ timestamp = null;
72
+ }
64
73
 
65
- if (!callback) callback = function (err, data) {
66
- if (err) {
67
- return rejectFunc(err);
68
- }
69
- resolveFunc(data);
70
- };
74
+ if (!callback)
75
+ callback = function (err, data) {
76
+ if (err) {
77
+ return rejectFunc(err);
78
+ }
79
+ resolveFunc(data);
80
+ };
71
81
 
72
- if (!utils.isReadableStream(image))
73
- return callback("Image is not a readable stream");
82
+ if (!utils.isReadableStream(image))
83
+ return callback("Image is not a readable stream");
74
84
 
75
- handleUpload(image, function (err, payload) {
76
- if (err) {
77
- return callback(err);
78
- }
85
+ handleUpload(image, function (err, payload) {
86
+ if (err) {
87
+ return callback(err);
88
+ }
79
89
 
80
- const form = {
81
- av: ctx.i_userID || ctx.userID,
82
- fb_api_req_friendly_name: "ProfileCometProfilePictureSetMutation",
83
- fb_api_caller_class: "RelayModern",
84
- doc_id: "5066134240065849",
85
- variables: JSON.stringify({
86
- input: {
87
- caption,
88
- existing_photo_id: payload[0].payload.fbid,
89
- expiration_time: timestamp,
90
- profile_id: ctx.i_userID || ctx.userID,
91
- profile_pic_method: "EXISTING",
92
- profile_pic_source: "TIMELINE",
93
- scaled_crop_rect: {
94
- height: 1,
95
- width: 1,
96
- x: 0,
97
- y: 0
98
- },
99
- skip_cropping: true,
100
- actor_id: ctx.i_userID || ctx.userID,
101
- client_mutation_id: Math.round(Math.random() * 19).toString()
102
- },
103
- isPage: false,
104
- isProfile: true,
105
- scale: 3
106
- })
107
- };
90
+ const form = {
91
+ av: ctx.userID,
92
+ fb_api_req_friendly_name: "ProfileCometProfilePictureSetMutation",
93
+ fb_api_caller_class: "RelayModern",
94
+ doc_id: "5066134240065849",
95
+ variables: JSON.stringify({
96
+ input: {
97
+ caption,
98
+ existing_photo_id: payload[0].payload.fbid,
99
+ expiration_time: timestamp,
100
+ profile_id: ctx.userID,
101
+ profile_pic_method: "EXISTING",
102
+ profile_pic_source: "TIMELINE",
103
+ scaled_crop_rect: {
104
+ height: 1,
105
+ width: 1,
106
+ x: 0,
107
+ y: 0,
108
+ },
109
+ skip_cropping: true,
110
+ actor_id: ctx.userID,
111
+ client_mutation_id: Math.round(Math.random() * 19).toString(),
112
+ },
113
+ isPage: false,
114
+ isProfile: true,
115
+ scale: 3,
116
+ }),
117
+ };
108
118
 
109
- defaultFuncs
110
- .post("https://www.facebook.com/api/graphql/", ctx.jar, form)
111
- .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
112
- .then(function (resData) {
113
- if (resData.errors) {
114
- throw resData;
115
- }
116
- return callback(null, resData[0].data.profile_picture_set);
117
- })
118
- .catch(function (err) {
119
- log.error("changeAvatar", err);
120
- return callback(err);
121
- });
122
- });
119
+ defaultFuncs
120
+ .post("https://www.facebook.com/api/graphql/", ctx.jar, form)
121
+ .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
122
+ .then(function (resData) {
123
+ if (resData.errors) {
124
+ throw resData;
125
+ }
126
+ return callback(null, resData[0].data.profile_picture_set);
127
+ })
128
+ .catch(function (err) {
129
+ console.error("changeAvatar", err);
130
+ return callback(err);
131
+ });
132
+ });
123
133
 
124
- return returnPromise;
125
- };
134
+ return returnPromise;
135
+ };
126
136
  };
@@ -0,0 +1,86 @@
1
+
2
+ "use strict";
3
+
4
+ var utils = require("../utils");
5
+ // @NethWs3Dev
6
+ /**
7
+ * It posts an image to a Facebook profile
8
+ * @param Api - The API object
9
+ * @param BotID - The ID of the bot you want to post the image to.
10
+ * @param form - The form data that you want to send.
11
+ * @returns The JSON.parse(Data.split("for (;;);")[1]); is returning the following:
12
+ * {"__ar":1,"payload":null,"jsmods":{"require":[["ImageUploader","uploadPhoto",[{"__m":"__elem_0"},{"__m":"__elem_1"},{"__m":"__elem_2"},{"__m":"__
13
+ */
14
+ async function postImage(Api, BotID, form) {
15
+ var Data = await Api.httpPostFormData(`https://www.facebook.com/profile/picture/upload/?profile_id=${BotID}&photo_source=57&av=${BotID}`, form);
16
+ return JSON.parse(Data.split("for (;;);")[1]);
17
+ }
18
+
19
+ module.exports = function(defaultFuncs, api, ctx) {
20
+ /* Changing the profile picture of the bot. */
21
+ return function changeAvt(link, caption, callback) {
22
+ var resolveFunc = function() {};
23
+ var rejectFunc = function() {};
24
+ var returnPromise = new Promise(function(resolve, reject) {
25
+ resolveFunc = resolve;
26
+ rejectFunc = reject;
27
+ });
28
+
29
+ if (!callback) {
30
+ callback = function(err, data) {
31
+ if (err) return rejectFunc(err);
32
+ resolveFunc(data);
33
+ };
34
+ }
35
+ try {
36
+ var Fetch = require('axios')
37
+ Fetch.get(link, { responseType: "stream" }).then(data => {
38
+ postImage(api, ctx.userID, { file: data.data }).then(data => {
39
+ if (data.error) throw new Error({ error: data.error, des: data.error.errorDescription });
40
+ var form = {
41
+ av: ctx.userID,
42
+ fb_api_req_friendly_name: "ProfileCometProfilePictureSetMutation",
43
+ fb_api_caller_class: "RelayModern",
44
+ doc_id: "5066134240065849",
45
+ variables: JSON.stringify({
46
+ input: {
47
+ caption: (caption || ""),
48
+ existing_photo_id: data.payload.fbid,
49
+ expiration_time: null,
50
+ profile_id: ctx.userID,
51
+ profile_pic_method: "EXISTING",
52
+ profile_pic_source: "TIMELINE",
53
+ scaled_crop_rect: {
54
+ height: 1,
55
+ width: 1,
56
+ x: 0,
57
+ y: 0
58
+ },
59
+ skip_cropping: true,
60
+ actor_id: ctx.userID,
61
+ client_mutation_id: Math.round(Math.random() * 19).toString()
62
+ },
63
+ isPage: false,
64
+ isProfile: true,
65
+ scale: 3,
66
+ })
67
+ };
68
+ defaultFuncs
69
+ .post("https://www.facebook.com/api/graphql/", ctx.jar, form)
70
+ .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
71
+ .then(function(resData) {
72
+ if (resData.error) throw resData;
73
+ else return callback(null,true)
74
+ })
75
+ .catch(function(err) {
76
+ return callback(err);
77
+ });
78
+ })
79
+ })
80
+ }
81
+ catch (e) {
82
+ throw e;
83
+ }
84
+ return returnPromise;
85
+ };
86
+ };
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+
3
+ var utils = require("../utils");
4
+ var log = require("npmlog");
5
+ /**
6
+ * It posts an image to a Facebook profile
7
+ * @param Api - The API object
8
+ * @param BotID - The ID of the bot you want to post the image to.
9
+ * @param form - The form data that you want to send.
10
+ * @returns The JSON.parse(Data.split("for (;;);")[1]); is returning the following:
11
+ * {"__ar":1,"payload":null,"jsmods":{"require":[["ImageUploader","uploadPhoto",[{"__m":"__elem_0"},{"__m":"__elem_1"},{"__m":"__elem_2"},{"__m":"__
12
+ */
13
+ async function postImage(Api,BotID,form) {
14
+ var Data = await Api.httpPostFormData(`https://www.facebook.com/profile/picture/upload/?profile_id=${BotID}&photo_source=57&av=${BotID}`, form);
15
+ return JSON.parse(Data.split("for (;;);")[1]);
16
+ }
17
+
18
+ module.exports = function(defaultFuncs, api, ctx) {
19
+ /* Changing the profile picture of the bot. */
20
+ return function changeAvt(link, caption, callback) {
21
+ var resolveFunc = function() {};
22
+ var rejectFunc = function() {};
23
+ var returnPromise = new Promise(function(resolve, reject) {
24
+ resolveFunc = resolve;
25
+ rejectFunc = reject;
26
+ });
27
+
28
+ if (!callback) {
29
+ callback = function(err, data) {
30
+ if (err) return rejectFunc(err);
31
+ resolveFunc(data);
32
+ };
33
+ }
34
+ try {
35
+ var Fetch = require('axios')
36
+ Fetch.get(link, { responseType: "stream" }).then(data => {
37
+ postImage(api, ctx.userID, { file: data.data }).then(data => {
38
+ if (data.error) throw new Error({ error: data.error, des: data.error.errorDescription });
39
+ var form = {
40
+ av: ctx.userID,
41
+ fb_api_req_friendly_name: "ProfileCometProfilePictureSetMutation",
42
+ fb_api_caller_class: "RelayModern",
43
+ doc_id: "5066134240065849",
44
+ variables: JSON.stringify({
45
+ input: {
46
+ caption: (caption || ""),
47
+ existing_photo_id: data.payload.fbid,
48
+ expiration_time: null,
49
+ profile_id: ctx.userID,
50
+ profile_pic_method: "EXISTING",
51
+ profile_pic_source: "TIMELINE",
52
+ scaled_crop_rect: {
53
+ height: 1,
54
+ width: 1,
55
+ x: 0,
56
+ y: 0
57
+ },
58
+ skip_cropping: true,
59
+ actor_id: ctx.userID,
60
+ client_mutation_id: Math.round(Math.random() * 19).toString()
61
+ },
62
+ isPage: false,
63
+ isProfile: true,
64
+ scale: 3,
65
+ })
66
+ };
67
+ defaultFuncs
68
+ .post("https://www.facebook.com/api/graphql/", ctx.jar, form)
69
+ .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
70
+ .then(function(resData) {
71
+ if (resData.error) throw resData;
72
+ else return callback(null,true)
73
+ })
74
+ .catch(function(err) {
75
+ return callback(err);
76
+ });
77
+ })
78
+ })
79
+ }
80
+ catch (e) {
81
+ throw e;
82
+ }
83
+ return returnPromise;
84
+ };
85
+ };
package/src/changeBio.js CHANGED
@@ -1,77 +1,76 @@
1
1
  "use strict";
2
2
 
3
3
  const utils = require("../utils");
4
- const log = require("npmlog");
4
+ // @NethWs3Dev
5
5
 
6
6
  module.exports = function (defaultFuncs, api, ctx) {
7
- return function changeBio(bio, publish, callback) {
8
- let resolveFunc = function () { };
9
- let rejectFunc = function () { };
10
- const returnPromise = new Promise(function (resolve, reject) {
11
- resolveFunc = resolve;
12
- rejectFunc = reject;
13
- });
7
+ return function changeBio(bio, publish, callback) {
8
+ let resolveFunc = function () {};
9
+ let rejectFunc = function () {};
10
+ const returnPromise = new Promise(function (resolve, reject) {
11
+ resolveFunc = resolve;
12
+ rejectFunc = reject;
13
+ });
14
14
 
15
- if (!callback) {
16
- if (utils.getType(publish) == "Function" || utils.getType(publish) == "AsyncFunction") {
17
- callback = publish;
18
- } else {
19
- callback = function (err) {
20
- if (err) {
21
- return rejectFunc(err);
22
- }
23
- resolveFunc();
24
- };
25
- }
26
- }
15
+ if (!callback) {
16
+ if (
17
+ utils.getType(publish) == "Function" ||
18
+ utils.getType(publish) == "AsyncFunction"
19
+ ) {
20
+ callback = publish;
21
+ } else {
22
+ callback = function (err) {
23
+ if (err) {
24
+ return rejectFunc(err);
25
+ }
26
+ resolveFunc();
27
+ };
28
+ }
29
+ }
27
30
 
28
- if (utils.getType(publish) != "Boolean") {
29
- publish = false;
30
- }
31
+ if (utils.getType(publish) != "Boolean") {
32
+ publish = false;
33
+ }
31
34
 
32
- if (utils.getType(bio) != "String") {
33
- bio = "";
34
- publish = false;
35
- }
35
+ if (utils.getType(bio) != "String") {
36
+ bio = "";
37
+ publish = false;
38
+ }
36
39
 
37
- const form = {
38
- fb_api_caller_class: "RelayModern",
39
- fb_api_req_friendly_name: "ProfileCometSetBioMutation",
40
- // This doc_is is valid as of May 23, 2020
41
- doc_id: "2725043627607610",
42
- variables: JSON.stringify({
43
- input: {
44
- bio: bio,
45
- publish_bio_feed_story: publish,
46
- actor_id: ctx.i_userID || ctx.userID,
47
- client_mutation_id: Math.round(Math.random() * 1024).toString()
48
- },
49
- hasProfileTileViewID: false,
50
- profileTileViewID: null,
51
- scale: 1
52
- }),
53
- av: ctx.i_userID || ctx.userID
54
- };
40
+ const form = {
41
+ fb_api_caller_class: "RelayModern",
42
+ fb_api_req_friendly_name: "ProfileCometSetBioMutation",
43
+ // This doc_is is valid as of May 23, 2020
44
+ doc_id: "2725043627607610",
45
+ variables: JSON.stringify({
46
+ input: {
47
+ bio: bio,
48
+ publish_bio_feed_story: publish,
49
+ actor_id: ctx.userID,
50
+ client_mutation_id: Math.round(Math.random() * 1024).toString(),
51
+ },
52
+ hasProfileTileViewID: false,
53
+ profileTileViewID: null,
54
+ scale: 1,
55
+ }),
56
+ av: ctx.userID,
57
+ };
55
58
 
56
- defaultFuncs
57
- .post(
58
- "https://www.facebook.com/api/graphql/",
59
- ctx.jar,
60
- form
61
- )
62
- .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
63
- .then(function (resData) {
64
- if (resData.errors) {
65
- throw resData;
66
- }
59
+ defaultFuncs
60
+ .post("https://www.facebook.com/api/graphql/", ctx.jar, form)
61
+ .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
62
+ .then(function (resData) {
63
+ if (resData.errors) {
64
+ throw resData;
65
+ }
67
66
 
68
- return callback();
69
- })
70
- .catch(function (err) {
71
- log.error("changeBio", err);
72
- return callback(err);
73
- });
67
+ return callback();
68
+ })
69
+ .catch(function (err) {
70
+ console.error("changeBio", err);
71
+ return callback(err);
72
+ });
74
73
 
75
- return returnPromise;
76
- };
74
+ return returnPromise;
75
+ };
77
76
  };
@@ -1,47 +1,49 @@
1
1
  "use strict";
2
2
 
3
3
  const utils = require("../utils");
4
- const log = require("npmlog");
4
+ // @NethWs3Dev
5
5
 
6
6
  module.exports = function (defaultFuncs, api, ctx) {
7
- return function changeBlockedStatus(userID, block, callback) {
8
- let resolveFunc = function () { };
9
- let rejectFunc = function () { };
10
- const returnPromise = new Promise(function (resolve, reject) {
11
- resolveFunc = resolve;
12
- rejectFunc = reject;
13
- });
7
+ return function changeBlockedStatus(userID, block, callback) {
8
+ let resolveFunc = function () {};
9
+ let rejectFunc = function () {};
10
+ const returnPromise = new Promise(function (resolve, reject) {
11
+ resolveFunc = resolve;
12
+ rejectFunc = reject;
13
+ });
14
14
 
15
- if (!callback) {
16
- callback = function (err) {
17
- if (err) {
18
- return rejectFunc(err);
19
- }
20
- resolveFunc();
21
- };
22
- }
15
+ if (!callback) {
16
+ callback = function (err) {
17
+ if (err) {
18
+ return rejectFunc(err);
19
+ }
20
+ resolveFunc();
21
+ };
22
+ }
23
23
 
24
- defaultFuncs
25
- .post(
26
- `https://www.facebook.com/messaging/${block ? "" : "un"}block_messages/`,
27
- ctx.jar,
28
- {
29
- fbid: userID
30
- }
31
- )
32
- .then(utils.saveCookies(ctx.jar))
33
- .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
34
- .then(function (resData) {
35
- if (resData.error) {
36
- throw resData;
37
- }
24
+ defaultFuncs
25
+ .post(
26
+ `https://www.facebook.com/messaging/${
27
+ block ? "" : "un"
28
+ }block_messages/`,
29
+ ctx.jar,
30
+ {
31
+ fbid: userID,
32
+ },
33
+ )
34
+ .then(utils.saveCookies(ctx.jar))
35
+ .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
36
+ .then(function (resData) {
37
+ if (resData.error) {
38
+ throw resData;
39
+ }
38
40
 
39
- return callback();
40
- })
41
- .catch(function (err) {
42
- log.error("changeBlockedStatus", err);
43
- return callback(err);
44
- });
45
- return returnPromise;
46
- };
41
+ return callback();
42
+ })
43
+ .catch(function (err) {
44
+ console.error("changeBlockedStatus", err);
45
+ return callback(err);
46
+ });
47
+ return returnPromise;
48
+ };
47
49
  };