@cexy/hoonfca 1.0.1 → 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 (170) hide show
  1. package/.travis.yml +6 -0
  2. package/LICENSE-MIT +21 -0
  3. package/index.d.ts +620 -0
  4. package/index.js +778 -1
  5. package/package.json +31 -84
  6. package/src/{apis/addExternalModule.js → addExternalModule.js} +4 -5
  7. package/src/addUserToGroup.js +113 -0
  8. package/src/changeAdminStatus.js +95 -0
  9. package/src/changeApprovalMode.js +79 -0
  10. package/src/changeArchivedStatus.js +55 -0
  11. package/src/changeBio.js +76 -0
  12. package/src/changeBlockedStatus.js +47 -0
  13. package/src/changeBlockedStatusMqtt.js +86 -0
  14. package/src/changeGroupImage.js +133 -0
  15. package/src/changeNickname.js +59 -0
  16. package/src/changeThreadColor.js +71 -0
  17. package/src/{apis/changeThreadEmoji.js → changeThreadEmoji.js} +8 -6
  18. package/src/createNewGroup.js +88 -0
  19. package/src/createPoll.js +130 -0
  20. package/src/deleteMessage.js +56 -0
  21. package/src/deleteThread.js +56 -0
  22. package/src/editMessage.js +63 -0
  23. package/src/forwardAttachment.js +60 -0
  24. package/src/forwardMessage.js +63 -0
  25. package/src/getCurrentUserID.js +7 -0
  26. package/src/getEmojiUrl.js +29 -0
  27. package/src/getFriendsList.js +84 -0
  28. package/src/getGroupsList.js +83 -0
  29. package/src/getMarketplace.js +84 -0
  30. package/src/getNotifications.js +86 -0
  31. package/src/getPagesList.js +83 -0
  32. package/src/getStories.js +88 -0
  33. package/src/getThreadHistory.js +647 -0
  34. package/src/getThreadInfo.js +222 -0
  35. package/src/getThreadList.js +292 -0
  36. package/src/getThreadPictures.js +79 -0
  37. package/src/getUserID.js +66 -0
  38. package/src/getUserInfo.js +128 -0
  39. package/src/handleFriendRequest.js +57 -0
  40. package/src/handleMessageRequest.js +65 -0
  41. package/src/{apis/httpGet.js → httpGet.js} +15 -20
  42. package/src/httpPost.js +58 -0
  43. package/src/listenMqtt.js +1018 -0
  44. package/src/logout.js +75 -0
  45. package/src/markAsDelivered.js +58 -0
  46. package/src/{apis/markAsRead.js → markAsRead.js} +19 -30
  47. package/src/markAsReadAll.js +50 -0
  48. package/src/markAsSeen.js +61 -0
  49. package/src/muteThread.js +52 -0
  50. package/src/pinMessage.js +61 -0
  51. package/src/removeUserFromGroup.js +79 -0
  52. package/src/resolvePhotoUrl.js +45 -0
  53. package/src/searchForThread.js +53 -0
  54. package/src/searchUsers.js +89 -0
  55. package/src/sendComment.js +161 -0
  56. package/src/sendMessage.js +457 -0
  57. package/src/sendTypingIndicator.js +179 -0
  58. package/src/setBio.js +86 -0
  59. package/src/setMessageReaction.js +186 -0
  60. package/src/setPostReaction.js +71 -0
  61. package/src/setTheme.js +313 -0
  62. package/src/setTitle.js +90 -0
  63. package/src/shareContact.js +53 -0
  64. package/src/shareLink.js +62 -0
  65. package/src/threadColors.js +57 -0
  66. package/src/unfriend.js +53 -0
  67. package/src/unsendMessage.js +104 -0
  68. package/utils.js +1447 -0
  69. package/LICENSE +0 -3
  70. package/README.md +0 -491
  71. package/examples/login-with-cookies.js +0 -102
  72. package/examples/verify.js +0 -70
  73. package/src/apis/addUserToGroup.js +0 -108
  74. package/src/apis/changeAdminStatus.js +0 -148
  75. package/src/apis/changeArchivedStatus.js +0 -61
  76. package/src/apis/changeAvatar.js +0 -103
  77. package/src/apis/changeBio.js +0 -69
  78. package/src/apis/changeBlockedStatus.js +0 -54
  79. package/src/apis/changeGroupImage.js +0 -136
  80. package/src/apis/changeThreadColor.js +0 -116
  81. package/src/apis/comment.js +0 -207
  82. package/src/apis/createAITheme.js +0 -129
  83. package/src/apis/createNewGroup.js +0 -79
  84. package/src/apis/createPoll.js +0 -73
  85. package/src/apis/deleteMessage.js +0 -44
  86. package/src/apis/deleteThread.js +0 -52
  87. package/src/apis/e2ee.js +0 -17
  88. package/src/apis/editMessage.js +0 -70
  89. package/src/apis/emoji.js +0 -124
  90. package/src/apis/fetchThemeData.js +0 -82
  91. package/src/apis/follow.js +0 -81
  92. package/src/apis/forwardMessage.js +0 -52
  93. package/src/apis/friend.js +0 -243
  94. package/src/apis/gcmember.js +0 -122
  95. package/src/apis/gcname.js +0 -123
  96. package/src/apis/gcrule.js +0 -119
  97. package/src/apis/getAccess.js +0 -111
  98. package/src/apis/getBotInfo.js +0 -88
  99. package/src/apis/getBotInitialData.js +0 -43
  100. package/src/apis/getFriendsList.js +0 -79
  101. package/src/apis/getMessage.js +0 -423
  102. package/src/apis/getTheme.js +0 -95
  103. package/src/apis/getThemeInfo.js +0 -116
  104. package/src/apis/getThreadHistory.js +0 -239
  105. package/src/apis/getThreadInfo.js +0 -267
  106. package/src/apis/getThreadList.js +0 -232
  107. package/src/apis/getThreadPictures.js +0 -58
  108. package/src/apis/getUserID.js +0 -117
  109. package/src/apis/getUserInfo.js +0 -513
  110. package/src/apis/getUserInfoV2.js +0 -146
  111. package/src/apis/handleMessageRequest.js +0 -50
  112. package/src/apis/httpPost.js +0 -89
  113. package/src/apis/httpPostFormData.js +0 -69
  114. package/src/apis/listenMqtt.js +0 -1236
  115. package/src/apis/listenSpeed.js +0 -179
  116. package/src/apis/logout.js +0 -87
  117. package/src/apis/markAsDelivered.js +0 -47
  118. package/src/apis/markAsReadAll.js +0 -40
  119. package/src/apis/markAsSeen.js +0 -70
  120. package/src/apis/mqttDeltaValue.js +0 -278
  121. package/src/apis/muteThread.js +0 -45
  122. package/src/apis/nickname.js +0 -132
  123. package/src/apis/notes.js +0 -163
  124. package/src/apis/pinMessage.js +0 -150
  125. package/src/apis/produceMetaTheme.js +0 -180
  126. package/src/apis/realtime.js +0 -182
  127. package/src/apis/removeUserFromGroup.js +0 -117
  128. package/src/apis/resolvePhotoUrl.js +0 -58
  129. package/src/apis/searchForThread.js +0 -154
  130. package/src/apis/sendMessage.js +0 -354
  131. package/src/apis/sendMessageMqtt.js +0 -249
  132. package/src/apis/sendTypingIndicator.js +0 -91
  133. package/src/apis/setMessageReaction.js +0 -27
  134. package/src/apis/setMessageReactionMqtt.js +0 -61
  135. package/src/apis/setThreadTheme.js +0 -260
  136. package/src/apis/setThreadThemeMqtt.js +0 -94
  137. package/src/apis/share.js +0 -107
  138. package/src/apis/shareContact.js +0 -66
  139. package/src/apis/stickers.js +0 -257
  140. package/src/apis/story.js +0 -181
  141. package/src/apis/theme.js +0 -233
  142. package/src/apis/unfriend.js +0 -47
  143. package/src/apis/unsendMessage.js +0 -17
  144. package/src/engine/client.js +0 -92
  145. package/src/engine/models/buildAPI.js +0 -152
  146. package/src/engine/models/loginHelper.js +0 -519
  147. package/src/engine/models/setOptions.js +0 -88
  148. package/src/security/e2ee.js +0 -109
  149. package/src/types/index.d.ts +0 -498
  150. package/src/utils/antiSuspension.js +0 -506
  151. package/src/utils/auth-helpers.js +0 -149
  152. package/src/utils/autoReLogin.js +0 -336
  153. package/src/utils/axios.js +0 -436
  154. package/src/utils/cache.js +0 -54
  155. package/src/utils/clients.js +0 -282
  156. package/src/utils/constants.js +0 -410
  157. package/src/utils/formatters/data/formatAttachment.js +0 -370
  158. package/src/utils/formatters/data/formatDelta.js +0 -109
  159. package/src/utils/formatters/index.js +0 -159
  160. package/src/utils/formatters/value/formatCookie.js +0 -91
  161. package/src/utils/formatters/value/formatDate.js +0 -36
  162. package/src/utils/formatters/value/formatID.js +0 -16
  163. package/src/utils/formatters.js +0 -1373
  164. package/src/utils/headers.js +0 -230
  165. package/src/utils/index.js +0 -153
  166. package/src/utils/monitoring.js +0 -333
  167. package/src/utils/rateLimiter.js +0 -319
  168. package/src/utils/tokenRefresh.js +0 -657
  169. package/src/utils/user-agents.js +0 -238
  170. package/src/utils/validation.js +0 -157
