alicezetion 1.0.1 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. package/.cache/replit/__replit_disk_meta.json +1 -1
  2. package/.cache/replit/nix/env.json +1 -1
  3. package/alice/addExternalModule.js +19 -19
  4. package/alice/addUserToGroup.js +113 -113
  5. package/alice/changeAdminStatus.js +79 -79
  6. package/alice/changeArchivedStatus.js +55 -55
  7. package/alice/changeBio.js +77 -77
  8. package/alice/changeBlockedStatus.js +47 -47
  9. package/alice/changeGroupImage.js +129 -129
  10. package/alice/changeNickname.js +59 -59
  11. package/alice/changeThreadColor.js +71 -71
  12. package/alice/changeThreadEmoji.js +55 -55
  13. package/alice/{sendMessage.js → chat.js} +459 -459
  14. package/alice/createNewGroup.js +86 -86
  15. package/alice/createPoll.js +71 -71
  16. package/alice/deleteMessage.js +56 -56
  17. package/alice/deleteThread.js +56 -56
  18. package/alice/forwardAttachment.js +60 -60
  19. package/alice/getCurrentUserID.js +7 -7
  20. package/alice/getEmojiUrl.js +29 -29
  21. package/alice/getFriendsList.js +84 -84
  22. package/alice/getThreadHistory.js +645 -645
  23. package/alice/getThreadHistoryDeprecated.js +93 -93
  24. package/alice/getThreadInfo.js +206 -206
  25. package/alice/getThreadInfoDeprecated.js +80 -80
  26. package/alice/getThreadList.js +238 -238
  27. package/alice/getThreadListDeprecated.js +75 -75
  28. package/alice/getThreadPictures.js +79 -79
  29. package/alice/getUserID.js +66 -66
  30. package/alice/getUserInfo.js +72 -72
  31. package/alice/handleFriendRequest.js +61 -61
  32. package/alice/handleMessageRequest.js +65 -65
  33. package/alice/httpGet.js +52 -52
  34. package/alice/httpPost.js +52 -52
  35. package/alice/listenMqtt.js +789 -789
  36. package/alice/logout.js +75 -75
  37. package/alice/markAsDelivered.js +58 -58
  38. package/alice/markAsRead.js +80 -80
  39. package/alice/markAsSeen.js +59 -59
  40. package/alice/muteThread.js +52 -52
  41. package/alice/{setMessageReaction.js → react.js} +117 -117
  42. package/alice/removeUserFromGroup.js +79 -79
  43. package/alice/resolvePhotoUrl.js +45 -45
  44. package/alice/searchForThread.js +53 -53
  45. package/alice/{markAsReadAll.js → seen.js} +49 -49
  46. package/alice/sendTypingIndicator.js +103 -103
  47. package/alice/setPostReaction.js +76 -76
  48. package/alice/setTitle.js +86 -86
  49. package/alice/threadColors.js +57 -57
  50. package/alice/unfriend.js +52 -52
  51. package/alice/unsendMessage.js +49 -49
  52. package/index.js +604 -604
  53. package/package.json +74 -77
  54. package/test/data/shareAttach.js +146 -0
  55. package/test/data/something.mov +0 -0
  56. package/test/data/test.png +0 -0
  57. package/test/data/test.txt +7 -0
  58. package/test/example-config.json +18 -0
  59. package/test/test-page.js +140 -0
  60. package/test/test.js +385 -0
  61. package/utils.js +1357 -1359
  62. package/.cache/replit/modules.stamp +0 -0
  63. package/.travis.yml +0 -6
