alicezetion 1.0.0 → 1.0.2

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 (62) 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 -0
  4. package/alice/{add.js → addUserToGroup.js} +16 -2
  5. package/alice/{admin.js → changeAdminStatus.js} +17 -3
  6. package/alice/{archive.js → changeArchivedStatus.js} +16 -2
  7. package/alice/changeBio.js +77 -0
  8. package/alice/changeBlockedStatus.js +47 -0
  9. package/alice/{gcimage.js → changeGroupImage.js} +16 -2
  10. package/alice/{nickname.js → changeNickname.js} +17 -2
  11. package/alice/changeThreadColor.js +71 -0
  12. package/alice/{emoji.js → changeThreadEmoji.js} +16 -2
  13. package/alice/createNewGroup.js +86 -0
  14. package/alice/{poll.js → createPoll.js} +18 -2
  15. package/alice/{deletemsg.js → deleteMessage.js} +15 -2
  16. package/alice/{deletegc.js → deleteThread.js} +15 -2
  17. package/alice/{forward.js → forwardAttachment.js} +16 -3
  18. package/alice/{id.js → getCurrentUserID.js} +1 -1
  19. package/alice/{friend.js → getFriendsList.js} +17 -3
  20. package/alice/{history.js → getThreadHistory.js} +19 -6
  21. package/alice/{gchistorydeprecated.js → getThreadHistoryDeprecated.js} +18 -1
  22. package/alice/{gcinfo.js → getThreadInfo.js} +49 -13
  23. package/alice/{gcinfodeprecated.js → getThreadInfoDeprecated.js} +17 -2
  24. package/alice/{gclist.js → getThreadList.js} +27 -9
  25. package/alice/{gclistdeprecated.js → getThreadListDeprecated.js} +1 -1
  26. package/alice/{gcimg.js → getThreadPictures.js} +15 -2
  27. package/alice/{userid.js → getUserID.js} +16 -2
  28. package/alice/{userinfo.js → getUserInfo.js} +18 -3
  29. package/alice/handleFriendRequest.js +61 -0
  30. package/alice/{msgrequest.js → handleMessageRequest.js} +16 -2
  31. package/alice/httpGet.js +52 -0
  32. package/alice/httpPost.js +52 -0
  33. package/alice/listenMqtt.js +363 -134
  34. package/alice/logout.js +18 -2
  35. package/alice/{delivered.js → markAsDelivered.js} +19 -2
  36. package/alice/markAsRead.js +80 -0
  37. package/alice/{seen.js → markAsReadAll.js} +16 -2
  38. package/alice/markAsSeen.js +59 -0
  39. package/alice/{mute.js → muteThread.js} +16 -2
  40. package/alice/{kick.js → removeUserFromGroup.js} +16 -2
  41. package/alice/{resolveimgurl.js → resolvePhotoUrl.js} +16 -2
  42. package/alice/{gcsearch.js → searchForThread.js} +16 -2
  43. package/alice/{chat.js → sendMessage.js} +78 -34
  44. package/alice/sendTypingIndicator.js +103 -0
  45. package/alice/{react.js → setMessageReaction.js} +39 -4
  46. package/alice/setPostReaction.js +76 -0
  47. package/alice/{title.js → setTitle.js} +16 -3
  48. package/alice/threadColors.js +57 -0
  49. package/alice/unfriend.js +52 -0
  50. package/alice/{unsend.js → unsendMessage.js} +16 -2
  51. package/index.js +324 -143
  52. package/package.json +27 -18
  53. package/utils.js +137 -61
  54. package/.cache/replit/modules.stamp +0 -0
  55. package/README.md +0 -40
  56. package/alice/block.js +0 -72
  57. package/alice/color.js +0 -53
  58. package/alice/gcolor.js +0 -22
  59. package/alice/listen.js +0 -553
  60. package/alice/read.js +0 -52
  61. package/alice/typeindicator.js +0 -77
  62. /package/alice/{emojiurl.js → getEmojiUrl.js} +0 -0
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "alicezetion",
3
- "version": "1.0.0",
4
- "description": "make your messenger account as a bot",
3
+ "version": "1.0.2",
4
+ "description": "messenger bot api",
5
5
  "main": "index.js",