@@ -0,0 +1,313 @@
1
+ "use strict";
2
+
3
+ const { generateOfflineThreadingID, getCurrentTimestamp } = require("../utils");
4
+
5
+ function isCallable(func) {
6
+ try {
7
+ Reflect.apply(func, null, []);
8
+ return true;
9
+ } catch (error) {
10
+ return false;
11
+ }
12
+ }
13
+
14
+ const themes = [
15
+ {
16
+ id: "3650637715209675",
17
+ name: "Besties",
18
+ },
19
+ {
20
+ id: "769656934577391",
21
+ name: "Women's History Month",
22
+ },
23
+ {
24
+ id: "702099018755409",
25
+ name: "Dune: Part Two",
26
+ },
27
+ {
28
+ id: "1480404512543552",
29
+ name: "Avatar: The Last Airbender",
30
+ },
31
+ {
32
+ id: "952656233130616",
33
+ name: "J.Lo",
34
+ },
35
+ {
36
+ id: "741311439775765",
37
+ name: "Love",
38
+ },
39
+ {
40
+ id: "215565958307259",
41
+ name: "Bob Marley: One Love",
42
+ },
43
+ {
44
+ id: "194982117007866",
45
+ name: "Football",
46
+ },
47
+ {
48
+ id: "1743641112805218",
49
+ name: "Soccer",
50
+ },
51
+ {
52
+ id: "730357905262632",
53
+ name: "Mean Girls",
54
+ },
55
+ {
56
+ id: "1270466356981452",
57
+ name: "Wonka",
58
+ },
59
+ {
60
+ id: "704702021720552",
61
+ name: "Pizza",
62
+ },
63
+ {
64
+ id: "1013083536414851",
65
+ name: "Wish",
66
+ },
67
+ {
68
+ id: "359537246600743",
69
+ name: "Trolls",
70
+ },
71
+ {
72
+ id: "173976782455615",
73
+ name: "The Marvels",
74
+ },
75
+ {
76
+ id: "2317258455139234",
77
+ name: "One Piece",
78
+ },
79
+ {
80
+ id: "6685081604943977",
81
+ name: "1989",
82
+ },
83
+ {
84
+ id: "1508524016651271",
85
+ name: "Avocado",
86
+ },
87
+ {
88
+ id: "265997946276694",
89
+ name: "Loki Season 2",
90
+ },
91
+ {
92
+ id: "6584393768293861",
93
+ name: "olivia rodrigo",
94
+ },
95
+ {
96
+ id: "845097890371902",
97
+ name: "Baseball",
98
+ },
99
+ {
100
+ id: "292955489929680",
101
+ name: "Lollipop",
102
+ },
103
+ {
104
+ id: "976389323536938",
105
+ name: "Loops",
106
+ },
107
+ {
108
+ id: "810978360551741",
109
+ name: "Parenthood",
110
+ },
111
+ {
112
+ id: "195296273246380",
113
+ name: "Bubble Tea",
114
+ },
115
+ {
116
+ id: "6026716157422736",
117
+ name: "Basketball",
118
+ },
119
+ {
120
+ id: "693996545771691",
121
+ name: "Elephants & Flowers",
122
+ },
123
+ {
124
+ id: "390127158985345",
125
+ name: "Chill",
126
+ },
127
+ {
128
+ id: "365557122117011",
129
+ name: "Support",
130
+ },
131
+ {
132
+ id: "339021464972092",
133
+ name: "Music",
134
+ },
135
+ {
136
+ id: "1060619084701625",
137
+ name: "Lo-Fi",
138
+ },
139
+ {
140
+ id: "3190514984517598",
141
+ name: "Sky",
142
+ },
143
+ {
144
+ id: "627144732056021",
145
+ name: "Celebration",
146
+ },
147
+ {
148
+ id: "275041734441112",
149
+ name: "Care",
150
+ },
151
+ {
152
+ id: "3082966625307060",
153
+ name: "Astrology",
154
+ },
155
+ {
156
+ id: "539927563794799",
157
+ name: "Cottagecore",
158
+ },
159
+ {
160
+ id: "527564631955494",
161
+ name: "Ocean",
162
+ },
163
+ {
164
+ id: "230032715012014",
165
+ name: "Tie-Dye",
166
+ },
167
+ {
168
+ id: "788274591712841",
169
+ name: "Monochrome",
170
+ },
171
+ {
172
+ id: "3259963564026002",
173
+ name: "Default",
174
+ },
175
+ {
176
+ id: "724096885023603",
177
+ name: "Berry",
178
+ },
179
+ {
180
+ id: "624266884847972",
181
+ name: "Candy",
182
+ },
183
+ {
184
+ id: "273728810607574",
185
+ name: "Unicorn",
186
+ },
187
+ {
188
+ id: "262191918210707",
189
+ name: "Tropical",
190
+ },
191
+ {
192
+ id: "2533652183614000",
193
+ name: "Maple",
194
+ },
195
+ {
196
+ id: "909695489504566",
197
+ name: "Sushi",
198
+ },
199
+ {
200
+ id: "582065306070020",
201
+ name: "Rocket",
202
+ },
203
+ {
204
+ id: "557344741607350",
205
+ name: "Citrus",
206
+ },
207
+ {
208
+ id: "280333826736184",
209
+ name: "Lollipop",
210
+ },
211
+ {
212
+ id: "271607034185782",
213
+ name: "Shadow",
214
+ },
215
+ {
216
+ id: "1257453361255152",
217
+ name: "Rose",
218
+ },
219
+ {
220
+ id: "571193503540759",
221
+ name: "Lavender",
222
+ },
223
+ {
224
+ id: "2873642949430623",
225
+ name: "Tulip",
226
+ },
227
+ {
228
+ id: "3273938616164733",
229
+ name: "Classic",
230
+ },
231
+ {
232
+ id: "403422283881973",
233
+ name: "Apple",
234
+ },
235
+ {
236
+ id: "3022526817824329",
237
+ name: "Peach",
238
+ },
239
+ {
240
+ id: "672058580051520",
241
+ name: "Honey",
242
+ },
243
+ {
244
+ id: "3151463484918004",
245
+ name: "Kiwi",
246
+ },
247
+ {
248
+ id: "736591620215564",
249
+ name: "Ocean",
250
+ },
251
+ {
252
+ id: "193497045377796",
253
+ name: "Grape",
254
+ },
255
+ ];
256
+
257
+ module.exports = function (defaultFuncs, api, ctx) {
258
+ return function setTheme(themeID, threadID, callback) {
259
+ if (!ctx.mqttClient) {
260
+ throw new Error("Not connected to MQTT");
261
+ }
262
+
263
+ ctx.wsReqNumber += 1;
264
+ ctx.wsTaskNumber += 1;
265
+
266
+ let selectedThemeID;
267
+
268
+ if (!themeID) {
269
+ // If no theme ID is provided, select a random theme from the themes array
270
+ const randomIndex = Math.floor(Math.random() * themes.length);
271
+ selectedThemeID = themes[randomIndex].id;
272
+ } else {
273
+ selectedThemeID = themeID;
274
+ }
275
+
276
+ const taskPayload = {
277
+ thread_key: threadID,
278
+ theme_fbid: selectedThemeID,
279
+ source: null,
280
+ sync_group: 1,
281
+ payload: null,
282
+ };
283
+
284
+ const task = {
285
+ failure_count: null,
286
+ label: "43",
287
+ payload: JSON.stringify(taskPayload),
288
+ queue_name: "thread_theme",
289
+ task_id: ctx.wsTaskNumber,
290
+ };
291
+
292
+ const content = {
293
+ app_id: "2220391788200892",
294
+ payload: JSON.stringify({
295
+ data_trace_id: null,
296
+ epoch_id: parseInt(generateOfflineThreadingID()),
297
+ tasks: [task],
298
+ version_id: "25095469420099952",
299
+ }),
300
+ request_id: ctx.wsReqNumber,
301
+ type: 3,
302
+ };
303
+
304
+ if (isCallable(callback)) {
305
+ // to be implemented
306
+ }
307
+
308
+ ctx.mqttClient.publish("/ls_req", JSON.stringify(content), {
309
+ qos: 1,
310
+ retain: false,
311
+ });
312
+ };
313
+ };
@@ -0,0 +1,90 @@
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 setTitle(newTitle, threadID, callback) {
8
+ if (
9
+ !callback &&
10
+ (utils.getType(threadID) === "Function" ||
11
+ utils.getType(threadID) === "AsyncFunction")
12
+ ) {
13
+ throw { error: "please pass a threadID as a second argument." };
14
+ }
15
+
16
+ var resolveFunc = function () {};
17
+ var rejectFunc = function () {};
18
+ var returnPromise = new Promise(function (resolve, reject) {
19
+ resolveFunc = resolve;
20
+ rejectFunc = reject;
21
+ });
22
+
23
+ if (!callback) {
24
+ callback = function (err, friendList) {
25
+ if (err) {
26
+ return rejectFunc(err);
27
+ }
28
+ resolveFunc(friendList);
29
+ };
30
+ }
31
+
32
+ var messageAndOTID = utils.generateOfflineThreadingID();
33
+ var form = {
34
+ client: "mercury",
35
+ action_type: "ma-type:log-message",
36
+ author: "fbid:" + ctx.userID,
37
+ author_email: "",
38
+ coordinates: "",
39
+ timestamp: Date.now(),
40
+ timestamp_absolute: "Today",
41
+ timestamp_relative: utils.generateTimestampRelative(),
42
+ timestamp_time_passed: "0",
43
+ is_unread: false,
44
+ is_cleared: false,
45
+ is_forward: false,
46
+ is_filtered_content: false,
47
+ is_spoof_warning: false,
48
+ source: "source:chat:web",
49
+ "source_tags[0]": "source:chat",
50
+ status: "0",
51
+ offline_threading_id: messageAndOTID,
52
+ message_id: messageAndOTID,
53
+ threading_id: utils.generateThreadingID(ctx.clientID),
54
+ manual_retry_cnt: "0",
55
+ thread_fbid: threadID,
56
+ thread_name: newTitle,
57
+ thread_id: threadID,
58
+ log_message_type: "log:thread-name",
59
+ };
60
+
61
+ defaultFuncs
62
+ .post(
63
+ "https://www.facebook.com/messaging/set_thread_name/",
64
+ ctx.jar,
65
+ form,
66
+ )
67
+ .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
68
+ .then(function (resData) {
69
+ if (resData.error && resData.error === 1545012) {
70
+ throw { error: "Cannot change chat title: Not member of chat." };
71
+ }
72
+
73
+ if (resData.error && resData.error === 1545003) {
74
+ throw { error: "Cannot set title of single-user chat." };
75
+ }
76
+
77
+ if (resData.error) {
78
+ throw resData;
79
+ }
80
+
81
+ return callback();
82
+ })
83
+ .catch(function (err) {
84
+ log.error("setTitle", err);
85
+ return callback(err);
86
+ });
87
+
88
+ return returnPromise;
89
+ };
90
+ };
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+
3
+ var utils = require("../utils");
4
+ var log = require("npmlog");
5
+
6
+ module.exports = function (defaultFuncs, api, ctx) {
7
+ return async function shareContact(text, senderID, threadID, callback) {
8
+ if (!ctx.mqttClient) {
9
+ throw new Error("Not connected to MQTT");
10
+ }
11
+
12
+ var resolveFunc = function () {};
13
+ var rejectFunc = function () {};
14
+ var returnPromise = new Promise(function (resolve, reject) {
15
+ resolveFunc = resolve;
16
+ rejectFunc = reject;
17
+ });
18
+ if (!callback) {
19
+ callback = function (err, data) {
20
+ if (err) return rejectFunc(err);
21
+ resolveFunc(data);
22
+ data;
23
+ };
24
+ }
25
+ let count_req = 0;
26
+ var form = JSON.stringify({
27
+ app_id: "2220391788200892",
28
+ payload: JSON.stringify({
29
+ tasks: [
30
+ {
31
+ label: "359",
32
+ payload: JSON.stringify({
33
+ contact_id: senderID,
34
+ sync_group: 1,
35
+ text: text || "",
36
+ thread_id: threadID,
37
+ }),
38
+ queue_name: "messenger_contact_sharing",
39
+ task_id: (Math.random() * 1001) << 0,
40
+ failure_count: null,
41
+ },
42
+ ],
43
+ epoch_id: utils.generateOfflineThreadingID(),
44
+ version_id: "7214102258676893",
45
+ }),
46
+ request_id: ++count_req,
47
+ type: 3,
48
+ });
49
+ ctx.mqttClient.publish("/ls_req", form);
50
+
51
+ return returnPromise;
52
+ };
53
+ };
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+
3
+ var utils = require("../utils");
4
+ var log = require("npmlog");
5
+
6
+ module.exports = function (defaultFuncs, api, ctx) {
7
+ return async function shareLink(text, url, threadID, callback) {
8
+ if (!ctx.mqttClient) {
9
+ throw new Error("Not connected to MQTT");
10
+ }
11
+
12
+ var resolveFunc = function () {};
13
+ var rejectFunc = function () {};
14
+ var returnPromise = new Promise(function (resolve, reject) {
15
+ resolveFunc = resolve;
16
+ rejectFunc = reject;
17
+ });
18
+ if (!callback) {
19
+ callback = function (err, data) {
20
+ if (err) return rejectFunc(err);
21
+ resolveFunc(data);
22
+ };
23
+ }
24
+ let count_req = 0;
25
+ ctx.mqttClient.publish(
26
+ "/ls_req",
27
+ JSON.stringify({
28
+ app_id: "2220391788200892",
29
+ payload: JSON.stringify({
30
+ tasks: [
31
+ {
32
+ label: 46,
33
+ payload: JSON.stringify({
34
+ otid: utils.generateOfflineThreadingID(),
35
+ source: 524289,
36
+ sync_group: 1,
37
+ send_type: 6,
38
+ mark_thread_read: 0,
39
+ url: url || "",
40
+ text: text || "",
41
+ thread_id: threadID,
42
+ initiating_source: 0,
43
+ }),
44
+ queue_name: threadID,
45
+ task_id: (Math.random() * 1001) << 0,
46
+ failure_count: null,
47
+ },
48
+ ],
49
+ epoch_id: utils.generateOfflineThreadingID(),
50
+ version_id: "7191105584331330",
51
+ }),
52
+ request_id: ++count_req,
53
+ type: 3,
54
+ }),
55
+ {
56
+ qos: 1,
57
+ retain: false,
58
+ },
59
+ );
60
+ return returnPromise;
61
+ };
62
+ };
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+
3
+ module.exports = function (_defaultFuncs, _api, _ctx) {
4
+ // Currently the only colors that can be passed to api.changeThreadColor(); may change if Facebook adds more
5
+ return {
6
+ //Old hex colors.
7
+ ////MessengerBlue: null,
8
+ ////Viking: "#44bec7",
9
+ ////GoldenPoppy: "#ffc300",
10
+ ////RadicalRed: "#fa3c4c",
11
+ ////Shocking: "#d696bb",
12
+ ////PictonBlue: "#6699cc",
13
+ ////FreeSpeechGreen: "#13cf13",
14
+ ////Pumpkin: "#ff7e29",
15
+ ////LightCoral: "#e68585",
16
+ ////MediumSlateBlue: "#7646ff",
17
+ ////DeepSkyBlue: "#20cef5",
18
+ ////Fern: "#67b868",
19
+ ////Cameo: "#d4a88c",
20
+ ////BrilliantRose: "#ff5ca1",
21
+ ////BilobaFlower: "#a695c7"
22
+
23
+ //#region This part is for backward compatibly
24
+ //trying to match the color one-by-one. kill me plz
25
+ MessengerBlue: "196241301102133", //DefaultBlue
26
+ Viking: "1928399724138152", //TealBlue
27
+ GoldenPoppy: "174636906462322", //Yellow
28
+ RadicalRed: "2129984390566328", //Red
29
+ Shocking: "2058653964378557", //LavenderPurple
30
+ FreeSpeechGreen: "2136751179887052", //Green
31
+ Pumpkin: "175615189761153", //Orange
32
+ LightCoral: "980963458735625", //CoralPink
33
+ MediumSlateBlue: "234137870477637", //BrightPurple
34
+ DeepSkyBlue: "2442142322678320", //AquaBlue
35
+ BrilliantRose: "169463077092846", //HotPink
36
+ //i've tried my best, everything else can't be mapped. (or is it?) -UIRI 2020
37
+ //#endregion
38
+
39
+ DefaultBlue: "196241301102133",
40
+ HotPink: "169463077092846",
41
+ AquaBlue: "2442142322678320",
42
+ BrightPurple: "234137870477637",
43
+ CoralPink: "980963458735625",
44
+ Orange: "175615189761153",
45
+ Green: "2136751179887052",
46
+ LavenderPurple: "2058653964378557",
47
+ Red: "2129984390566328",
48
+ Yellow: "174636906462322",
49
+ TealBlue: "1928399724138152",
50
+ Aqua: "417639218648241",
51
+ Mango: "930060997172551",
52
+ Berry: "164535220883264",
53
+ Citrus: "370940413392601",
54
+ Candy: "205488546921017",
55
+ //StarWars: "809305022860427" Removed.
56
+ };
57
+ };
@@ -0,0 +1,53 @@
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 unsendMessage(userID, 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
+ uid: userID,
26
+ unref: "bd_friends_tab",
27
+ floc: "friends_tab",
28
+ "nctr[_mod]":
29
+ "pagelet_timeline_app_collection_" + ctx.userID + ":2356318349:2",
30
+ };
31
+
32
+ defaultFuncs
33
+ .post(
34
+ "https://www.facebook.com/ajax/profile/removefriendconfirm.php",
35
+ ctx.jar,
36
+ form,
37
+ )
38
+ .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
39
+ .then(function (resData) {
40
+ if (resData.error) {
41
+ throw resData;
42
+ }
43
+
44
+ return callback();
45
+ })
46
+ .catch(function (err) {
47
+ log.error("unfriend", err);
48
+ return callback(err);
49
+ });
50
+
51
+ return returnPromise;
52
+ };
53
+ };