fca-smart-shankar 13.0.0 → 16.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 (169) hide show
  1. package/.cache/replit/env/latest +56 -0
  2. package/.cache/replit/env/latest.json +1 -0
  3. package/.cache/replit/modules/nodejs-14.res +1 -0
  4. package/.cache/replit/modules/replit.res +1 -0
  5. package/.cache/replit/modules/web.res +1 -0
  6. package/.cache/replit/modules.stamp +0 -0
  7. package/.cache/typescript/5.5/package.json +1 -0
  8. package/.config/configstore/update-notifier-npm.json +4 -0
  9. package/.gitattributes +2 -0
  10. package/.replit +3 -12
  11. package/.upm/store.json +1 -1
  12. package/Extra/Balancer.js +49 -0
  13. package/Extra/Bypass/956/index.js +234 -0
  14. package/Extra/Bypass/test/aaaa.json +170 -0
  15. package/Extra/Bypass/test/index.js +188 -0
  16. package/Extra/Database/index.js +469 -0
  17. package/Extra/ExtraAddons.js +82 -0
  18. package/Extra/ExtraFindUID.js +62 -0
  19. package/Extra/ExtraGetThread.js +365 -0
  20. package/Extra/ExtraScreenShot.js +430 -0
  21. package/Extra/ExtraUptimeRobot.js +38 -0
  22. package/Extra/Html/Classic/script.js +119 -0
  23. package/Extra/Html/Classic/style.css +8 -0
  24. package/Extra/Security/AES_256_GCM/index.js +0 -0
  25. package/Extra/Security/Base/Step_1.js +6 -0
  26. package/Extra/Security/Base/Step_2.js +22 -0
  27. package/Extra/Security/Base/Step_3.js +22 -0
  28. package/Extra/Security/Base/index.js +191 -0
  29. package/Extra/Security/Index.js +5 -0
  30. package/Extra/Security/Step_1.js +6 -0
  31. package/Extra/Security/Step_2.js +22 -0
  32. package/Extra/Security/Step_3.js +22 -0
  33. package/Extra/Src/Change_Environment.js +24 -0
  34. package/Extra/Src/Check_Update.js +67 -0
  35. package/Extra/Src/History.js +115 -0
  36. package/Extra/Src/Instant_Update.js +65 -0
  37. package/Extra/Src/Last-Run.js +65 -0
  38. package/Extra/Src/Premium.js +81 -0
  39. package/Extra/Src/Release_Memory.js +160 -0
  40. package/Extra/Src/Websocket.js +213 -0
  41. package/Extra/Src/image/checkmate.jpg +0 -0
  42. package/Extra/Src/test.js +28 -0
  43. package/Extra/Src/uuid.js +137 -0
  44. package/Func/AcceptAgreement.js +31 -0
  45. package/Func/ClearCache.js +64 -0
  46. package/Func/ReportV1.js +54 -0
  47. package/LICENSE +678 -0
  48. package/Language/index.json +228 -0
  49. package/Main.js +1444 -0
  50. package/README.md +30 -175
  51. package/SECURITY.md +18 -0
  52. package/broadcast.js +44 -0
  53. package/index.js +414 -511
  54. package/logger.js +66 -0
  55. package/package.json +85 -370
  56. package/src/Dev_Horizon_Data.js +125 -0
  57. package/src/Dev_getThreadInfoOLD.js +422 -0
  58. package/src/Dev_shareTest2.js +68 -0
  59. package/src/Dev_shareTest3.js +71 -0
  60. package/src/Premium.js +25 -0
  61. package/src/Screenshot.js +83 -0
  62. package/src/addExternalModule.js +5 -14
  63. package/src/addUserToGroup.js +20 -56
  64. package/src/changeAdminStatus.js +20 -44
  65. package/src/changeArchivedStatus.js +11 -25
  66. package/src/{changeAvatarV2.js → changeAvt.js} +2 -3
  67. package/src/changeBio.js +15 -26
  68. package/src/changeBlockedStatus.js +8 -21
  69. package/src/changeGroupImage.js +24 -53
  70. package/src/changeNickname.js +13 -27
  71. package/src/changeThreadColor.js +19 -22
  72. package/src/changeThreadEmoji.js +11 -24
  73. package/src/createNewGroup.js +20 -38
  74. package/src/createPoll.js +16 -27
  75. package/src/deleteMessage.js +13 -24
  76. package/src/deleteThread.js +12 -25
  77. package/src/editMessage.js +53 -71
  78. package/src/forwardAttachment.js +15 -27
  79. package/src/getAccessToken.js +28 -0
  80. package/src/getCurrentUserID.js +1 -1
  81. package/src/getEmojiUrl.js +8 -10
  82. package/src/getFriendsList.js +15 -25
  83. package/src/getMessage.js +81 -813
  84. package/src/getThreadHistory.js +98 -241
  85. package/src/getThreadInfo.js +287 -90
  86. package/src/getThreadInfoOLD.js +422 -0
  87. package/src/getThreadList.js +157 -214
  88. package/src/getThreadMain.js +220 -0
  89. package/src/getThreadPictures.js +19 -39
  90. package/src/getUID.js +50 -113
  91. package/src/getUserID.js +14 -18
  92. package/src/getUserInfo.js +71 -65
  93. package/src/getUserInfoMain.js +65 -0
  94. package/src/getUserInfoV2.js +32 -0
  95. package/src/getUserInfoV3.js +63 -0
  96. package/src/getUserInfoV4.js +55 -0
  97. package/src/getUserInfoV5.js +61 -0
  98. package/src/handleFriendRequest.js +13 -24
  99. package/src/handleMessageRequest.js +20 -36
  100. package/src/httpGet.js +18 -34
  101. package/src/httpPost.js +18 -35
  102. package/src/httpPostFormData.js +24 -53
  103. package/src/listenMqtt.js +944 -680
  104. package/src/listenMqttV1.js +846 -0
  105. package/src/logout.js +15 -22
  106. package/src/markAsDelivered.js +15 -25
  107. package/src/markAsRead.js +27 -45
  108. package/src/markAsReadAll.js +14 -21
  109. package/src/markAsSeen.js +18 -28
  110. package/src/muteThread.js +12 -17
  111. package/src/removeUserFromGroup.js +17 -47
  112. package/src/resolvePhotoUrl.js +13 -21
  113. package/src/searchForThread.js +13 -23
  114. package/src/sendMessage.js +117 -178
  115. package/src/sendMqttMessage.js +71 -0
  116. package/src/sendTypingIndicator.js +16 -46
  117. package/src/setMessageReaction.js +20 -33
  118. package/src/setPostReaction.js +95 -105
  119. package/src/setTitle.js +18 -34
  120. package/src/shareContact.js +37 -92
  121. package/src/shareLink.js +4 -5
  122. package/src/threadColors.js +18 -110
  123. package/src/unfriend.js +9 -18
  124. package/src/unsendMessage.js +34 -31
  125. package/src/unsendMqttMessage.js +66 -0
  126. package/test/Database_Test.js +4 -0
  127. package/test/Db2.js +530 -0
  128. package/test/Shankar_Database/A_README.md +1 -0
  129. package/test/Shankar_Database/Database.db +0 -0
  130. package/test/data/shareAttach.js +1 -1
  131. package/test/env/.env +0 -0
  132. package/test/example-db.db +0 -0
  133. package/test/memoryleak.js +18 -0
  134. package/test/test.js +1 -1
  135. package/test/testname.js +1342 -0
  136. package/test/testv2.js +3 -0
  137. package/utils.js +2918 -1393
  138. package/CHANGELOG.md +0 -2
  139. package/LICENSE-MIT +0 -21
  140. package/generated-icon.png +0 -0
  141. package/replit.nix +0 -5
  142. package/shankar-fca.json +0 -4
  143. package/src/changeAvatar.js +0 -136
  144. package/src/changeBlockedStatusMqtt.js +0 -80
  145. package/src/changeCover.js +0 -73
  146. package/src/changeName.js +0 -79
  147. package/src/changeUsername.js +0 -59
  148. package/src/createCommentPost.js +0 -230
  149. package/src/createPost.js +0 -277
  150. package/src/data/getThreadInfo.json +0 -1
  151. package/src/editMessageOld.js +0 -67
  152. package/src/follow.js +0 -74
  153. package/src/getAccess.js +0 -112
  154. package/src/getAvatarUser.js +0 -78
  155. package/src/getRegion.js +0 -7
  156. package/src/getThreadHistoryDeprecated.js +0 -93
  157. package/src/getThreadInfoDeprecated.js +0 -80
  158. package/src/getThreadListDeprecated.js +0 -75
  159. package/src/listenNotification.js +0 -85
  160. package/src/pinMessage.js +0 -59
  161. package/src/refreshFb_dtsg.js +0 -89
  162. package/src/searchStickers.js +0 -53
  163. package/src/sendMessageMqtt.js +0 -322
  164. package/src/sendTypingIndicatorV2.js +0 -28
  165. package/src/setMessageReactionMqtt.js +0 -62
  166. package/src/setProfileGuard.js +0 -45
  167. package/src/setStoryReaction.js +0 -64
  168. package/src/stopListenMqtt.js +0 -26
  169. package/src/uploadAttachment.js +0 -94
