@cexy/hoonfca 1.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 (84) hide show
  1. package/README.md +83 -0
  2. package/index.js +467 -0
  3. package/package.json +12 -0
  4. package/replit.nix +3 -0
  5. package/src/addExternalModule.js +25 -0
  6. package/src/addUserToGroup.js +98 -0
  7. package/src/changeAdminStatus.js +98 -0
  8. package/src/changeArchivedStatus.js +51 -0
  9. package/src/changeAvatar.js +89 -0
  10. package/src/changeBio.js +74 -0
  11. package/src/changeBlockedStatus.js +45 -0
  12. package/src/changeBlockedStatusMqtt.js +65 -0
  13. package/src/changeCover.js +92 -0
  14. package/src/changeGroupImage.js +110 -0
  15. package/src/changeName.js +106 -0
  16. package/src/changeNickname.js +58 -0
  17. package/src/changeThreadColor.js +62 -0
  18. package/src/changeThreadEmoji.js +54 -0
  19. package/src/changeUsername.js +80 -0
  20. package/src/createCommentPost.js +196 -0
  21. package/src/createNewGroup.js +81 -0
  22. package/src/createPoll.js +64 -0
  23. package/src/createPost.js +285 -0
  24. package/src/data/getThreadInfo.json +1 -0
  25. package/src/deleteMessage.js +55 -0
  26. package/src/deleteThread.js +55 -0
  27. package/src/editMessage.js +66 -0
  28. package/src/follow.js +71 -0
  29. package/src/forwardAttachment.js +57 -0
  30. package/src/getAccess.js +130 -0
  31. package/src/getAvatarUser.js +88 -0
  32. package/src/getBotInitialData.js +59 -0
  33. package/src/getCtx.js +5 -0
  34. package/src/getCurrentUserID.js +5 -0
  35. package/src/getEmojiUrl.js +18 -0
  36. package/src/getFriendsList.js +81 -0
  37. package/src/getMessage.js +827 -0
  38. package/src/getOptions.js +5 -0
  39. package/src/getRegion.js +7 -0
  40. package/src/getThreadHistory.js +496 -0
  41. package/src/getThreadHistoryDeprecated.js +95 -0
  42. package/src/getThreadInfo.js +194 -0
  43. package/src/getThreadInfoDeprecated.js +77 -0
  44. package/src/getThreadList.js +219 -0
  45. package/src/getThreadListDeprecated.js +86 -0
  46. package/src/getThreadPictures.js +85 -0
  47. package/src/getUserID.js +67 -0
  48. package/src/getUserInfo.js +89 -0
  49. package/src/handleFriendRequest.js +56 -0
  50. package/src/handleMessageRequest.js +65 -0
  51. package/src/httpGet.js +53 -0
  52. package/src/httpPost.js +53 -0
  53. package/src/httpPostFormData.js +58 -0
  54. package/src/listenMqtt.js +683 -0
  55. package/src/listenNotification.js +96 -0
  56. package/src/logout.js +77 -0
  57. package/src/markAsDelivered.js +53 -0
  58. package/src/markAsRead.js +74 -0
  59. package/src/markAsReadAll.js +46 -0
  60. package/src/markAsSeen.js +57 -0
  61. package/src/muteThread.js +49 -0
  62. package/src/pinMessage.js +60 -0
  63. package/src/refreshFb_dtsg.js +75 -0
  64. package/src/removeUserFromGroup.js +59 -0
  65. package/src/resolvePhotoUrl.js +47 -0
  66. package/src/searchForThread.js +55 -0
  67. package/src/searchStickers.js +59 -0
  68. package/src/sendMessage.js +444 -0
  69. package/src/sendMessageMqtt.js +326 -0
  70. package/src/sendTypingIndicator.js +54 -0
  71. package/src/setMessageReaction.js +126 -0
  72. package/src/setMessageReactionMqtt.js +74 -0
  73. package/src/setPostReaction.js +103 -0
  74. package/src/setProfileGuard.js +66 -0
  75. package/src/setStoryReaction.js +97 -0
  76. package/src/setTitle.js +100 -0
  77. package/src/shareContact.js +101 -0
  78. package/src/shareLink.js +105 -0
  79. package/src/stopListenMqtt.js +47 -0
  80. package/src/threadColors.js +119 -0
  81. package/src/unfriend.js +58 -0
  82. package/src/unsendMessage.js +51 -0
  83. package/src/uploadAttachment.js +98 -0
  84. package/utils.js +919 -0
