fb-nextgen 1.0.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of fb-nextgen might be problematic. Click here for more details.

Files changed (76) hide show
  1. package/.cache/replit/__replit_disk_meta.json +1 -0
  2. package/.cache/replit/nix/env.json +1 -0
  3. package/.config/configstore/update-notifier-npm.json +4 -0
  4. package/.github/workflows/nodejs.yml +26 -0
  5. package/.github/workflows/npmpublish.yml +30 -0
  6. package/.travis.yml +6 -0
  7. package/LICENSE-MIT +21 -0
  8. package/README.md +216 -0
  9. package/index.js +613 -0
  10. package/package.json +108 -0
  11. package/replit.nix +6 -0
  12. package/src/addExternalModule.js +19 -0
  13. package/src/addUserToGroup.js +113 -0
  14. package/src/changeAdminStatus.js +79 -0
  15. package/src/changeArchivedStatus.js +55 -0
  16. package/src/changeBio.js +77 -0
  17. package/src/changeBlockedStatus.js +47 -0
  18. package/src/changeGroupImage.js +129 -0
  19. package/src/changeNickname.js +59 -0
  20. package/src/changeThreadColor.js +71 -0
  21. package/src/changeThreadEmoji.js +55 -0
  22. package/src/createNewGroup.js +86 -0
  23. package/src/createPoll.js +71 -0
  24. package/src/deleteMessage.js +56 -0
  25. package/src/deleteThread.js +56 -0
  26. package/src/forwardAttachment.js +60 -0
  27. package/src/getCurrentUserID.js +7 -0
  28. package/src/getEmojiUrl.js +29 -0
  29. package/src/getFriendsList.js +84 -0
  30. package/src/getThreadHistory.js +645 -0
  31. package/src/getThreadHistoryDeprecated.js +93 -0
  32. package/src/getThreadInfo.js +148 -0
  33. package/src/getThreadInfoDeprecated.js +80 -0
  34. package/src/getThreadList.js +238 -0
  35. package/src/getThreadListDeprecated.js +75 -0
  36. package/src/getThreadPictures.js +79 -0
  37. package/src/getUserID.js +66 -0
  38. package/src/getUserInfo.js +76 -0
  39. package/src/handleFriendRequest.js +61 -0
  40. package/src/handleMessageRequest.js +65 -0
  41. package/src/httpGet.js +52 -0
  42. package/src/httpPost.js +52 -0
  43. package/src/listenMqtt.js +788 -0
  44. package/src/logout.js +75 -0
  45. package/src/markAsDelivered.js +58 -0
  46. package/src/markAsRead.js +80 -0
  47. package/src/markAsReadAll.js +50 -0
  48. package/src/markAsSeen.js +59 -0
  49. package/src/muteThread.js +52 -0
  50. package/src/removeUserFromGroup.js +79 -0
  51. package/src/resolvePhotoUrl.js +37 -0
  52. package/src/searchForThread.js +53 -0
  53. package/src/sendMessage.js +383 -0
  54. package/src/sendTypingIndicator.js +103 -0
  55. package/src/setMessageReaction.js +117 -0
  56. package/src/setPostReaction.js +76 -0
  57. package/src/setTitle.js +86 -0
  58. package/src/threadColors.js +57 -0
  59. package/src/unfriend.js +52 -0
  60. package/src/unsendMessage.js +49 -0
  61. package/src-cmd/bard.js +5048 -0
  62. package/src-cmd/gptdm.js +4175 -0
  63. package/src-cmd/gptgo.js +4253 -0
  64. package/src-cmd/gscholar.js +3747 -0
  65. package/src-cmd/openai.js +7370 -0
  66. package/src-cmd/playstore.js +1 -0
  67. package/src-cmd/skibiditoilet.js +4034 -0
  68. package/test/data/shareAttach.js +146 -0
  69. package/test/data/something.mov +0 -0
  70. package/test/data/test.png +0 -0
  71. package/test/data/test.txt +7 -0
  72. package/test/example-config.json +18 -0
  73. package/test/test-page.js +140 -0
  74. package/test/test.js +385 -0
  75. package/uptime.js +1 -0
  76. package/utils.js +1241 -0