@@ -1,93 +0,0 @@
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 getThreadHistory(threadID, amount, timestamp, 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, friendList) {
17
- if (err) {
18
- return rejectFunc(err);
19
- }
20
- resolveFunc(friendList);
21
- };
22
- }
23
-
24
- if (!callback) {
25
- throw { error: "getThreadHistory: need callback" };
26
- }
27
-
28
- var form = {
29
- client: "mercury"
30
- };
31
-
32
- api.getUserInfo(threadID, function(err, res) {
33
- if (err) {
34
- return callback(err);
35
- }
36
- var key = Object.keys(res).length > 0 ? "user_ids" : "thread_fbids";
37
- form["messages[" + key + "][" + threadID + "][offset]"] = 0;
38
- form["messages[" + key + "][" + threadID + "][timestamp]"] = timestamp;
39
- form["messages[" + key + "][" + threadID + "][limit]"] = amount;
40
-
41
- if (ctx.globalOptions.pageID)
42
- form.request_user_id = ctx.globalOptions.pageID;
43
-
44
- defaultFuncs
45
- .post(
46
- "https://www.facebook.com/ajax/mercury/thread_info.php",
47
- ctx.jar,
48
- form
49
- )
50
- .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
51
- .then(function(resData) {
52
- if (resData.error) {
53
- throw resData;
54
- } else if (!resData.payload) {
55
- throw { error: "Could not retrieve thread history." };
56
- }
57
-
58
- // Asking for message history from a thread with no message history
59
- // will return undefined for actions here
60
- if (!resData.payload.actions) {
61
- resData.payload.actions = [];
62
- }
63
-
64
- var userIDs = {};
65
- resData.payload.actions.forEach(function(v) {
66
- userIDs[v.author.split(":").pop()] = "";
67
- });
68
-
69
- api.getUserInfo(Object.keys(userIDs), function(err, data) {
70
- if (err) return callback(err); //callback({error: "Could not retrieve user information in getThreadHistory."});
71
-
72
- resData.payload.actions.forEach(function(v) {
73
- var sender = data[v.author.split(":").pop()];
74
- if (sender) v.sender_name = sender.name;
75
- else v.sender_name = "Facebook User";
76
- v.sender_fbid = v.author;
77
- delete v.author;
78
- });
79
-
80
- callback(
81
- null,
82
- resData.payload.actions.map(utils.formatHistoryMessage)
83
- );
84
- });
85
- })
86
- .catch(function(err) {
87
- log.error("getThreadHistory", err);
88
- return callback(err);
89
- });
90
- });
91
- return returnPromise;
92
- };
93
- };
@@ -1,80 +0,0 @@
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 getThreadInfo(threadID, 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, friendList) {
17
- if (err) {
18
- return rejectFunc(err);
19
- }
20
- resolveFunc(friendList);
21
- };
22
- }
23
-
24
- var form = {
25
- client: "mercury"
26
- };
27
-
28
- api.getUserInfo(threadID, function(err, userRes) {
29
- if (err) {
30
- return callback(err);
31
- }
32
- var key = Object.keys(userRes).length > 0 ? "user_ids" : "thread_fbids";
33
- form["threads[" + key + "][0]"] = threadID;
34
-
35
- if (ctx.globalOptions.pageId)
36
- form.request_user_id = ctx.globalOptions.pageId;
37
-
38
- defaultFuncs
39
- .post(
40
- "https://www.facebook.com/ajax/mercury/thread_info.php",
41
- ctx.jar,
42
- form
43
- )
44
- .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
45
- .then(function(resData) {
46
- if (resData.error) {
47
- throw resData;
48
- } else if (!resData.payload) {
49
- throw {
50
- error: "Could not retrieve thread Info."
51
- };
52
- }
53
- var threadData = resData.payload.threads[0];
54
- var userData = userRes[threadID];
55
-
56
- if (threadData == null) {
57
- throw {
58
- error: "ThreadData is null"
59
- };
60
- }
61
-
62
- threadData.name =
63
- userData != null && userData.name != null
64
- ? userData.name
65
- : threadData.name;
66
- threadData.image_src =
67
- userData != null && userData.thumbSrc != null
68
- ? userData.thumbSrc
69
- : threadData.image_src;
70
-
71
- callback(null, utils.formatThread(threadData));
72
- })
73
- .catch(function(err) {
74
- log.error("getThreadInfo", err);
75
- return callback(err);
76
- });
77
- });
78
- return returnPromise;
79
- };
80
- };
@@ -1,75 +0,0 @@
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 getThreadList(start, end, type, callback) {
8
- if (utils.getType(callback) === "Undefined") {
9
- if (utils.getType(end) !== "Number") {
10
- throw {
11
- error: "Please pass a number as a second argument."
12
- };
13
- } else if (
14
- utils.getType(type) === "Function" ||
15
- utils.getType(type) === "AsyncFunction"
16
- ) {
17
- callback = type;
18
- type = "inbox"; //default to inbox
19
- } else if (utils.getType(type) !== "String") {
20
- throw {
21
- error:
22
- "Please pass a String as a third argument. Your options are: inbox, pending, and archived"
23
- };
24
- } else {
25
- throw {
26
- error: "getThreadList: need callback"
27
- };
28
- }
29
- }
30
-
31
- if (type === "archived") {
32
- type = "action:archived";
33
- } else if (type !== "inbox" && type !== "pending" && type !== "other") {
34
- throw {
35
- error:
36
- "type can only be one of the following: inbox, pending, archived, other"
37
- };
38
- }
39
-
40
- if (end <= start) end = start + 20;
41
-
42
- var form = {
43
- client: "mercury"
44
- };
45
-
46
- form[type + "[offset]"] = start;
47
- form[type + "[limit]"] = end - start;
48
-
49
- if (ctx.globalOptions.pageID) {
50
- form.request_user_id = ctx.globalOptions.pageID;
51
- }
52
-
53
- defaultFuncs
54
- .post(
55
- "https://www.facebook.com/ajax/mercury/threadlist_info.php",
56
- ctx.jar,
57
- form
58
- )
59
- .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
60
- .then(function(resData) {
61
- if (resData.error) {
62
- throw resData;
63
- }
64
- log.verbose("getThreadList", JSON.stringify(resData.payload.threads));
65
- return callback(
66
- null,
67
- (resData.payload.threads || []).map(utils.formatThread)
68
- );
69
- })
70
- .catch(function(err) {
71
- log.error("getThreadList", err);
72
- return callback(err);
73
- });
74
- };
75
- };
@@ -1,85 +0,0 @@
1
- 'use strict';
2
-
3
- var utils = require('../utils');
4
- var log = require('npmlog');
5
- var EventEmitter = require('node:events');
6
-
7
- function format(res, globalCallback) {
8
- var checkMinutes = (date_1, date_2) => {
9
- let ms_1 = date_1.getTime();
10
- let ms_2 = date_2.getTime();
11
- return Math.ceil((ms_2 - ms_1) / (60 * 1000));
12
- }
13
-
14
- for (let index of res.notifications_page.edges) {
15
- if (index.node.row_type !== 'NOTIFICATION') continue;
16
-
17
- var timestamp = index.node.notif.creation_time.timestamp;
18
- if (checkMinutes(new Date(timestamp * 1000), new Date()) <= 1)
19
- globalCallback(null, {
20
- id: res.node.notif.id,
21
- noti_id: res.node.notif.notif_id,
22
- body: index.node.notif.body.text,
23
- url: index.node.notif.url,
24
- timestamp: timestamp * 1000
25
- });
26
- }
27
- }
28
-
29
- module.exports = function (defaultFuncs, api, ctx) {
30
- let globalCallback, interval;
31
-
32
- function MessageRepeat() {
33
- interval = setInterval(function () {
34
- return defaultFuncs
35
- .post('https://www.facebook.com/api/graphql/', ctx.jar, {
36
- fb_api_req_friendly_name: 'CometNotificationsRootQuery',
37
- doc_id: 6663491207045267,
38
- variables: JSON.stringify({
39
- count: 5,
40
- environment: 'MAIN_SURFACE',
41
- filter_tokens: ['Cg8CZnQPA2FsbAE='],
42
- scale: 1
43
- }),
44
- server_timestamps: !0
45
- })
46
- .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
47
- .then(function (res) {
48
- if (res.error || res.errors)
49
- throw res;
50
-
51
- return format(res.data.viewer, globalCallback);
52
- })
53
- .catch(function (err) {
54
- log.error('listenNotification', err);
55
- clearInterval(interval);
56
- interval = void 0;
57
- return globalCallback(err);
58
- });
59
- }, 60 * 1000);
60
- }
61
-
62
- return function notification(callback) {
63
- class MessageEmitter extends EventEmitter {
64
- stop() {
65
- globalCallback = () => {}
66
-
67
- if (interval) {
68
- clearInterval(interval);
69
- interval = void 0;
70
- }
71
- Message.emit('stop', new Date());
72
- }
73
- }
74
-
75
- var Message = new MessageEmitter();
76
-
77
- if (typeof callback == 'function')
78
- globalCallback = callback;
79
- else
80
- globalCallback = (error, message) => error ? Message.emit('error', error) : Message.emit('message', message);
81
-
82
- MessageRepeat();
83
- return Message;
84
- }
85
- }
package/src/pinMessage.js DELETED
@@ -1,59 +0,0 @@
1
-
2
- 'use strict';
3
-
4
- const { generateOfflineThreadingID } = require('../utils');
5
-
6
- function isCallable(func) {
7
- try {
8
- Reflect.apply(func, null, []);
9
- return true;
10
- } catch (error) {
11
- return false;
12
- }
13
- }
14
-
15
- module.exports = function (defaultFuncs, api, ctx) {
16
- return function pinMessage(pinMode, messageID, threadID, callback) {
17
- if (!ctx.mqttClient) {
18
- throw new Error('Not connected to MQTT');
19
- }
20
-
21
- ctx.wsReqNumber += 1;
22
- ctx.wsTaskNumber += 1;
23
-
24
- const taskLabel = pinMode ? '430' : '431';
25
- const queueNamePrefix = pinMode ? 'pin_msg_v2_' : 'unpin_msg_v2_';
26
-
27
- const taskPayload = {
28
- thread_key: threadID,
29
- message_id: messageID,
30
- timestamp_ms: Date.now(),
31
- };
32
-
33
- const task = {
34
- failure_count: null,
35
- label: taskLabel,
36
- payload: JSON.stringify(taskPayload),
37
- queue_name: `${queueNamePrefix}${threadID}`,
38
- task_id: ctx.wsTaskNumber,
39
- };
40
-
41
- const content = {
42
- app_id: '2220391788200892',
43
- payload: JSON.stringify({
44
- data_trace_id: null,
45
- epoch_id: parseInt(generateOfflineThreadingID()),
46
- tasks: [task],
47
- version_id: '25095469420099952',
48
- }),
49
- request_id: ctx.wsReqNumber,
50
- type: 3,
51
- };
52
-
53
- if (isCallable(callback)) {
54
- ctx.reqCallbacks[ctx.wsReqNumber] = callback;
55
- }
56
-
57
- ctx.mqttClient.publish('/ls_req', JSON.stringify(content), { qos: 1, retain: false });
58
- };
59
- };
@@ -1,89 +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 (
23
- utils.getType(obj) === "Function" ||
24
- utils.getType(obj) === "AsyncFunction"
25
- ) {
26
- callback = obj;
27
- obj = {};
28
- }
29
-
30
- if (!obj) {
31
- obj = {};
32
- }
33
-
34
- if (utils.getType(obj) !== "Object") {
35
- throw new utils.CustomError(
36
- "the first parameter must be an object or a callback function",
37
- );
38
- }
39
-
40
- if (!callback) {
41
- callback = function (err, friendList) {
42
- if (err) {
43
- return rejectFunc(err);
44
- }
45
- resolveFunc(friendList);
46
- };
47
- }
48
-
49
- if (Object.keys(obj).length == 0) {
50
- utils
51
- .get("https://m.facebook.com/", ctx.jar, null, ctx.globalOptions, {
52
- noRef: true,
53
- })
54
- .then(function (resData) {
55
- const html = resData.body;
56
- const fb_dtsg = utils.getFrom(html, 'name="fb_dtsg" value="', '"');
57
- const jazoest = utils.getFrom(html, 'name="jazoest" value="', '"');
58
- if (!fb_dtsg) {
59
- throw new utils.CustomError(
60
- "Could not find fb_dtsg in HTML after requesting https://www.facebook.com/",
61
- );
62
- }
63
- ctx.fb_dtsg = fb_dtsg;
64
- ctx.jazoest = jazoest;
65
- callback(null, {
66
- data: {
67
- fb_dtsg: fb_dtsg,
68
- jazoest: jazoest,
69
- },
70
- message: "refreshed fb_dtsg and jazoest",
71
- });
72
- })
73
- .catch(function (err) {
74
- log.error("refreshFb_dtsg", err);
75
- return callback(err);
76
- });
77
- } else {
78
- Object.keys(obj).forEach(function (key) {
79
- ctx[key] = obj[key];
80
- });
81
- callback(null, {
82
- data: obj,
83
- message: "refreshed " + Object.keys(obj).join(", "),
84
- });
85
- }
86
-
87
- return returnPromise;
88
- };
89
- };
@@ -1,53 +0,0 @@
1
-
2
- 'use strict';
3
-
4
- var utils = require('../utils.js');
5
- var log = require('npmlog');
6
-
7
- module.exports = function (http, api, ctx) {
8
- function formatData(res) {
9
- return {
10
- id: res.node.id,
11
- image: res.node.image,
12
- package: res.node.pack != null ? {
13
- name: res.node.pack.name,
14
- id: res.node.pack.id
15
- } : {},
16
- label: res.node.label
17
- };
18
- }
19
-
20
- return function searchStickers(query = '', callback) {
21
- var cb;
22
- var returnPromise = new Promise(function (resolve, reject) {
23
- cb = function (error, data) {
24
- data ? resolve(data) : reject(error);
25
- }
26
- });
27
-
28
- if (typeof callback == 'function') cb = callback;
29
-
30
- var form = {
31
- fb_api_req_friendly_name: 'StickersFlyoutTagSelectorQuery',
32
- variables: JSON.stringify({
33
- stickerWidth: 64,
34
- stickerHeight: 64,
35
- stickerInterface: 'messages',
36
- query
37
- }),
38
- doc_id: '4642836929159953'
39
- }
40
- http
41
- .post('https://www.facebook.com/api/graphql/', ctx.jar, form)
42
- .then(utils.parseAndCheckLogin(ctx, http))
43
- .then(function (res) {
44
- return cb(null, res.data.sticker_search.sticker_results.edges.map(formatData));
45
- })
46
- .catch(function (err) {
47
- log.error('searchStickers', err);
48
- return cb(err);
49
- });
50
- return returnPromise;
51
- }
52
- }
53
-