6
6
  "scripts": {
7
- "test": "echo \"Error: no test specified\" && exit 1",
7
+ "test": "mocha",
8
8
  "lint": "./node_modules/.bin/eslint **.js",
9
9
  "prettier": "prettier utils.js src/* --write"
10
10
  },
@@ -13,9 +13,9 @@
13
13
  "url": "https://github.com/LeiamNashRebirth"
14
14
  },
15
15
  "keywords": [
16
- "bot",
17
16
  "messenger",
18
- "alice",
17
+ "facebook",
18
+ "bot",
19
19
  "leiamnash",
20
20
  "alicezetion"
21
21
  ],
@@ -24,26 +24,28 @@
24
24
  "bugs": {
25
25
  "url": "https://github.com/LeiamNashRebirth"
26
26
  },
27
- "homepage": "https://web.leiamnash.repl.co/npm",
27
+ "homepage": "https://leiamnash.repl.co/npm",
28
28
  "dependencies": {
29
- "bluebird": "^3.0.0",
30
- "cheerio": "^0.22.0",
31
- "mqtt": "^3.0.0",
32
- "npmlog": "^1.2.0",
33
- "request": "^2.53.0",
34
- "websocket-stream": "^5.5.0"
29
+ "bluebird": "^3.7.2",
30
+ "cheerio": "^1.0.0-rc.12",
31
+ "https-proxy-agent": "^5.0.1",
32
+ "mqtt": "^4.3.7",
33
+ "npmlog": "^7.0.1",
34
+ "request": "^2.88.2",
35
+ "websocket-stream": "^5.5.2"
35
36
  },
36
37
  "engines": {
37
- "node": ">=4.x"
38
+ "node": ">=10.x"
38
39
  },
39
40
  "devDependencies": {
40
- "eslint": "^4.19.1",
41
- "mocha": "^7.0.1",
42
- "prettier": "^1.11.1"
41
+ "eslint": "^8.38.0",
42
+ "mocha": "^10.2.0",
43
+ "prettier": "^2.8.7"
43
44
  },
44
45
  "eslintConfig": {
45
46
  "env": {
46
47
  "es6": true,
48
+ "es2017": true,
47
49
  "node": true
48
50
  },
49
51
  "extends": "eslint:recommended",
@@ -62,9 +64,16 @@
62
64
  "no-unused-vars": [
63
65
  1,
64
66
  {
65
- "argsIgnorePattern": "^_"
67
+ "argsIgnorePattern": "^_",
68
+ "varsIgnorePattern": "^_"
69
+ }
70
+ ],
71
+ "no-empty": [
72
+ "error",
73
+ {
74
+ "allowEmptyCatch": true
66
75
  }
67
76
  ]
68
77
  }
69
78
  }
70
- }
79
+ }
package/utils.js CHANGED
@@ -1,11 +1,25 @@
1
+ /* eslint-disable no-prototype-builtins */
1
2
  "use strict";
2
3
 
3
4
  var bluebird = require("bluebird");
4
- var request = bluebird.promisify(require("request").defaults({ jar: true }), {multiArgs: true});
5
+ var request = bluebird.promisify(require("request").defaults({ jar: true }));
5
6
  var stream = require("stream");
6
7
  var log = require("npmlog");
8
+ var querystring = require("querystring");
9
+ var url = require("url");
10
+
11
+ function setProxy(url) {
12
+ if (typeof url == undefined)
13
+ return request = bluebird.promisify(require("request").defaults({
14
+ jar: true,
15
+ }));
16
+ return request = bluebird.promisify(require("request").defaults({
17
+ jar: true,
18
+ proxy: url
19
+ }));
20
+ }
7
21
 