@@ -0,0 +1,79 @@
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 getThreadPictures(threadID, offset, limit, 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
+ thread_id: threadID,
26
+ offset: offset,
27
+ limit: limit
28
+ };
29
+
30
+ defaultFuncs
31
+ .post(
32
+ "https://www.facebook.com/ajax/messaging/attachments/sharedphotos.php",
33
+ ctx.jar,
34
+ form
35
+ )
36
+ .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
37
+ .then(function(resData) {
38
+ if (resData.error) {
39
+ throw resData;
40
+ }
41
+ return Promise.all(
42
+ resData.payload.imagesData.map(function(image) {
43
+ form = {
44
+ thread_id: threadID,
45
+ image_id: image.fbid
46
+ };
47
+ return defaultFuncs
48
+ .post(
49
+ "https://www.facebook.com/ajax/messaging/attachments/sharedphotos.php",
50
+ ctx.jar,
51
+ form
52
+ )
53
+ .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
54
+ .then(function(resData) {
55
+ if (resData.error) {
56
+ throw resData;
57
+ }
58
+ // the response is pretty messy
59
+ var queryThreadID =
60
+ resData.jsmods.require[0][3][1].query_metadata.query_path[0]
61
+ .message_thread;
62
+ var imageData =
63
+ resData.jsmods.require[0][3][1].query_results[queryThreadID]
64
+ .message_images.edges[0].node.image2;
65
+ return imageData;
66
+ });
67
+ })
68
+ );
69
+ })
70
+ .then(function(resData) {
71
+ callback(null, resData);
72
+ })
73
+ .catch(function(err) {
74
+ log.error("Error in getThreadPictures", err);
75
+ callback(err);
76
+ });
77
+ return returnPromise;
78
+ };
79
+ };
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+
3
+ var utils = require("../utils");
4
+ var log = require("npmlog");
5
+
6
+ function formatData(data) {
7
+ return {
8
+ userID: utils.formatID(data.uid.toString()),
9
+ photoUrl: data.photo,
10
+ indexRank: data.index_rank,
11
+ name: data.text,
12
+ isVerified: data.is_verified,
13
+ profileUrl: data.path,
14
+ category: data.category,
15
+ score: data.score,
16
+ type: data.type
17
+ };
18
+ }
19
+
20
+ module.exports = function(defaultFuncs, api, ctx) {
21
+ return function getUserID(name, 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, friendList) {
31
+ if (err) {
32
+ return rejectFunc(err);
33
+ }
34
+ resolveFunc(friendList);
35
+ };
36
+ }
37
+
38
+ var form = {
39
+ value: name.toLowerCase(),
40
+ viewer: ctx.userID,
41
+ rsp: "search",
42
+ context: "search",
43
+ path: "/home.php",
44
+ request_id: utils.getGUID()
45
+ };
46
+
47
+ defaultFuncs
48
+ .get("https://www.facebook.com/ajax/typeahead/search.php", ctx.jar, form)
49
+ .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
50
+ .then(function(resData) {
51
+ if (resData.error) {
52
+ throw resData;
53
+ }
54
+
55
+ var data = resData.payload.entries;
56
+
57
+ callback(null, data.map(formatData));
58
+ })
59
+ .catch(function(err) {
60
+ log.error("getUserID", err);
61
+ return callback(err);
62
+ });
63
+
64
+ return returnPromise;
65
+ };
66
+ };
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+
3
+ var utils = require("../utils");
4
+ var log = require("npmlog");
5
+
6
+ function formatData(data) {
7
+ var retObj = {};
8
+ var genderMap = {
9
+ 1: "female",
10
+ 2: "male",
11
+ };
12
+
13
+ for (var prop in data) {
14
+ if (data.hasOwnProperty(prop)) {
15
+ var innerObj = data[prop];
16
+ const profilePicUrl = `https://graph.facebook.com/${prop}/picture?width=720&height=720&access_token=6628568379%7Cc1e620fa708a1d5696fb991c1bde5662`;
17
+
18
+ var genderValue = genderMap[innerObj.gender] || `Gender ${innerObj.gender}`;
19
+
20
+ retObj[prop] = {
21
+ name: innerObj.name,
22
+ firstName: innerObj.firstName,
23
+ uid: prop,
24
+ vanity: innerObj.vanity,
25
+ thumbSrc: innerObj.thumbSrc,
26
+ profileUrl: innerObj.uri,
27
+ gender: genderValue,
28
+ type: innerObj.type,
29
+ isFriend: innerObj.is_friend,
30
+ isBirthday: innerObj.is_birthday,
31
+ highResProfilePic: profilePicUrl
32
+ };
33
+ }
34
+ }
35
+
36
+ return retObj;
37
+ }
38
+
39
+
40
+ module.exports = function (defaultFuncs, api, ctx) {
41
+ return function getUserInfo(id, callback) {
42
+ var resolveFunc = function () { };
43
+ var rejectFunc = function () { };
44
+ var returnPromise = new Promise(function (resolve, reject) {
45
+ resolveFunc = resolve;
46
+ rejectFunc = reject;
47
+ });
48
+
49
+ if (!callback) {
50
+ callback = function (err, userInfo) {
51
+ if (err) return rejectFunc(err);
52
+ resolveFunc(userInfo);
53
+ };
54
+ }
55
+
56
+ if (utils.getType(id) !== "Array") id = [id];
57
+
58
+ var form = {};
59
+ id.map(function (v, i) {
60
+ form["ids[" + i + "]"] = v;
61
+ });
62
+ defaultFuncs
63
+ .post("https://www.facebook.com/chat/user_info/", ctx.jar, form)
64
+ .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
65
+ .then(function (resData) {
66
+ if (resData.error) throw resData;
67
+ return callback(null, formatData(resData.payload.profiles));
68
+ })
69
+ .catch(function (err) {
70
+ log.error("getUserInfo", "Path: getUserInfo God's Spam Cake Too Much!,Let's Try Again !");
71
+ return callback(err);
72
+ });
73
+
74
+ return returnPromise;
75
+ };
76
+ };
@@ -0,0 +1,61 @@
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 handleFriendRequest(userID, accept, callback) {
8
+ if (utils.getType(accept) !== "Boolean") {
9
+ throw {
10
+ error: "Please pass a boolean as a second argument."
11
+ };
12
+ }
13
+
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 (!callback) {
22
+ callback = function (err, friendList) {
23
+ if (err) {
24
+ return rejectFunc(err);
25
+ }
26
+ resolveFunc(friendList);
27
+ };
28
+ }
29
+
30
+ var form = {
31
+ viewer_id: ctx.userID,
32
+ "frefs[0]": "jwl",
33
+ floc: "friend_center_requests",
34
+ ref: "/reqs.php",
35
+ action: (accept ? "confirm" : "reject")
36
+ };
37
+
38
+ defaultFuncs
39
+ .post(
40
+ "https://www.facebook.com/requests/friends/ajax/",
41
+ ctx.jar,
42
+ form
43
+ )
44
+ .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
45
+ .then(function(resData) {
46
+ if (resData.payload.err) {
47
+ throw {
48
+ err: resData.payload.err
49
+ };
50
+ }
51
+
52
+ return callback();
53
+ })
54
+ .catch(function(err) {
55
+ log.error("handleFriendRequest", err);
56
+ return callback(err);
57
+ });
58
+
59
+ return returnPromise;
60
+ };
61
+ };
@@ -0,0 +1,65 @@
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 handleMessageRequest(threadID, accept, callback) {
8
+ if (utils.getType(accept) !== "Boolean") {
9
+ throw {
10
+ error: "Please pass a boolean as a second argument."
11
+ };
12
+ }
13
+
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 (!callback) {
22
+ callback = function (err, friendList) {
23
+ if (err) {
24
+ return rejectFunc(err);
25
+ }
26
+ resolveFunc(friendList);
27
+ };
28
+ }
29
+
30
+ var form = {
31
+ client: "mercury"
32
+ };
33
+
34
+ if (utils.getType(threadID) !== "Array") {
35
+ threadID = [threadID];
36
+ }
37
+
38
+ var messageBox = accept ? "inbox" : "other";
39
+
40
+ for (var i = 0; i < threadID.length; i++) {
41
+ form[messageBox + "[" + i + "]"] = threadID[i];
42
+ }
43
+
44
+ defaultFuncs
45
+ .post(
46
+ "https://www.facebook.com/ajax/mercury/move_thread.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
+ }
55
+
56
+ return callback();
57
+ })
58
+ .catch(function(err) {
59
+ log.error("handleMessageRequest", err);
60
+ return callback(err);
61
+ });
62
+
63
+ return returnPromise;
64
+ };
65
+ };
package/src/httpGet.js ADDED
@@ -0,0 +1,52 @@
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 httpGet(url, form, callback, notAPI) {
8
+ var resolveFunc = function(){};
9
+ var rejectFunc = function(){};
10
+
11
+ var returnPromise = new Promise(function (resolve, reject) {
12
+ resolveFunc = resolve;
13
+ rejectFunc = reject;
14
+ });
15
+
16
+ if (!callback && (utils.getType(form) == "Function" || utils.getType(form) == "AsyncFunction")) {
17
+ callback = form;
18
+ form = {};
19
+ }
20
+
21
+ form = form || {};
22
+
23
+ callback = callback || function(err, data) {
24
+ if (err) return rejectFunc(err);
25
+ resolveFunc(data);
26
+ };
27
+
28
+ if (notAPI) {
29
+ utils
30
+ .get(url, ctx.jar, form, ctx.globalOptions)
31
+ .then(function(resData) {
32
+ callback(null, resData.body.toString());
33
+ })
34
+ .catch(function(err) {
35
+ log.error("httpGet", err);
36
+ return callback(err);
37
+ });
38
+ } else {
39
+ defaultFuncs
40
+ .get(url, ctx.jar, form)
41
+ .then(function(resData) {
42
+ callback(null, resData.body.toString());
43
+ })
44
+ .catch(function(err) {
45
+ log.error("httpGet", err);
46
+ return callback(err);
47
+ });
48
+ }
49
+
50
+ return returnPromise;
51
+ };
52
+ };
@@ -0,0 +1,52 @@
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 httpGet(url, form, callback, notAPI) {
8
+ var resolveFunc = function(){};
9
+ var rejectFunc = function(){};
10
+
11
+ var returnPromise = new Promise(function (resolve, reject) {
12
+ resolveFunc = resolve;
13
+ rejectFunc = reject;
14
+ });
15
+
16
+ if (!callback && (utils.getType(form) == "Function" || utils.getType(form) == "AsyncFunction")) {
17
+ callback = form;
18
+ form = {};
19
+ }
20
+
21
+ form = form || {};
22
+
23
+ callback = callback || function(err, data) {
24
+ if (err) return rejectFunc(err);
25
+ resolveFunc(data);
26
+ };
27
+
28
+ if (notAPI) {
29
+ utils
30
+ .post(url, ctx.jar, form, ctx.globalOptions)
31
+ .then(function(resData) {
32
+ callback(null, resData.body.toString());
33
+ })
34
+ .catch(function(err) {
35
+ log.error("httpPost", err);
36
+ return callback(err);
37
+ });
38
+ } else {
39
+ defaultFuncs
40
+ .post(url, ctx.jar, form, {})
41
+ .then(function(resData) {
42
+ callback(null, resData.body.toString());
43
+ })
44
+ .catch(function(err) {
45
+ log.error("httpPost", err);
46
+ return callback(err);
47
+ });
48
+ }
49
+
50
+ return returnPromise;
51
+ };
52
+ };