@@ -0,0 +1,827 @@
1
+ "use strict";
2
+
3
+
4
+ const utils = require("../utils");
5
+
6
+ // বাগ ফিক্স: ReferenceError এড়াতে colors অ্যারেকে ফাইলের শুরুতে ডিফাইন করা হলো
7
+ const colors = [
8
+ {
9
+ theme_color: "FF000000",
10
+ theme_id: "788274591712841",
11
+ theme_emoji: "🖤",
12
+ gradient: '["FFF0F0F0"]',
13
+ should_show_icon: "",
14
+ theme_name_with_subtitle: "Monochrome",
15
+ },
16
+ {
17
+ theme_color: "FFFF5CA1",
18
+ theme_id: "169463077092846",
19
+ theme_emoji: null,
20
+ gradient: null,
21
+ should_show_icon: "1",
22
+ theme_name_with_subtitle: "Hot Pink",
23
+ },
24
+ {
25
+ theme_color: "FF2825B5",
26
+ theme_id: "271607034185782",
27
+ theme_emoji: null,
28
+ gradient: '["FF5E007E","FF331290","FF2825B5"]',
29
+ should_show_icon: "1",
30
+ theme_name_with_subtitle: "Shadow",
31
+ },
32
+ {
33
+ theme_color: "FFD9A900",
34
+ theme_id: "2533652183614000",
35
+ theme_emoji: null,
36
+ gradient: '["FF550029","FFAA3232","FFD9A900"]',
37
+ should_show_icon: "1",
38
+ theme_name_with_subtitle: "Maple",
39
+ },
40
+ {
41
+ theme_color: "FFFB45DE",
42
+ theme_id: "2873642949430623",
43
+ theme_emoji: null,
44
+ gradient: null,
45
+ should_show_icon: "1",
46
+ theme_name_with_subtitle: "Tulip",
47
+ },
48
+ {
49
+ theme_color: "FF5E007E",
50
+ theme_id: "193497045377796",
51
+ theme_emoji: null,
52
+ gradient: null,
53
+ should_show_icon: "1",
54
+ theme_name_with_subtitle: "Grape",
55
+ },
56
+ {
57
+ theme_color: "FF7AA286",
58
+ theme_id: "1455149831518874",
59
+ theme_emoji: "🌑",
60
+ gradient: '["FF25C0E1","FFCE832A"]',
61
+ should_show_icon: "",
62
+ theme_name_with_subtitle: "Dune",
63
+ },
64
+ {
65
+ theme_color: "FFFAAF00",
66
+ theme_id: "672058580051520",
67
+ theme_emoji: null,
68
+ gradient: null,
69
+ should_show_icon: "1",
70
+ theme_name_with_subtitle: "Honey",
71
+ },
72
+ {
73
+ theme_color: "FF0084FF",
74
+ theme_id: "196241301102133",
75
+ theme_emoji: null,
76
+ gradient: null,
77
+ should_show_icon: "1",
78
+ theme_name_with_subtitle: "Default Blue",
79
+ },
80
+ {
81
+ theme_color: "FFFFC300",
82
+ theme_id: "174636906462322",
83
+ theme_emoji: null,
84
+ gradient: null,
85
+ should_show_icon: "1",
86
+ theme_name_with_subtitle: "Yellow",
87
+ },
88
+ {
89
+ theme_color: "FF44BEC7",
90
+ theme_id: "1928399724138152",
91
+ theme_emoji: null,
92
+ gradient: null,
93
+ should_show_icon: "1",
94
+ theme_name_with_subtitle: "Teal Blue",
95
+ },
96
+ {
97
+ theme_color: "FF7646FF",
98
+ theme_id: "234137870477637",
99
+ theme_emoji: null,
100
+ gradient: null,
101
+ should_show_icon: "1",
102
+ theme_name_with_subtitle: "Bright Purple",
103
+ },
104
+ {
105
+ theme_color: "FFF25C54",
106
+ theme_id: "3022526817824329",
107
+ theme_emoji: null,
108
+ gradient: null,
109
+ should_show_icon: "1",
110
+ theme_name_with_subtitle: "Peach",
111
+ },
112
+ {
113
+ theme_color: "FFF01D6A",
114
+ theme_id: "724096885023603",
115
+ theme_emoji: null,
116
+ gradient: '["FF005FFF","FF9200FF","FFFF2E19"]',
117
+ should_show_icon: "1",
118
+ theme_name_with_subtitle: "Berry",
119
+ },
120
+ {
121
+ theme_color: "FFFF7CA8",
122
+ theme_id: "624266884847972",
123
+ theme_emoji: null,
124
+ gradient: '["FFFF8FB2","FFA797FF","FF00E5FF"]',
125
+ should_show_icon: "1",
126
+ theme_name_with_subtitle: "Candy",
127
+ },
128
+ {
129
+ theme_color: "FF6E5B04",
130
+ theme_id: "365557122117011",
131
+ theme_emoji: "💛",
132
+ gradient: '["FFED9F9A","FFED9F9A","FFED9F9A"]',
133
+ should_show_icon: "",
134
+ theme_name_with_subtitle: "Support",
135
+ },
136
+ {
137
+ theme_color: "FF0052CD",
138
+ theme_id: "230032715012014",
139
+ theme_emoji: "✌️",
140
+ gradient: '["FF0052CD","FF00A1E6","FF0052CD"]',
141
+ should_show_icon: "",
142
+ theme_name_with_subtitle: "Tie-Dye",
143
+ },
144
+ {
145
+ theme_color: "FF601DDD",
146
+ theme_id: "1060619084701625",
147
+ theme_emoji: "☁️",
148
+ gradient: '["FFCA34FF","FF302CFF","FFBA009C"]',
149
+ should_show_icon: "",
150
+ theme_name_with_subtitle: "Lo-Fi",
151
+ },
152
+ {
153
+ theme_color: "FF0099FF",
154
+ theme_id: "3273938616164733",
155
+ theme_emoji: null,
156
+ gradient: null,
157
+ should_show_icon: "1",
158
+ theme_name_with_subtitle: "Classic",
159
+ },
160
+ {
161
+ theme_color: "FF1ADB5B",
162
+ theme_id: "370940413392601",
163
+ theme_emoji: null,
164
+ gradient: '["FFFFD200","FF6EDF00","FF00DFBB"]',
165
+ should_show_icon: "1",
166
+ theme_name_with_subtitle: "Citrus",
167
+ },
168
+ {
169
+ theme_color: "FFD696BB",
170
+ theme_id: "2058653964378557",
171
+ theme_emoji: null,
172
+ gradient: null,
173
+ should_show_icon: "1",
174
+ theme_name_with_subtitle: "Lavender Purple",
175
+ },
176
+ {
177
+ theme_color: "FFC03232",
178
+ theme_id: "1059859811490132",
179
+ theme_emoji: "🙃",
180
+ gradient: '["FFDB4040","FFA32424"]',
181
+ should_show_icon: "",
182
+ theme_name_with_subtitle: "Stranger Things",
183
+ },
184
+ {
185
+ theme_color: "FFFA3C4C",
186
+ theme_id: "2129984390566328",
187
+ theme_emoji: null,
188
+ gradient: null,
189
+ should_show_icon: "1",
190
+ theme_name_with_subtitle: "Red",
191
+ },
192
+ {
193
+ theme_color: "FF13CF13",
194
+ theme_id: "2136751179887052",
195
+ theme_emoji: null,
196
+ gradient: null,
197
+ should_show_icon: "1",
198
+ theme_name_with_subtitle: "Green",
199
+ },
200
+ {
201
+ theme_color: "FFFF7E29",
202
+ theme_id: "175615189761153",
203
+ theme_emoji: null,
204
+ gradient: null,
205
+ should_show_icon: "1",
206
+ theme_name_with_subtitle: "Orange",
207
+ },
208
+ {
209
+ theme_color: "FFE68585",
210
+ theme_id: "980963458735625",
211
+ theme_emoji: null,
212
+ gradient: null,
213
+ should_show_icon: "1",
214
+ theme_name_with_subtitle: "Coral Pink",
215
+ },
216
+ {
217
+ theme_color: "FF20CEF5",
218
+ theme_id: "2442142322678320",
219
+ theme_emoji: null,
220
+ gradient: null,
221
+ should_show_icon: "1",
222
+ theme_name_with_subtitle: "Aqua Blue",
223
+ },
224
+ {
225
+ theme_color: "FF0EDCDE",
226
+ theme_id: "417639218648241",
227
+ theme_emoji: null,
228
+ gradient: '["FF19C9FF","FF00E6D2","FF0EE6B7"]',
229
+ should_show_icon: "1",
230
+ theme_name_with_subtitle: "Aqua",
231
+ },
232
+ {
233
+ theme_color: "FFFF9C19",
234
+ theme_id: "930060997172551",
235
+ theme_emoji: null,
236
+ gradient: '["FFFFDC2D","FFFF9616","FFFF4F00"]',
237
+ should_show_icon: "1",
238
+ theme_name_with_subtitle: "Mango",
239
+ },
240
+ {
241
+ theme_color: "FFF01D6A",
242
+ theme_id: "164535220883264",
243
+ theme_emoji: null,
244
+ gradient: '["FF005FFF","FF9200FF","FFFF2E19"]',
245
+ should_show_icon: "1",
246
+ theme_name_with_subtitle: "Berry",
247
+ },
248
+ {
249
+ theme_color: "FFFF7CA8",
250
+ theme_id: "205488546921017",
251
+ theme_emoji: null,
252
+ gradient: '["FFFF8FB2","FFA797FF","FF00E5FF"]',
253
+ should_show_icon: "1",
254
+ theme_name_with_subtitle: "Candy",
255
+ },
256
+ {
257
+ theme_color: "FFFF6F07",
258
+ theme_id: "1833559466821043",
259
+ theme_emoji: "🌎",
260
+ gradient: '["FFFF6F07"]',
261
+ should_show_icon: "",
262
+ theme_name_with_subtitle: "Earth",
263
+ },
264
+ {
265
+ theme_color: "FF0B0085",
266
+ theme_id: "339021464972092",
267
+ theme_emoji: "🔈",
268
+ gradient: '["FF2FA9E4","FF648FEB","FF9B73F2"]',
269
+ should_show_icon: "",
270
+ theme_name_with_subtitle: "Music",
271
+ },
272
+ {
273
+ theme_color: "FF8A39EF",
274
+ theme_id: "1652456634878319",
275
+ theme_emoji: "🏳️‍🌈",
276
+ gradient:
277
+ '["FFFF0018","FFFF0417","FFFF310E","FFFF5D06","FFFF7A01","FFFF8701","FFFFB001","FFD9C507","FF79C718","FF01C92D","FF01BE69","FF01B3AA","FF0BA1DF","FF3F77E6","FF724CEC","FF8A39EF","FF8A39EF"]',
278
+ should_show_icon: "",
279
+ theme_name_with_subtitle: "Pride",
280
+ },
281
+ {
282
+ theme_color: "FF004D7C",
283
+ theme_id: "538280997628317",
284
+ theme_emoji: "🌀",
285
+ gradient: '["FF931410","FF931410","FF931410"]',
286
+ should_show_icon: "",
287
+ theme_name_with_subtitle: "Doctor Strange",
288
+ },
289
+ {
290
+ theme_color: "FF4F4DFF",
291
+ theme_id: "3190514984517598",
292
+ theme_emoji: "🌤",
293
+ gradient: '["FF0080FF","FF9F1AFF"]',
294
+ should_show_icon: "",
295
+ theme_name_with_subtitle: "Sky",
296
+ },
297
+ {
298
+ theme_color: "FFE84B28",
299
+ theme_id: "357833546030778",
300
+ theme_emoji: "🐯",
301
+ gradient: '["FFF69500","FFDA0050"]',
302
+ should_show_icon: "1",
303
+ theme_name_with_subtitle: "Lunar New Year",
304
+ },
305
+ {
306
+ theme_color: "FFB24B77",
307
+ theme_id: "627144732056021",
308
+ theme_emoji: "🥳",
309
+ gradient: '["FFF1614E","FF660F84"]',
310
+ should_show_icon: "",
311
+ theme_name_with_subtitle: "Celebration!",
312
+ },
313
+ {
314
+ theme_color: "FF66A9FF",
315
+ theme_id: "390127158985345",
316
+ theme_emoji: "🥶",
317
+ gradient: '["FF8CB3FF","FF409FFF"]',
318
+ should_show_icon: "",
319
+ theme_name_with_subtitle: "Chill",
320
+ },
321
+ {
322
+ theme_color: "FF5797FC",
323
+ theme_id: "275041734441112",
324
+ theme_emoji: "😌",
325
+ gradient: '["FF4AC9E4","FF5890FF","FF8C91FF"]',
326
+ should_show_icon: "",
327
+ theme_name_with_subtitle: "Care",
328
+ },
329
+ {
330
+ theme_color: "FFFF595C",
331
+ theme_id: "3082966625307060",
332
+ theme_emoji: "💫",
333
+ gradient: '["FFFF239A","FFFF8C21"]',
334
+ should_show_icon: "",
335
+ theme_name_with_subtitle: "Astrology",
336
+ },
337
+ {
338
+ theme_color: "FF0171FF",
339
+ theme_id: "184305226956268",
340
+ theme_emoji: "☁️",
341
+ gradient: '["FF0026ee","FF00b2ff"]',
342
+ should_show_icon: "",
343
+ theme_name_with_subtitle: "J Balvin",
344
+ },
345
+ {
346
+ theme_color: "FFA033FF",
347
+ theme_id: "621630955405500",
348
+ theme_emoji: "🎉",
349
+ gradient: '["FFFF7061","FFFF5280","FFA033FF","FF0099FF"]',
350
+ should_show_icon: "",
351
+ theme_name_with_subtitle: "Birthday",
352
+ },
353
+ {
354
+ theme_color: "FF006528",
355
+ theme_id: "539927563794799",
356
+ theme_emoji: "🍄",
357
+ gradient: '["FF00d52f","FF006528"]',
358
+ should_show_icon: "",
359
+ theme_name_with_subtitle: "Cottagecore",
360
+ },
361
+ {
362
+ theme_color: "FF4D3EC2",
363
+ theme_id: "736591620215564",
364
+ theme_emoji: null,
365
+ gradient: null,
366
+ should_show_icon: "1",
367
+ theme_name_with_subtitle: "Ocean",
368
+ },
369
+ {
370
+ theme_color: "FF4e4bf5",
371
+ theme_id: "3259963564026002",
372
+ theme_emoji: null,
373
+ gradient: '["FFAA00FF","FF0080FF"]',
374
+ should_show_icon: "1",
375
+ theme_name_with_subtitle: "Default",
376
+ },
377
+ {
378
+ theme_color: "FF3A12FF",
379
+ theme_id: "582065306070020",
380
+ theme_emoji: null,
381
+ gradient: '["FFFAAF00","FFFF2E2E","FF3A12FF"]',
382
+ should_show_icon: "1",
383
+ theme_name_with_subtitle: "Rocket",
384
+ },
385
+ {
386
+ theme_color: "FF3A1D8A",
387
+ theme_id: "273728810607574",
388
+ theme_emoji: null,
389
+ gradient: '["FFFB45DE","FF841DD5","FF3A1D8A"]',
390
+ should_show_icon: "1",
391
+ theme_name_with_subtitle: "Unicorn",
392
+ },
393
+ {
394
+ theme_color: "FF9FD52D",
395
+ theme_id: "262191918210707",
396
+ theme_emoji: null,
397
+ gradient: '["FF2A7FE3","FF00BF91","FF9FD52D"]',
398
+ should_show_icon: "1",
399
+ theme_name_with_subtitle: "Tropical",
400
+ },
401
+ {
402
+ theme_color: "FFF7B267",
403
+ theme_id: "909695489504566",
404
+ theme_emoji: null,
405
+ gradient: '["FFF25C54","FFF4845F","FFF7B267"]',
406
+ should_show_icon: "1",
407
+ theme_name_with_subtitle: "Sushi",
408
+ },
409
+ {
410
+ theme_color: "FF1ADB5B",
411
+ theme_id: "557344741607350",
412
+ theme_emoji: null,
413
+ gradient: '["FFFFD200","FF6EDF00","FF00DFBB"]',
414
+ should_show_icon: "1",
415
+ theme_name_with_subtitle: "Citrus",
416
+ },
417
+ {
418
+ theme_color: "FF4D3EC2",
419
+ theme_id: "280333826736184",
420
+ theme_emoji: null,
421
+ gradient: '["FFFF625B","FFC532AD","FF4D3EC2"]',
422
+ should_show_icon: "1",
423
+ theme_name_with_subtitle: "Lollipop",
424
+ },
425
+ {
426
+ theme_color: "FFFF311E",
427
+ theme_id: "1257453361255152",
428
+ theme_emoji: null,
429
+ gradient: null,
430
+ should_show_icon: "1",
431
+ theme_name_with_subtitle: "Rose",
432
+ },
433
+ {
434
+ theme_color: "FFA797FF",
435
+ theme_id: "571193503540759",
436
+ theme_emoji: null,
437
+ gradient: null,
438
+ should_show_icon: "1",
439
+ theme_name_with_subtitle: "Lavender",
440
+ },
441
+ {
442
+ theme_color: "FF6EDF00",
443
+ theme_id: "3151463484918004",
444
+ theme_emoji: null,
445
+ gradient: null,
446
+ should_show_icon: "1",
447
+ theme_name_with_subtitle: "Kiwi",
448
+ },
449
+ {
450
+ theme_color: "FF9D59D2",
451
+ theme_id: "737761000603635",
452
+ theme_emoji: "💛",
453
+ gradient: '["FFFFD600","FFFCB37B","FF9D59D2","FF282828"]',
454
+ should_show_icon: "",
455
+ theme_name_with_subtitle: "Non-Binary",
456
+ },
457
+ {
458
+ theme_color: "FF57C39C",
459
+ theme_id: "1288506208402340",
460
+ theme_emoji: "💐",
461
+ gradient: '["FF57C39C","FF57C39C","FF57C39C"]',
462
+ should_show_icon: "",
463
+ theme_name_with_subtitle: "Mother's Day",
464
+ },
465
+ {
466
+ theme_color: "FFF65900",
467
+ theme_id: "121771470870245",
468
+ theme_emoji: "💥",
469
+ gradient: '["FFFF8328","FFFF7014","FFFF5C00"]',
470
+ should_show_icon: "",
471
+ theme_name_with_subtitle: "APAHM",
472
+ },
473
+ {
474
+ theme_color: "FF978E21",
475
+ theme_id: "810978360551741",
476
+ theme_emoji: "🪺",
477
+ gradient: '["FF978E21","FF978E21","FF978E21"]',
478
+ should_show_icon: "",
479
+ theme_name_with_subtitle: "Parenthood",
480
+ },
481
+ {
482
+ theme_color: "FFDD8800",
483
+ theme_id: "1438011086532622",
484
+ theme_emoji: "✨",
485
+ gradient: '["FFEDAB00","FFCD6300"]',
486
+ should_show_icon: "",
487
+ theme_name_with_subtitle: "Star Wars",
488
+ },
489
+ {
490
+ theme_color: "FF7D09B9",
491
+ theme_id: "101275642962533",
492
+ theme_emoji: "🚀",
493
+ gradient: '["FF5C22D6","FF8F1EB5","FFC31B92"]',
494
+ should_show_icon: "",
495
+ theme_name_with_subtitle: "Guardians of the Galaxy",
496
+ },
497
+ {
498
+ theme_color: "FF61C500",
499
+ theme_id: "158263147151440",
500
+ theme_emoji: "🐝",
501
+ gradient: '["FF61C500","FF61C500","FF61C500"]',
502
+ should_show_icon: "",
503
+ theme_name_with_subtitle: "Bloom",
504
+ },
505
+ {
506
+ theme_color: "FF826044",
507
+ theme_id: "195296273246380",
508
+ theme_emoji: "🧋",
509
+ gradient: '["FF886546","FFA27F57","FFC6A26E"]',
510
+ should_show_icon: "",
511
+ theme_name_with_subtitle: "Bubble Tea",
512
+ },
513
+ {
514
+ theme_color: "FFB02501",
515
+ theme_id: "6026716157422736",
516
+ theme_emoji: "⛹️",
517
+ gradient: '["FFAC2503","FFB02501","FFB42400"]',
518
+ should_show_icon: "",
519
+ theme_name_with_subtitle: "Basketball",
520
+ },
521
+ {
522
+ theme_color: "FF574DC1",
523
+ theme_id: "693996545771691",
524
+ theme_emoji: "🖤",
525
+ gradient: '["FF4533FF","FF574AE0","FF6C64BE"]',
526
+ should_show_icon: "",
527
+ theme_name_with_subtitle: "Elephants&Flowers",
528
+ },
529
+ {
530
+ theme_color: "FFA8B8DA",
531
+ theme_id: "504518465021637",
532
+ theme_emoji: "🏳️‍⚧️",
533
+ gradient: '["FF55D0FF","FF7597D7","FFFF9FB3","FFFF9FB3"]',
534
+ should_show_icon: "",
535
+ theme_name_with_subtitle: "Transgender",
536
+ },
537
+ ];
538
+
539
+ function formatMessage(threadID, data) {
540
+ switch (data.__typename) {
541
+ case "ThreadNameMessage":
542
+ return {
543
+ type: "event",
544
+ threadID: threadID,
545
+ messageID: data.message_id,
546
+ logMessageType: "log:thread-name",
547
+ logMessageData: {
548
+ name: data.thread_name,
549
+ },
550
+ logMessageBody: data.snippet,
551
+ timestamp: data.timestamp_precise,
552
+ author: data.message_sender.id,
553
+ };
554
+ case "ThreadImageMessage":
555
+ const metadata = data.image_with_metadata;
556
+ return {
557
+ type: "event",
558
+ threadID: threadID,
559
+ messageID: data.message_id,
560
+ logMessageType: "log:thread-image",
561
+ logMessageData: metadata
562
+ ? {
563
+ attachmentID: metadata.legacy_attachment_id,
564
+ width: metadata.original_dimensions.x,
565
+ height: metadata.original_dimensions.y,
566
+ url: metadata.preview.uri,
567
+ }
568
+ : {
569
+ attachmentID: null,
570
+ width: null,
571
+ height: null,
572
+ url: null,
573
+ },
574
+ logMessageBody: data.snippet,
575
+ timestamp: data.timestamp_precise,
576
+ author: data.message_sender.id,
577
+ };
578
+ case "GenericAdminTextMessage":
579
+ switch (data.extensible_message_admin_text_type) {
580
+ case "CHANGE_THREAD_THEME":
581
+ return {
582
+ type: "event",
583
+ threadID: threadID,
584
+ messageID: data.message_id,
585
+ logMessageType: "log:thread-color",
586
+ logMessageData: colors.find(
587
+ (color) =>
588
+ color.theme_color ===
589
+ data.extensible_message_admin_text.theme_color
590
+ ) || {
591
+ theme_color: data.extensible_message_admin_text.theme_color,
592
+ theme_id: null,
593
+ theme_emoji: null,
594
+ gradient: null,
595
+ should_show_icon: null,
596
+ theme_name_with_subtitle: null,
597
+ },
598
+ logMessageBody: data.snippet,
599
+ timestamp: data.timestamp_precise,
600
+ author: data.message_sender.id,
601
+ };
602
+ case "CHANGE_THREAD_ICON":
603
+ const thread_icon = data.extensible_message_admin_text.thread_icon;
604
+ return {
605
+ type: "event",
606
+ threadID: threadID,
607
+ messageID: data.message_id,
608
+ logMessageType: "log:thread-icon",
609
+ logMessageData: {
610
+ thread_icon_url: `https://static.xx.fbcdn.net/images/emoji.php/v9/t3c/1/16/${thread_icon
611
+ .codePointAt(0)
612
+ .toString(16)}.png`,
613
+ thread_icon: thread_icon,
614
+ },
615
+ logMessageBody: data.snippet,
616
+ timestamp: data.timestamp_precise,
617
+ author: data.message_sender.id,
618
+ };
619
+ case "CHANGE_THREAD_NICKNAME":
620
+ return {
621
+ type: "event",
622
+ threadID: threadID,
623
+ messageID: data.message_id,
624
+ logMessageType: "log:user-nickname",
625
+ logMessageData: {
626
+ nickname: data.extensible_message_admin_text.nickname,
627
+ participant_id: data.extensible_message_admin_text.participant_id,
628
+ },
629
+ logMessageBody: data.snippet,
630
+ timestamp: data.timestamp_precise,
631
+ author: data.message_sender.id,
632
+ };
633
+ case "GROUP_POLL":
634
+ const question = data.extensible_message_admin_text.question;
635
+ return {
636
+ type: "event",
637
+ threadID: threadID,
638
+ messageID: data.message_id,
639
+ logMessageType: "log:thread-poll",
640
+ logMessageData: {
641
+ question_json: JSON.stringify({
642
+ id: question.id,
643
+ text: question.text,
644
+ total_count: data.extensible_message_admin_text.total_count,
645
+ viewer_has_voted: question.viewer_has_voted,
646
+ question_type: "",
647
+ creator_id: data.message_sender.id,
648
+ options: question.options.nodes.map((option) => ({
649
+ id: option.id,
650
+ text: option.text,
651
+ total_count: option.voters.nodes.length,
652
+ viewer_has_voted: option.viewer_has_voted,
653
+ voters: option.voters.nodes.map((voter) => voter.id),
654
+ })),
655
+ }),
656
+ event_type:
657
+ data.extensible_message_admin_text.event_type.toLowerCase(),
658
+ question_id: question.id,
659
+ },
660
+ logMessageBody: data.snippet,
661
+ timestamp: data.timestamp_precise,
662
+ author: data.message_sender.id,
663
+ };
664
+ default:
665
+ throw new Error(
666
+ `Unknown admin text type: "${data.extensible_message_admin_text_type}". Please open an issue.`
667
+ );
668
+ }
669
+ case "UserMessage":
670
+ return {
671
+ senderID: data.message_sender.id,
672
+ body: data.message.text,
673
+ threadID: threadID,
674
+ messageID: data.message_id,
675
+ reactions: data.message_reactions.map((r) => ({
676
+ [r.user.id]: r.reaction,
677
+ })),
678
+ attachments:
679
+ data.blob_attachments && data.blob_attachments.length > 0
680
+ ? data.blob_attachments.map((att) => { // বাগ ফিক্স: .length.map() এর বদলে সরাসরি .map() করা হয়েছে
681
+ let x;
682
+ try {
683
+ x = utils._formatAttachment(att);
684
+ } catch (ex) {
685
+ x = att;
686
+ x.error = ex;
687
+ x.type = "unknown";
688
+ }
689
+ return x;
690
+ })
691
+ : data.extensible_attachment &&
692
+ Object.keys(data.extensible_attachment).length > 0
693
+ ? [
694
+ {
695
+ type: "share",
696
+ ID: data.extensible_attachment.legacy_attachment_id,
697
+ url: data.extensible_attachment.story_attachment.url,
698
+
699
+ title:
700
+ data.extensible_attachment.story_attachment
701
+ .title_with_entities.text,
702
+ description:
703
+ data.extensible_attachment.story_attachment.description
704
+ .text,
705
+ source: data.extensible_attachment.story_attachment.source,
706
+
707
+ image: (
708
+ (data.extensible_attachment.story_attachment.media || {})
709
+ .image || {}
710
+ ).uri,
711
+ width: (
712
+ (data.extensible_attachment.story_attachment.media || {})
713
+ .image || {}
714
+ ).width,
715
+ height: (
716
+ (data.extensible_attachment.story_attachment.media || {})
717
+ .image || {}
718
+ ).height,
719
+ playable:
720
+ (data.extensible_attachment.story_attachment.media || {})
721
+ .is_playable || false,
722
+ duration:
723
+ (data.extensible_attachment.story_attachment.media || {})
724
+ .playable_duration_in_ms || 0,
725
+
726
+ subattachments: data.extensible_attachment.subattachments,
727
+ properties:
728
+ data.extensible_attachment.story_attachment.properties,
729
+ },
730
+ ]
731
+ : [],
732
+ mentions: data.message.ranges.map((mention) => ({
733
+ [mention.entity.id]: data.message.text.substring(
734
+ mention.offset,
735
+ mention.offset + mention.length
736
+ ),
737
+ })),
738
+ timestamp: data.timestamp_precise,
739
+ };
740
+ default:
741
+ throw new Error(
742
+ `Unknown message type: "${data.__typename}". Please open an issue.`
743
+ );
744
+ }
745
+ }
746
+
747
+ function parseDelta(threadID, delta) {
748
+ if (delta.replied_to_message) {
749
+ return Object.assign(
750
+ {
751
+ type: "message_reply",
752
+ },
753
+ formatMessage(threadID, delta),
754
+ {
755
+ messageReply: formatMessage(threadID, delta.replied_to_message.message),
756
+ }
757
+ );
758
+ } else {
759
+ return formatMessage(threadID, delta);
760
+ }
761
+ }
762
+
763
+ module.exports = function (defaultFuncs, api, ctx) {
764
+ return function getMessage(threadID, messageID, callback) {
765
+ let resolveFunc = () => {};
766
+ let rejectFunc = () => {};
767
+ const returnPromise = new Promise((resolve, reject) => {
768
+ resolveFunc = resolve;
769
+ rejectFunc = reject;
770
+ });
771
+
772
+ if (!callback) {
773
+ callback = function (err, info) {
774
+ if (err) return rejectFunc(err);
775
+ resolveFunc(info);
776
+ };
777
+ }
778
+
779
+ if (!threadID || !messageID) {
780
+ return callback({ error: "getMessage: need threadID and messageID" });
781
+ }
782
+
783
+ const form = {
784
+ av: ctx.globalOptions.pageID,
785
+ queries: JSON.stringify({
786
+ o0: {
787
+ doc_id: "1768656253222505",
788
+ query_params: {
789
+ thread_and_message_id: {
790
+ thread_id: threadID,
791
+ message_id: messageID,
792
+ },
793
+ },
794
+ },
795
+ }),
796
+ };
797
+
798
+ defaultFuncs
799
+ .post("https://www.facebook.com/api/graphqlbatch/", ctx.jar, form)
800
+ .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
801
+ .then((resData) => {
802
+ if (resData[resData.length - 1].error_results > 0) {
803
+ throw resData[0].o0.errors;
804
+ }
805
+
806
+ if (resData[resData.length - 1].successful_results === 0) {
807
+ throw {
808
+ error: "getMessage: there was no successful_results",
809
+ res: resData,
810
+ };
811
+ }
812
+
813
+ const fetchData = resData[0].o0.data.message;
814
+ if (fetchData) {
815
+ return callback(null, parseDelta(threadID, fetchData));
816
+ } else {
817
+ throw fetchData;
818
+ }
819
+ })
820
+ .catch((err) => {
821
+ utils.error("getMessage", err);
822
+ return callback(err);
823
+ });
824
+
825
+ return returnPromise;
826
+ };
827
+ };