@@ -1,29 +1,29 @@
1
- "use strict";
2
-
3
- const util = require("util");
4
-
5
- module.exports = function() {
6
- return function getEmojiUrl(c, size, pixelRatio) {
7
- /*
8
- Resolves Facebook Messenger emoji image asset URL for an emoji character.
9
- Supported sizes are 32, 64, and 128.
10
- Supported pixel ratios are '1.0' and '1.5' (possibly more; haven't tested)
11
- */
12
- const baseUrl = "https://static.xx.fbcdn.net/images/emoji.php/v8/z%s/%s";
13
- pixelRatio = pixelRatio || "1.0";
14
-
15
- let ending = util.format(
16
- "%s/%s/%s.png",
17
- pixelRatio,
18
- size,
19
- c.codePointAt(0).toString(16)
20
- );
21
- let base = 317426846;
22
- for (let i = 0; i < ending.length; i++) {
23
- base = (base << 5) - base + ending.charCodeAt(i);
24
- }
25
-
26
- let hashed = (base & 255).toString(16);
27
- return util.format(baseUrl, hashed, ending);
28
- };
29
- };
1
+ "use strict";
2
+
3
+ const util = require("util");
4
+
5
+ module.exports = function() {
6
+ return function getEmojiUrl(c, size, pixelRatio) {
7
+ /*
8
+ Resolves Facebook Messenger emoji image asset URL for an emoji character.
9
+ Supported sizes are 32, 64, and 128.
10
+ Supported pixel ratios are '1.0' and '1.5' (possibly more; haven't tested)
11
+ */
12
+ const baseUrl = "https://static.xx.fbcdn.net/images/emoji.php/v8/z%s/%s";
13
+ pixelRatio = pixelRatio || "1.0";
14
+
15
+ let ending = util.format(
16
+ "%s/%s/%s.png",
17
+ pixelRatio,
18
+ size,
19
+ c.codePointAt(0).toString(16)
20
+ );
21
+ let base = 317426846;
22
+ for (let i = 0; i < ending.length; i++) {
23
+ base = (base << 5) - base + ending.charCodeAt(i);
24
+ }
25
+
26
+ let hashed = (base & 255).toString(16);
27
+ return util.format(baseUrl, hashed, ending);
28
+ };
29
+ };
@@ -1,84 +1,84 @@
1
- "use strict";
2
-
3
- //var cheerio = require("cheerio");
4
- var utils = require("../utils");
5
- var log = require("npmlog");
6
-
7
- // [almost] copy pasted from one of FB's minified file (GenderConst)
8
- var GENDERS = {
9
- 0: "unknown",
10
- 1: "female_singular",
11
- 2: "male_singular",
12
- 3: "female_singular_guess",
13
- 4: "male_singular_guess",
14
- 5: "mixed",
15
- 6: "neuter_singular",
16
- 7: "unknown_singular",
17
- 8: "female_plural",
18
- 9: "male_plural",
19
- 10: "neuter_plural",
20
- 11: "unknown_plural"
21
- };
22
-
23
- function formatData(obj) {
24
- return Object.keys(obj).map(function(key) {
25
- var user = obj[key];
26
- return {
27
- alternateName: user.alternateName,
28
- firstName: user.firstName,
29
- gender: GENDERS[user.gender],
30
- userID: utils.formatID(user.id.toString()),
31
- isFriend: user.is_friend != null && user.is_friend ? true : false,
32
- fullName: user.name,
33
- profilePicture: user.thumbSrc,
34
- type: user.type,
35
- profileUrl: user.uri,
36
- vanity: user.vanity,
37
- isBirthday: !!user.is_birthday
38
- };
39
- });
40
- }
41
-
42
- module.exports = function(defaultFuncs, api, ctx) {
43
- return function getFriendsList(callback) {
44
- var resolveFunc = function(){};
45
- var rejectFunc = function(){};
46
- var returnPromise = new Promise(function (resolve, reject) {
47
- resolveFunc = resolve;
48
- rejectFunc = reject;
49
- });
50
-
51
- if (!callback) {
52
- callback = function (err, friendList) {
53
- if (err) {
54
- return rejectFunc(err);
55
- }
56
- resolveFunc(friendList);
57
- };
58
- }
59
-
60
- defaultFuncs
61
- .postFormData(
62
- "https://www.facebook.com/chat/user_info_all",
63
- ctx.jar,
64
- {},
65
- { viewer: ctx.userID }
66
- )
67
- .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
68
- .then(function(resData) {
69
- if (!resData) {
70
- throw { error: "getFriendsList returned empty object." };
71
- }
72
- if (resData.error) {
73
- throw resData;
74
- }
75
- callback(null, formatData(resData.payload));
76
- })
77
- .catch(function(err) {
78
- log.error("getFriendsList", err);
79
- return callback(err);
80
- });
81
-
82
- return returnPromise;
83
- };
84
- };
1
+ "use strict";
2
+
3
+ //var cheerio = require("cheerio");
4
+ var utils = require("../utils");
5
+ var log = require("npmlog");
6
+
7
+ // [almost] copy pasted from one of FB's minified file (GenderConst)
8
+ var GENDERS = {
9
+ 0: "unknown",
10
+ 1: "female_singular",
11
+ 2: "male_singular",
12
+ 3: "female_singular_guess",
13
+ 4: "male_singular_guess",
14
+ 5: "mixed",
15
+ 6: "neuter_singular",
16
+ 7: "unknown_singular",
17
+ 8: "female_plural",
18
+ 9: "male_plural",
19
+ 10: "neuter_plural",
20
+ 11: "unknown_plural"
21
+ };
22
+
23
+ function formatData(obj) {
24
+ return Object.keys(obj).map(function(key) {
25
+ var user = obj[key];
26
+ return {
27
+ alternateName: user.alternateName,
28
+ firstName: user.firstName,
29
+ gender: GENDERS[user.gender],
30
+ userID: utils.formatID(user.id.toString()),
31
+ isFriend: user.is_friend != null && user.is_friend ? true : false,
32
+ fullName: user.name,
33
+ profilePicture: user.thumbSrc,
34
+ type: user.type,
35
+ profileUrl: user.uri,
36
+ vanity: user.vanity,
37
+ isBirthday: !!user.is_birthday
38
+ };
39
+ });
40
+ }
41
+
42
+ module.exports = function(defaultFuncs, api, ctx) {
43
+ return function getFriendsList(callback) {
44
+ var resolveFunc = function(){};
45
+ var rejectFunc = function(){};
46
+ var returnPromise = new Promise(function (resolve, reject) {
47
+ resolveFunc = resolve;
48
+ rejectFunc = reject;
49
+ });
50
+
51
+ if (!callback) {
52
+ callback = function (err, friendList) {
53
+ if (err) {
54
+ return rejectFunc(err);
55
+ }
56
+ resolveFunc(friendList);
57
+ };
58
+ }
59
+
60
+ defaultFuncs
61
+ .postFormData(
62
+ "https://www.facebook.com/chat/user_info_all",
63
+ ctx.jar,
64
+ {},
65
+ { viewer: ctx.userID }
66
+ )
67
+ .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
68
+ .then(function(resData) {
69
+ if (!resData) {
70
+ throw { error: "getFriendsList returned empty object." };
71
+ }
72
+ if (resData.error) {
73
+ throw resData;
74
+ }
75
+ callback(null, formatData(resData.payload));
76
+ })
77
+ .catch(function(err) {
78
+ log.error("getFriendsList", err);
79
+ return callback(err);
80
+ });
81
+
82
+ return returnPromise;
83
+ };
84
+ };