8
- function getHeaders(url, options) {
22
+ function getHeaders(url, options, ctx, customHeader) {
9
23
  var headers = {
10
24
  "Content-Type": "application/x-www-form-urlencoded",
11
25
  Referer: "https://www.facebook.com/",
@@ -14,6 +28,12 @@ function getHeaders(url, options) {
14
28
  "User-Agent": options.userAgent,
15
29
  Connection: "keep-alive"
16
30
  };
31
+ if (customHeader) {
32
+ Object.assign(headers, customHeader);
33
+ }
34
+ if (ctx && ctx.region) {
35
+ headers["X-MSGR-Region"] = ctx.region;
36
+ }
17
37
 
18
38
  return headers;
19
39
  }
@@ -27,7 +47,7 @@ function isReadableStream(obj) {
27
47
  );
28
48
  }
29
49
 
30
- function get(url, jar, qs, options) {
50
+ function get(url, jar, qs, options, ctx) {
31
51
  // I'm still confused about this
32
52
  if (getType(qs) === "Object") {
33
53
  for (var prop in qs) {
@@ -37,7 +57,7 @@ function get(url, jar, qs, options) {
37
57
  }
38
58
  }
39
59
  var op = {
40
- headers: getHeaders(url, options),
60
+ headers: getHeaders(url, options, ctx),
41
61
  timeout: 60000,
42
62
  qs: qs,
43
63
  url: url,
@@ -46,14 +66,14 @@ function get(url, jar, qs, options) {
46
66
  gzip: true
47
67
  };
48
68
 
49
- return request(op).then(function(res) {
69
+ return request(op).then(function (res) {
50
70
  return res[0];
51
71
  });
52
72
  }
53
73
 
54
- function post(url, jar, form, options) {
74
+ function post(url, jar, form, options, ctx, customHeader) {
55
75
  var op = {
56
- headers: getHeaders(url, options),
76
+ headers: getHeaders(url, options, ctx, customHeader),
57
77
  timeout: 60000,
58
78
  url: url,
59
79
  method: "POST",
@@ -62,13 +82,13 @@ function post(url, jar, form, options) {
62
82
  gzip: true
63
83
  };
64
84
 
65
- return request(op).then(function(res) {
85
+ return request(op).then(function (res) {
66
86
  return res[0];
67
87
  });
68
88
  }
69
89
 
70
- function postFormData(url, jar, form, qs, options) {
71
- var headers = getHeaders(url, options);
90
+ function postFormData(url, jar, form, qs, options, ctx) {
91
+ var headers = getHeaders(url, options, ctx);
72
92
  headers["Content-Type"] = "multipart/form-data";
73
93
  var op = {
74
94
  headers: headers,
@@ -81,7 +101,7 @@ function postFormData(url, jar, form, qs, options) {
81
101
  gzip: true
82
102
  };
83
103
 
84
- return request(op).then(function(res) {
104
+ return request(op).then(function (res) {
85
105
  return res[0];
86
106
  });
87
107
  }
@@ -162,7 +182,7 @@ var j = {
162
182
  Z:
163
183
  "%2c%22sb%22%3a1%2c%22t%22%3a%5b%5d%2c%22f%22%3anull%2c%22uct%22%3a0%2c%22s%22%3a0%2c%22blo%22%3a0%7d%2c%22bl%22%3a%7b%22ac%22%3a"
164
184
  };
165
- (function() {
185
+ (function () {
166
186
  var l = [];
167
187
  for (var m in j) {
168
188
  i[j[m]] = m;
@@ -174,18 +194,19 @@ var j = {
174
194
 
175
195
  function presenceEncode(str) {
176
196
  return encodeURIComponent(str)
177
- .replace(/([_A-Z])|%../g, function(m, n) {
197
+ .replace(/([_A-Z])|%../g, function (m, n) {
178
198
  return n ? "%" + n.charCodeAt(0).toString(16) : m;
179
199
  })
180
200
  .toLowerCase()
181
- .replace(h, function(m) {
201
+ .replace(h, function (m) {
182
202
  return i[m];
183
203
  });
184
204
  }
185
205
 
206
+ // eslint-disable-next-line no-unused-vars
186
207
  function presenceDecode(str) {
187
208
  return decodeURIComponent(
188
- str.replace(/[_A-Z]/g, function(m) {
209
+ str.replace(/[_A-Z]/g, function (m) {
189
210
  return j[m];
190
211
  })
191
212
  );
@@ -237,7 +258,7 @@ function getGUID() {
237
258
  /** @type {number} */
238
259
  var sectionLength = Date.now();
239
260
  /** @type {string} */
240
- var id = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) {
261
+ var id = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) {
241
262
  /** @type {number} */
242
263
  var r = Math.floor((sectionLength + Math.random() * 16) % 16);
243
264
  /** @type {number} */
@@ -265,7 +286,17 @@ function _formatAttachment(attachment1, attachment2) {
265
286
  type = "StickerAttachment";
266
287
  blob = attachment1.sticker_attachment;
267
288
  } else if (!type && attachment1.extensible_attachment) {
268
- type = "ExtensibleAttachment";
289
+ if (
290
+ attachment1.extensible_attachment.story_attachment &&
291
+ attachment1.extensible_attachment.story_attachment.target &&
292
+ attachment1.extensible_attachment.story_attachment.target.__typename &&
293
+ attachment1.extensible_attachment.story_attachment.target.__typename === "MessageLocation"
294
+ ) {
295
+ type = "MessageLocation";
296
+ } else {
297
+ type = "ExtensibleAttachment";
298
+ }
299
+
269
300
  blob = attachment1.extensible_attachment;
270
301
  }
271
302
  // TODO: Determine whether "sticker", "photo", "file" etc are still used
@@ -506,6 +537,49 @@ function _formatAttachment(attachment1, attachment2) {
506
537
  spriteURI: blob.sprite_image, // @Legacy
507
538
  spriteURI2x: blob.sprite_image_2x // @Legacy
508
539
  };
540
+ case "MessageLocation":
541
+ var urlAttach = blob.story_attachment.url;
542
+ var mediaAttach = blob.story_attachment.media;
543
+
544
+ var u = querystring.parse(url.parse(urlAttach).query).u;
545
+ var where1 = querystring.parse(url.parse(u).query).where1;
546
+ var address = where1.split(", ");
547
+
548
+ var latitude;
549
+ var longitude;
550
+
551
+ try {
552
+ latitude = Number.parseFloat(address[0]);
553
+ longitude = Number.parseFloat(address[1]);
554
+ } catch (err) {
555
+ /* empty */
556
+ }
557
+
558
+ var imageUrl;
559
+ var width;
560
+ var height;
561
+
562
+ if (mediaAttach && mediaAttach.image) {
563
+ imageUrl = mediaAttach.image.uri;
564
+ width = mediaAttach.image.width;
565
+ height = mediaAttach.image.height;
566
+ }
567
+
568
+ return {
569
+ type: "location",
570
+ ID: blob.legacy_attachment_id,
571
+ latitude: latitude,
572
+ longitude: longitude,
573
+ image: imageUrl,
574
+ width: width,
575
+ height: height,
576
+ url: u || urlAttach,
577
+ address: where1,
578
+
579
+ facebookUrl: blob.story_attachment.url, // @Legacy
580
+ target: blob.story_attachment.target, // @Legacy
581
+ styleList: blob.story_attachment.style_list // @Legacy
582
+ };
509
583
  case "ExtensibleAttachment":
510
584
  return {
511
585
  type: "share",
@@ -544,7 +618,7 @@ function _formatAttachment(attachment1, attachment2) {
544
618
  : blob.story_attachment.media.playable_url,
545
619
 
546
620
  subattachments: blob.story_attachment.subattachments,
547
- properties: blob.story_attachment.properties.reduce(function(obj, cur) {
621
+ properties: blob.story_attachment.properties.reduce(function (obj, cur) {
548
622
  obj[cur.key] = cur.value.text;
549
623
  return obj;
550
624
  }, {}),
@@ -570,12 +644,12 @@ function _formatAttachment(attachment1, attachment2) {
570
644
  default:
571
645
  throw new Error(
572
646
  "unrecognized attach_file of type " +
573
- type +
574
- "`" +
575
- JSON.stringify(attachment1, null, 4) +
576
- " attachment2: " +
577
- JSON.stringify(attachment2, null, 4) +
578
- "`"
647
+ type +
648
+ "`" +
649
+ JSON.stringify(attachment1, null, 4) +
650
+ " attachment2: " +
651
+ JSON.stringify(attachment2, null, 4) +
652
+ "`"
579
653
  );
580
654
  }
581
655
  }
@@ -583,16 +657,16 @@ function _formatAttachment(attachment1, attachment2) {
583
657
  function formatAttachment(attachments, attachmentIds, attachmentMap, shareMap) {
584
658
  attachmentMap = shareMap || attachmentMap;
585
659
  return attachments
586
- ? attachments.map(function(val, i) {
587
- if (
588
- !attachmentMap ||
589
- !attachmentIds ||
590
- !attachmentMap[attachmentIds[i]]
591
- ) {
592
- return _formatAttachment(val);
593
- }
594
- return _formatAttachment(val, attachmentMap[attachmentIds[i]]);
595
- })
660
+ ? attachments.map(function (val, i) {
661
+ if (
662
+ !attachmentMap ||
663
+ !attachmentIds ||
664
+ !attachmentMap[attachmentIds[i]]
665
+ ) {
666
+ return _formatAttachment(val);
667
+ }
668
+ return _formatAttachment(val, attachmentMap[attachmentIds[i]]);
669
+ })
596
670
  : [];
597
671
  }
598
672
 
@@ -649,9 +723,9 @@ function formatMessage(m) {
649
723
  ? originalMessage.group_thread_info.participant_names
650
724
  : [originalMessage.sender_name.split(" ")[0]],
651
725
  participantIDs: originalMessage.group_thread_info
652
- ? originalMessage.group_thread_info.participant_ids.map(function(v) {
653
- return formatID(v.toString());
654
- })
726
+ ? originalMessage.group_thread_info.participant_ids.map(function (v) {
727
+ return formatID(v.toString());
728
+ })
655
729
  : [formatID(originalMessage.sender_fbid)],
656
730
  body: originalMessage.body || "",
657
731
  threadID: formatID(
@@ -862,17 +936,17 @@ function makeParsable(html) {
862
936
  function arrToForm(form) {
863
937
  return arrayToObject(
864
938
  form,
865
- function(v) {
939
+ function (v) {
866
940
  return v.name;
867
941
  },
868
- function(v) {
942
+ function (v) {
869
943
  return v.val;
870
944
  }
871
945
  );
872
946
  }
873
947
 
874
948
  function arrayToObject(arr, getKey, getValue) {
875
- return arr.reduce(function(acc, val) {
949
+ return arr.reduce(function (acc, val) {
876
950
  acc[getKey(val)] = getValue(val);
877
951
  return acc;
878
952
  }, {});
@@ -958,21 +1032,22 @@ function makeDefaults(html, userID, ctx) {
958
1032
  return newObj;
959
1033
  }
960
1034
 
961
- function postWithDefaults(url, jar, form) {
962
- return post(url, jar, mergeWithDefaults(form), ctx.globalOptions);
1035
+ function postWithDefaults(url, jar, form, ctxx) {
1036
+ return post(url, jar, mergeWithDefaults(form), ctx.globalOptions, ctxx || ctx);
963
1037
  }
964
1038
 
965
- function getWithDefaults(url, jar, qs) {
966
- return get(url, jar, mergeWithDefaults(qs), ctx.globalOptions);
1039
+ function getWithDefaults(url, jar, qs, ctxx) {
1040
+ return get(url, jar, mergeWithDefaults(qs), ctx.globalOptions, ctxx || ctx);
967
1041
  }
968
1042
 
969
- function postFormDataWithDefault(url, jar, form, qs) {
1043
+ function postFormDataWithDefault(url, jar, form, qs, ctxx) {
970
1044
  return postFormData(
971
1045
  url,
972
1046
  jar,
973
1047
  mergeWithDefaults(form),
974
1048
  mergeWithDefaults(qs),
975
- ctx.globalOptions
1049
+ ctx.globalOptions,
1050
+ ctxx || ctx
976
1051
  );
977
1052
  }
978
1053
 
@@ -987,8 +1062,8 @@ function parseAndCheckLogin(ctx, defaultFuncs, retryCount) {
987
1062
  if (retryCount == undefined) {
988
1063
  retryCount = 0;
989
1064
  }
990
- return function(data) {
991
- return bluebird.try(function() {
1065
+ return function (data) {
1066
+ return bluebird.try(function () {
992
1067
  log.verbose("parseAndCheckLogin", data.body);
993
1068
  if (data.statusCode >= 500 && data.statusCode < 600) {
994
1069
  if (retryCount >= 5) {
@@ -1004,12 +1079,12 @@ function parseAndCheckLogin(ctx, defaultFuncs, retryCount) {
1004
1079
  log.warn(
1005
1080
  "parseAndCheckLogin",
1006
1081
  "Got status code " +
1007
- data.statusCode +
1008
- " - " +
1009
- retryCount +
1010
- ". attempt to retry in " +
1011
- retryTime +
1012
- " milliseconds..."
1082
+ data.statusCode +
1083
+ " - " +
1084
+ retryCount +
1085
+ ". attempt to retry in " +
1086
+ retryTime +
1087
+ " milliseconds..."
1013
1088
  );
1014
1089
  var url =
1015
1090
  data.request.uri.protocol +
@@ -1022,7 +1097,7 @@ function parseAndCheckLogin(ctx, defaultFuncs, retryCount) {
1022
1097
  ) {
1023
1098
  return bluebird
1024
1099
  .delay(retryTime)
1025
- .then(function() {
1100
+ .then(function () {
1026
1101
  return defaultFuncs.postFormData(
1027
1102
  url,
1028
1103
  ctx.jar,
@@ -1034,7 +1109,7 @@ function parseAndCheckLogin(ctx, defaultFuncs, retryCount) {
1034
1109
  } else {
1035
1110
  return bluebird
1036
1111
  .delay(retryTime)
1037
- .then(function() {
1112
+ .then(function () {
1038
1113
  return defaultFuncs.post(url, ctx.jar, data.request.formData);
1039
1114
  })
1040
1115
  .then(parseAndCheckLogin(ctx, defaultFuncs, retryCount));
@@ -1043,8 +1118,8 @@ function parseAndCheckLogin(ctx, defaultFuncs, retryCount) {
1043
1118
  if (data.statusCode !== 200)
1044
1119
  throw new Error(
1045
1120
  "parseAndCheckLogin got status code: " +
1046
- data.statusCode +
1047
- ". Bailing out of trying to parse response."
1121
+ data.statusCode +
1122
+ ". Bailing out of trying to parse response."
1048
1123
  );
1049
1124
 
1050
1125
  var res = null;
@@ -1108,9 +1183,9 @@ function parseAndCheckLogin(ctx, defaultFuncs, retryCount) {
1108
1183
  }
1109
1184
 
1110
1185
  function saveCookies(jar) {
1111
- return function(res) {
1186
+ return function (res) {
1112
1187
  var cookies = res.headers["set-cookie"] || [];
1113
- cookies.forEach(function(c) {
1188
+ cookies.forEach(function (c) {
1114
1189
  if (c.indexOf(".facebook.com") > -1) {
1115
1190
  jar.setCookie(c, "https://www.facebook.com");
1116
1191
  }
@@ -1278,6 +1353,7 @@ module.exports = {
1278
1353
  formatDate,
1279
1354
  decodeClientPayload,
1280
1355
  getAppState,
1281
- getAdminTextMessageType
1356
+ getAdminTextMessageType,
1357
+ setProxy
1282
1358
  };
1283
1359
 
File without changes
package/README.md DELETED
@@ -1,40 +0,0 @@
1
- <p align="center">
2
-
3
- <img src="https://i.imgur.com/GYRjw6F.jpg" alt="LeiamNashProject">
4
- AliceZetion <br> a fake http tool that can trigger facebook, it uses get and post method to make your account functionable on messenger</p>
5
-
6
- <br>
7
- take note:<br>this project is not supported to mirai, c3c, goat and other systems who used fca before<br><br>i am not responsible if your account gets banned for spammy activities
8
-
9
- <br> <br> features:<br>• philippines server<br>• safari agent<br>• fast and secure<br>• flexible user agent
10
-
11
- <br> <br>
12
-
13
- installation
14
- ```js
15
- npm i alicezetion
16
- ```
17
-
18
- <br>
19
-
20
- calling a variable
21
- ```js
22
- const login = require("alicezetion");
23
- ```
24
-
25
- <br>
26
-
27
- too lazy to write some documents cause this project is only for alice if you want to use this the normal bot response will be:
28
-
29
- ```js
30
- bot.chat("TEXT", threadID, messageID);
31
- ```
32
-
33
-
34
- <br>
35
- <p align="center">
36
- AliceZetion is a package backend for your system, it scarpe on facebook to support fake http login
37
- </p>
38
-
39
-
40
- <br> • [LeiamNash](https://www.facebook.com/LeiamNashRebrth)
package/alice/block.js DELETED
@@ -1,72 +0,0 @@
1
- "use strict";
2
-
3
- var utils = require("../utils");
4
- var log = require("npmlog");
5
-
6
- module.exports = function(defaultFuncs, bot, ctx) {
7
- return function changeBlockedStatus(userID, block, callback) {
8
- if (!callback) {
9
- callback = function() {};
10
- }
11
- if (block) {
12
- defaultFuncs
13
- .post(
14
- "https://www.facebook.com/nfx/block_messages/?thread_fbid=" +
15
- userID +
16
- "&location=www_chat_head",
17
- ctx.jar,
18
- {}
19
- )
20
- .then(utils.saveCookies(ctx.jar))
21
- .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
22
- .then(function(resData) {
23
- if (resData.error) {
24
- throw resData;
25
- }
26
- defaultFuncs
27
- .post(
28
- "https://www.facebook.com" +
29
- /action="(.+?)"+?/
30
- .exec(resData.jsmods.markup[0][1].__html)[1]
31
- .replace(/&amp;/g, "&"),
32
- ctx.jar,
33
- {}
34
- )
35
- .then(utils.saveCookies(ctx.jar))
36
- .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
37
- .then(function(_resData) {
38
- if (_resData.error) {
39
- throw _resData;
40
- }
41
- return callback();
42
- });
43
- })
44
- .catch(function(err) {
45
- log.error("changeBlockedStatus", err);
46
- return callback(err);
47
- });
48
- } else {
49
- defaultFuncs
50
- .post(
51
- "https://www.facebook.com/ajax/nfx/messenger_undo_block.php?story_location=messenger&context=%7B%22reportable_ent_token%22%3A%22" +
52
- userID +
53
- "%22%2C%22initial_action_name%22%3A%22BLOCK_MESSAGES%22%7D&",
54
- ctx.jar,
55
- {}
56
- )
57
- .then(utils.saveCookies(ctx.jar))
58
- .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
59
- .then(function(resData) {
60
- if (resData.error) {
61
- throw resData;
62
- }
63
-
64
- return callback();
65
- })
66
- .catch(function(err) {
67
- log.error("changeBlockedStatus", err);
68
- return callback(err);
69
- });
70
- }
71
- };
72
- };
package/alice/color.js DELETED
@@ -1,53 +0,0 @@
1
- "use strict";
2
-
3
- var utils = require("../utils");
4
- var log = require("npmlog");
5
-
6
- module.exports = function(defaultFuncs, bot, ctx) {
7
- return function changeThreadColor(color, threadID, callback) {
8
- if (!callback) {
9
- callback = function() {};
10
- }
11
-
12
- var validatedColor = color !== null ? color.toLowerCase() : color; // API only accepts lowercase letters in hex string
13
- var colorList = Object.keys(api.threadColors).map(function(name) {
14
- return api.threadColors[name];
15
- });
16
- if (!colorList.includes(validatedColor)) {
17
- throw {
18
- error:
19
- "The color you are trying to use is not a valid thread color. Use api.threadColors to find acceptable values."
20
- };
21
- }
22
-
23
- var form = {
24
- color_choice: validatedColor,
25
- thread_or_other_fbid: threadID
26
- };
27
-
28
- defaultFuncs
29
- .post(
30
- "https://www.facebook.com/messaging/save_thread_color/?source=thread_settings&dpr=1",
31
- ctx.jar,
32
- form
33
- )
34
- .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
35
- .then(function(resData) {
36
- if (resData.error === 1357031) {
37
- throw {
38
- error:
39
- "Trying to change colors of a chat that doesn't exist. Have at least one message in the thread before trying to change the colors."
40
- };
41
- }
42
- if (resData.error) {
43
- throw resData;
44
- }
45
-
46
- return callback();
47
- })
48
- .catch(function(err) {
49
- log.error("changeThreadColor", err);
50
- return callback(err);
51
- });
52
- };
53
- };
package/alice/gcolor.js DELETED
@@ -1,22 +0,0 @@
1
- "use strict";
2
-
3
- module.exports = function(defaultFuncs, bot, ctx) {
4
- // Currently the only colors that can be passed to api.changeThreadColor(); may change if Facebook adds more
5
- return {
6
- MessengerBlue: null,
7
- Viking: "#44bec7",
8
- GoldenPoppy: "#ffc300",
9
- RadicalRed: "#fa3c4c",
10
- Shocking: "#d696bb",
11
- PictonBlue: "#6699cc",
12
- FreeSpeechGreen: "#13cf13",
13
- Pumpkin: "#ff7e29",
14
- LightCoral: "#e68585",
15
- MediumSlateBlue: "#7646ff",
16
- DeepSkyBlue: "#20cef5",
17
- Fern: "#67b868",
18
- Cameo: "#d4a88c",
19
- BrilliantRose: "#ff5ca1",
20
- BilobaFlower: "#a695c7"
21
- };
22
- };