daiki-fca 0.0.1

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.

Potentially problematic release.


This version of daiki-fca might be problematic. Click here for more details.

Files changed (296) hide show
  1. package/.cache/nix/binary-cache-v6.sqlite +0 -0
  2. package/.cache/nix/binary-cache-v6.sqlite-journal +0 -0
  3. package/.cache/replit/env/latest +121 -0
  4. package/.cache/replit/env/latest.json +1 -0
  5. package/.cache/replit/modules/nix.res +1 -0
  6. package/.cache/replit/modules/nodejs-20.res +1 -0
  7. package/.cache/replit/modules/replit.res +1 -0
  8. package/.cache/replit/modules.stamp +0 -0
  9. package/.cache/replit/nix/env.json +1 -0
  10. package/.cache/typescript/5.6/node_modules/.package-lock.json +188 -0
  11. package/.cache/typescript/5.6/node_modules/@types/bluebird/LICENSE +21 -0
  12. package/.cache/typescript/5.6/node_modules/@types/bluebird/README.md +15 -0
  13. package/.cache/typescript/5.6/node_modules/@types/bluebird/index.d.ts +1365 -0
  14. package/.cache/typescript/5.6/node_modules/@types/bluebird/package.json +25 -0
  15. package/.cache/typescript/5.6/node_modules/@types/caseless/LICENSE +21 -0
  16. package/.cache/typescript/5.6/node_modules/@types/caseless/README.md +48 -0
  17. package/.cache/typescript/5.6/node_modules/@types/caseless/index.d.ts +29 -0
  18. package/.cache/typescript/5.6/node_modules/@types/caseless/package.json +35 -0
  19. package/.cache/typescript/5.6/node_modules/@types/cheerio/LICENSE +21 -0
  20. package/.cache/typescript/5.6/node_modules/@types/cheerio/README.md +15 -0
  21. package/.cache/typescript/5.6/node_modules/@types/cheerio/index.d.ts +318 -0
  22. package/.cache/typescript/5.6/node_modules/@types/cheerio/package.json +71 -0
  23. package/.cache/typescript/5.6/node_modules/@types/mocha/LICENSE +21 -0
  24. package/.cache/typescript/5.6/node_modules/@types/mocha/README.md +15 -0
  25. package/.cache/typescript/5.6/node_modules/@types/mocha/index.d.ts +2929 -0
  26. package/.cache/typescript/5.6/node_modules/@types/mocha/package.json +56 -0
  27. package/.cache/typescript/5.6/node_modules/@types/node/LICENSE +21 -0
  28. package/.cache/typescript/5.6/node_modules/@types/node/README.md +15 -0
  29. package/.cache/typescript/5.6/node_modules/@types/node/assert/strict.d.ts +8 -0
  30. package/.cache/typescript/5.6/node_modules/@types/node/assert.d.ts +1040 -0
  31. package/.cache/typescript/5.6/node_modules/@types/node/async_hooks.d.ts +541 -0
  32. package/.cache/typescript/5.6/node_modules/@types/node/buffer.buffer.d.ts +385 -0
  33. package/.cache/typescript/5.6/node_modules/@types/node/buffer.d.ts +1933 -0
  34. package/.cache/typescript/5.6/node_modules/@types/node/child_process.d.ts +1549 -0
  35. package/.cache/typescript/5.6/node_modules/@types/node/cluster.d.ts +579 -0
  36. package/.cache/typescript/5.6/node_modules/@types/node/compatibility/disposable.d.ts +16 -0
  37. package/.cache/typescript/5.6/node_modules/@types/node/compatibility/index.d.ts +9 -0
  38. package/.cache/typescript/5.6/node_modules/@types/node/compatibility/indexable.d.ts +23 -0
  39. package/.cache/typescript/5.6/node_modules/@types/node/compatibility/iterators.d.ts +21 -0
  40. package/.cache/typescript/5.6/node_modules/@types/node/console.d.ts +452 -0
  41. package/.cache/typescript/5.6/node_modules/@types/node/constants.d.ts +19 -0
  42. package/.cache/typescript/5.6/node_modules/@types/node/crypto.d.ts +4475 -0
  43. package/.cache/typescript/5.6/node_modules/@types/node/dgram.d.ts +597 -0
  44. package/.cache/typescript/5.6/node_modules/@types/node/diagnostics_channel.d.ts +554 -0
  45. package/.cache/typescript/5.6/node_modules/@types/node/dns/promises.d.ts +476 -0
  46. package/.cache/typescript/5.6/node_modules/@types/node/dns.d.ts +865 -0
  47. package/.cache/typescript/5.6/node_modules/@types/node/dom-events.d.ts +124 -0
  48. package/.cache/typescript/5.6/node_modules/@types/node/domain.d.ts +170 -0
  49. package/.cache/typescript/5.6/node_modules/@types/node/events.d.ts +931 -0
  50. package/.cache/typescript/5.6/node_modules/@types/node/fs/promises.d.ts +1275 -0
  51. package/.cache/typescript/5.6/node_modules/@types/node/fs.d.ts +4343 -0
  52. package/.cache/typescript/5.6/node_modules/@types/node/globals.d.ts +511 -0
  53. package/.cache/typescript/5.6/node_modules/@types/node/globals.typedarray.d.ts +21 -0
  54. package/.cache/typescript/5.6/node_modules/@types/node/http.d.ts +1958 -0
  55. package/.cache/typescript/5.6/node_modules/@types/node/http2.d.ts +2558 -0
  56. package/.cache/typescript/5.6/node_modules/@types/node/https.d.ts +543 -0
  57. package/.cache/typescript/5.6/node_modules/@types/node/index.d.ts +92 -0
  58. package/.cache/typescript/5.6/node_modules/@types/node/inspector.d.ts +3966 -0
  59. package/.cache/typescript/5.6/node_modules/@types/node/module.d.ts +621 -0
  60. package/.cache/typescript/5.6/node_modules/@types/node/net.d.ts +1005 -0
  61. package/.cache/typescript/5.6/node_modules/@types/node/os.d.ts +495 -0
  62. package/.cache/typescript/5.6/node_modules/@types/node/package.json +220 -0
  63. package/.cache/typescript/5.6/node_modules/@types/node/path.d.ts +200 -0
  64. package/.cache/typescript/5.6/node_modules/@types/node/perf_hooks.d.ts +965 -0
  65. package/.cache/typescript/5.6/node_modules/@types/node/process.d.ts +1996 -0
  66. package/.cache/typescript/5.6/node_modules/@types/node/punycode.d.ts +117 -0
  67. package/.cache/typescript/5.6/node_modules/@types/node/querystring.d.ts +153 -0
  68. package/.cache/typescript/5.6/node_modules/@types/node/readline/promises.d.ts +162 -0
  69. package/.cache/typescript/5.6/node_modules/@types/node/readline.d.ts +589 -0
  70. package/.cache/typescript/5.6/node_modules/@types/node/repl.d.ts +430 -0
  71. package/.cache/typescript/5.6/node_modules/@types/node/sea.d.ts +153 -0
  72. package/.cache/typescript/5.6/node_modules/@types/node/sqlite.d.ts +349 -0
  73. package/.cache/typescript/5.6/node_modules/@types/node/stream/consumers.d.ts +12 -0
  74. package/.cache/typescript/5.6/node_modules/@types/node/stream/promises.d.ts +90 -0
  75. package/.cache/typescript/5.6/node_modules/@types/node/stream/web.d.ts +609 -0
  76. package/.cache/typescript/5.6/node_modules/@types/node/stream.d.ts +1726 -0
  77. package/.cache/typescript/5.6/node_modules/@types/node/string_decoder.d.ts +67 -0
  78. package/.cache/typescript/5.6/node_modules/@types/node/test.d.ts +2248 -0
  79. package/.cache/typescript/5.6/node_modules/@types/node/timers/promises.d.ts +97 -0
  80. package/.cache/typescript/5.6/node_modules/@types/node/timers.d.ts +240 -0
  81. package/.cache/typescript/5.6/node_modules/@types/node/tls.d.ts +1226 -0
  82. package/.cache/typescript/5.6/node_modules/@types/node/trace_events.d.ts +197 -0
  83. package/.cache/typescript/5.6/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +385 -0
  84. package/.cache/typescript/5.6/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +19 -0
  85. package/.cache/typescript/5.6/node_modules/@types/node/ts5.6/index.d.ts +92 -0
  86. package/.cache/typescript/5.6/node_modules/@types/node/tty.d.ts +208 -0
  87. package/.cache/typescript/5.6/node_modules/@types/node/url.d.ts +972 -0
  88. package/.cache/typescript/5.6/node_modules/@types/node/util.d.ts +2397 -0
  89. package/.cache/typescript/5.6/node_modules/@types/node/v8.d.ts +808 -0
  90. package/.cache/typescript/5.6/node_modules/@types/node/vm.d.ts +976 -0
  91. package/.cache/typescript/5.6/node_modules/@types/node/wasi.d.ts +181 -0
  92. package/.cache/typescript/5.6/node_modules/@types/node/worker_threads.d.ts +745 -0
  93. package/.cache/typescript/5.6/node_modules/@types/node/zlib.d.ts +539 -0
  94. package/.cache/typescript/5.6/node_modules/@types/node-cron/LICENSE +21 -0
  95. package/.cache/typescript/5.6/node_modules/@types/node-cron/README.md +76 -0
  96. package/.cache/typescript/5.6/node_modules/@types/node-cron/index.d.ts +57 -0
  97. package/.cache/typescript/5.6/node_modules/@types/node-cron/package.json +50 -0
  98. package/.cache/typescript/5.6/node_modules/@types/npmlog/LICENSE +21 -0
  99. package/.cache/typescript/5.6/node_modules/@types/npmlog/README.md +15 -0
  100. package/.cache/typescript/5.6/node_modules/@types/npmlog/index.d.ts +84 -0
  101. package/.cache/typescript/5.6/node_modules/@types/npmlog/package.json +32 -0
  102. package/.cache/typescript/5.6/node_modules/@types/request/LICENSE +21 -0
  103. package/.cache/typescript/5.6/node_modules/@types/request/README.md +15 -0
  104. package/.cache/typescript/5.6/node_modules/@types/request/index.d.ts +395 -0
  105. package/.cache/typescript/5.6/node_modules/@types/request/package.json +70 -0
  106. package/.cache/typescript/5.6/node_modules/@types/tough-cookie/LICENSE +21 -0
  107. package/.cache/typescript/5.6/node_modules/@types/tough-cookie/README.md +15 -0
  108. package/.cache/typescript/5.6/node_modules/@types/tough-cookie/index.d.ts +321 -0
  109. package/.cache/typescript/5.6/node_modules/@types/tough-cookie/package.json +35 -0
  110. package/.cache/typescript/5.6/node_modules/asynckit/LICENSE +21 -0
  111. package/.cache/typescript/5.6/node_modules/asynckit/README.md +233 -0
  112. package/.cache/typescript/5.6/node_modules/asynckit/bench.js +76 -0
  113. package/.cache/typescript/5.6/node_modules/asynckit/index.js +6 -0
  114. package/.cache/typescript/5.6/node_modules/asynckit/lib/abort.js +29 -0
  115. package/.cache/typescript/5.6/node_modules/asynckit/lib/async.js +34 -0
  116. package/.cache/typescript/5.6/node_modules/asynckit/lib/defer.js +26 -0
  117. package/.cache/typescript/5.6/node_modules/asynckit/lib/iterate.js +75 -0
  118. package/.cache/typescript/5.6/node_modules/asynckit/lib/readable_asynckit.js +91 -0
  119. package/.cache/typescript/5.6/node_modules/asynckit/lib/readable_parallel.js +25 -0
  120. package/.cache/typescript/5.6/node_modules/asynckit/lib/readable_serial.js +25 -0
  121. package/.cache/typescript/5.6/node_modules/asynckit/lib/readable_serial_ordered.js +29 -0
  122. package/.cache/typescript/5.6/node_modules/asynckit/lib/state.js +37 -0
  123. package/.cache/typescript/5.6/node_modules/asynckit/lib/streamify.js +141 -0
  124. package/.cache/typescript/5.6/node_modules/asynckit/lib/terminator.js +29 -0
  125. package/.cache/typescript/5.6/node_modules/asynckit/package.json +63 -0
  126. package/.cache/typescript/5.6/node_modules/asynckit/parallel.js +43 -0
  127. package/.cache/typescript/5.6/node_modules/asynckit/serial.js +17 -0
  128. package/.cache/typescript/5.6/node_modules/asynckit/serialOrdered.js +75 -0
  129. package/.cache/typescript/5.6/node_modules/asynckit/stream.js +21 -0
  130. package/.cache/typescript/5.6/node_modules/combined-stream/License +19 -0
  131. package/.cache/typescript/5.6/node_modules/combined-stream/Readme.md +138 -0
  132. package/.cache/typescript/5.6/node_modules/combined-stream/lib/combined_stream.js +208 -0
  133. package/.cache/typescript/5.6/node_modules/combined-stream/package.json +25 -0
  134. package/.cache/typescript/5.6/node_modules/combined-stream/yarn.lock +17 -0
  135. package/.cache/typescript/5.6/node_modules/delayed-stream/License +19 -0
  136. package/.cache/typescript/5.6/node_modules/delayed-stream/Makefile +7 -0
  137. package/.cache/typescript/5.6/node_modules/delayed-stream/Readme.md +141 -0
  138. package/.cache/typescript/5.6/node_modules/delayed-stream/lib/delayed_stream.js +107 -0
  139. package/.cache/typescript/5.6/node_modules/delayed-stream/package.json +27 -0
  140. package/.cache/typescript/5.6/node_modules/form-data/License +19 -0
  141. package/.cache/typescript/5.6/node_modules/form-data/Readme.md +350 -0
  142. package/.cache/typescript/5.6/node_modules/form-data/index.d.ts +51 -0
  143. package/.cache/typescript/5.6/node_modules/form-data/lib/browser.js +2 -0
  144. package/.cache/typescript/5.6/node_modules/form-data/lib/form_data.js +484 -0
  145. package/.cache/typescript/5.6/node_modules/form-data/lib/populate.js +10 -0
  146. package/.cache/typescript/5.6/node_modules/form-data/package.json +72 -0
  147. package/.cache/typescript/5.6/node_modules/mime-db/HISTORY.md +507 -0
  148. package/.cache/typescript/5.6/node_modules/mime-db/LICENSE +23 -0
  149. package/.cache/typescript/5.6/node_modules/mime-db/README.md +100 -0
  150. package/.cache/typescript/5.6/node_modules/mime-db/db.json +8519 -0
  151. package/.cache/typescript/5.6/node_modules/mime-db/index.js +12 -0
  152. package/.cache/typescript/5.6/node_modules/mime-db/package.json +60 -0
  153. package/.cache/typescript/5.6/node_modules/mime-types/HISTORY.md +397 -0
  154. package/.cache/typescript/5.6/node_modules/mime-types/LICENSE +23 -0
  155. package/.cache/typescript/5.6/node_modules/mime-types/README.md +113 -0
  156. package/.cache/typescript/5.6/node_modules/mime-types/index.js +188 -0
  157. package/.cache/typescript/5.6/node_modules/mime-types/package.json +44 -0
  158. package/.cache/typescript/5.6/node_modules/safe-buffer/LICENSE +21 -0
  159. package/.cache/typescript/5.6/node_modules/safe-buffer/README.md +584 -0
  160. package/.cache/typescript/5.6/node_modules/safe-buffer/index.d.ts +187 -0
  161. package/.cache/typescript/5.6/node_modules/safe-buffer/index.js +65 -0
  162. package/.cache/typescript/5.6/node_modules/safe-buffer/package.json +51 -0
  163. package/.cache/typescript/5.6/node_modules/types-registry/README.md +2 -0
  164. package/.cache/typescript/5.6/node_modules/types-registry/index.json +1 -0
  165. package/.cache/typescript/5.6/node_modules/types-registry/package.json +20 -0
  166. package/.cache/typescript/5.6/node_modules/undici-types/LICENSE +21 -0
  167. package/.cache/typescript/5.6/node_modules/undici-types/README.md +6 -0
  168. package/.cache/typescript/5.6/node_modules/undici-types/agent.d.ts +31 -0
  169. package/.cache/typescript/5.6/node_modules/undici-types/api.d.ts +43 -0
  170. package/.cache/typescript/5.6/node_modules/undici-types/balanced-pool.d.ts +29 -0
  171. package/.cache/typescript/5.6/node_modules/undici-types/cache.d.ts +36 -0
  172. package/.cache/typescript/5.6/node_modules/undici-types/client.d.ts +108 -0
  173. package/.cache/typescript/5.6/node_modules/undici-types/connector.d.ts +34 -0
  174. package/.cache/typescript/5.6/node_modules/undici-types/content-type.d.ts +21 -0
  175. package/.cache/typescript/5.6/node_modules/undici-types/cookies.d.ts +28 -0
  176. package/.cache/typescript/5.6/node_modules/undici-types/diagnostics-channel.d.ts +66 -0
  177. package/.cache/typescript/5.6/node_modules/undici-types/dispatcher.d.ts +255 -0
  178. package/.cache/typescript/5.6/node_modules/undici-types/env-http-proxy-agent.d.ts +21 -0
  179. package/.cache/typescript/5.6/node_modules/undici-types/errors.d.ts +149 -0
  180. package/.cache/typescript/5.6/node_modules/undici-types/eventsource.d.ts +61 -0
  181. package/.cache/typescript/5.6/node_modules/undici-types/fetch.d.ts +209 -0
  182. package/.cache/typescript/5.6/node_modules/undici-types/file.d.ts +39 -0
  183. package/.cache/typescript/5.6/node_modules/undici-types/filereader.d.ts +54 -0
  184. package/.cache/typescript/5.6/node_modules/undici-types/formdata.d.ts +108 -0
  185. package/.cache/typescript/5.6/node_modules/undici-types/global-dispatcher.d.ts +9 -0
  186. package/.cache/typescript/5.6/node_modules/undici-types/global-origin.d.ts +7 -0
  187. package/.cache/typescript/5.6/node_modules/undici-types/handlers.d.ts +15 -0
  188. package/.cache/typescript/5.6/node_modules/undici-types/header.d.ts +4 -0
  189. package/.cache/typescript/5.6/node_modules/undici-types/index.d.ts +71 -0
  190. package/.cache/typescript/5.6/node_modules/undici-types/interceptors.d.ts +17 -0
  191. package/.cache/typescript/5.6/node_modules/undici-types/mock-agent.d.ts +50 -0
  192. package/.cache/typescript/5.6/node_modules/undici-types/mock-client.d.ts +25 -0
  193. package/.cache/typescript/5.6/node_modules/undici-types/mock-errors.d.ts +12 -0
  194. package/.cache/typescript/5.6/node_modules/undici-types/mock-interceptor.d.ts +93 -0
  195. package/.cache/typescript/5.6/node_modules/undici-types/mock-pool.d.ts +25 -0
  196. package/.cache/typescript/5.6/node_modules/undici-types/package.json +55 -0
  197. package/.cache/typescript/5.6/node_modules/undici-types/patch.d.ts +33 -0
  198. package/.cache/typescript/5.6/node_modules/undici-types/pool-stats.d.ts +19 -0
  199. package/.cache/typescript/5.6/node_modules/undici-types/pool.d.ts +39 -0
  200. package/.cache/typescript/5.6/node_modules/undici-types/proxy-agent.d.ts +28 -0
  201. package/.cache/typescript/5.6/node_modules/undici-types/readable.d.ts +60 -0
  202. package/.cache/typescript/5.6/node_modules/undici-types/retry-agent.d.ts +8 -0
  203. package/.cache/typescript/5.6/node_modules/undici-types/retry-handler.d.ts +116 -0
  204. package/.cache/typescript/5.6/node_modules/undici-types/util.d.ts +18 -0
  205. package/.cache/typescript/5.6/node_modules/undici-types/webidl.d.ts +222 -0
  206. package/.cache/typescript/5.6/node_modules/undici-types/websocket.d.ts +150 -0
  207. package/.cache/typescript/5.6/package-lock.json +202 -0
  208. package/.cache/typescript/5.6/package.json +1 -0
  209. package/.replit +8 -0
  210. package/LICENSE +21 -0
  211. package/index.js +460 -0
  212. package/package.json +46 -0
  213. package/replit.nix +3 -0
  214. package/src/Screenshot.js +83 -0
  215. package/src/addExternalModule.js +25 -0
  216. package/src/addUserToGroup.js +115 -0
  217. package/src/changeAdminStatus.js +103 -0
  218. package/src/changeArchivedStatus.js +55 -0
  219. package/src/changeAvatar.js +136 -0
  220. package/src/changeAvatarV2.js +86 -0
  221. package/src/changeAvt.js +85 -0
  222. package/src/changeBio.js +76 -0
  223. package/src/changeBlockedStatus.js +49 -0
  224. package/src/changeBlockedStatusMqtt.js +80 -0
  225. package/src/changeCover.js +72 -0
  226. package/src/changeGroupImage.js +135 -0
  227. package/src/changeName.js +79 -0
  228. package/src/changeNickname.js +59 -0
  229. package/src/changeThreadColor.js +65 -0
  230. package/src/changeThreadEmoji.js +55 -0
  231. package/src/changeUsername.js +59 -0
  232. package/src/createCommentPost.js +230 -0
  233. package/src/createNewGroup.js +88 -0
  234. package/src/createPoll.js +71 -0
  235. package/src/createPost.js +276 -0
  236. package/src/deleteMessage.js +56 -0
  237. package/src/deleteThread.js +56 -0
  238. package/src/editMessage.js +68 -0
  239. package/src/editMessageOld.js +67 -0
  240. package/src/follow.js +74 -0
  241. package/src/forwardAttachment.js +60 -0
  242. package/src/getAccess.js +112 -0
  243. package/src/getAvatarUser.js +78 -0
  244. package/src/getCurrentUserID.js +7 -0
  245. package/src/getEmojiUrl.js +29 -0
  246. package/src/getFriendsList.js +83 -0
  247. package/src/getMessage.js +835 -0
  248. package/src/getRegion.js +7 -0
  249. package/src/getThreadHistory.js +680 -0
  250. package/src/getThreadHistoryDeprecated.js +71 -0
  251. package/src/getThreadInfo.js +232 -0
  252. package/src/getThreadInfoDeprecated.js +56 -0
  253. package/src/getThreadList.js +213 -0
  254. package/src/getThreadListDeprecated.js +46 -0
  255. package/src/getThreadPictures.js +59 -0
  256. package/src/getUID.js +119 -0
  257. package/src/getUserID.js +61 -0
  258. package/src/getUserInfo.js +66 -0
  259. package/src/handleFriendRequest.js +46 -0
  260. package/src/handleMessageRequest.js +47 -0
  261. package/src/httpGet.js +49 -0
  262. package/src/httpPost.js +48 -0
  263. package/src/listenMqtt.js +827 -0
  264. package/src/listenMqtt.txt +827 -0
  265. package/src/logout.js +75 -0
  266. package/src/markAsDelivered.js +47 -0
  267. package/src/markAsRead.js +70 -0
  268. package/src/markAsReadAll.js +40 -0
  269. package/src/markAsSeen.js +48 -0
  270. package/src/muteThread.js +45 -0
  271. package/src/postFormData.txt +46 -0
  272. package/src/refreshFb_dtsg.js +89 -0
  273. package/src/removeUserFromGroup.js +79 -0
  274. package/src/resolvePhotoUrl.js +45 -0
  275. package/src/searchForThread.js +53 -0
  276. package/src/searchStickers.js +53 -0
  277. package/src/sendMessage.js +329 -0
  278. package/src/sendMessageMqtt.js +322 -0
  279. package/src/sendTypingIndicator.js +101 -0
  280. package/src/sendTypingIndicatorV2.js +28 -0
  281. package/src/setMessageReaction.js +122 -0
  282. package/src/setMessageReactionMqtt.js +62 -0
  283. package/src/setPostReaction.js +112 -0
  284. package/src/setStoryReaction.js +64 -0
  285. package/src/setTitle.js +90 -0
  286. package/src/shareContact.js +110 -0
  287. package/src/shareLink.js +59 -0
  288. package/src/stopListenMqtt.js +23 -0
  289. package/src/threadColors.js +131 -0
  290. package/src/unfriend.js +52 -0
  291. package/src/unsendMessage.js +45 -0
  292. package/src/uploadAttachment.js +94 -0
  293. package/test/example-config.json +18 -0
  294. package/test/test-page.js +140 -0
  295. package/test/test.js +385 -0
  296. package/utils.js +2876 -0
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+
3
+ module.exports = function (defaultFuncs, api, ctx) {
4
+ return function getRegion() {
5
+ return ctx?.region;
6
+ };
7
+ };
@@ -0,0 +1,680 @@
1
+ "use strict";
2
+
3
+ const utils = require("../utils");
4
+ // @NethWs3Dev
5
+
6
+ function getExtension(original_extension, filename = "") {
7
+ if (original_extension) {
8
+ return original_extension;
9
+ } else {
10
+ const extension = filename.split(".").pop();
11
+ if (extension === filename) {
12
+ return "";
13
+ } else {
14
+ return extension;
15
+ }
16
+ }
17
+ }
18
+
19
+ function formatAttachmentsGraphQLResponse(attachment) {
20
+ switch (attachment.__typename) {
21
+ case "MessageImage":
22
+ return {
23
+ type: "photo",
24
+ ID: attachment.legacy_attachment_id,
25
+ filename: attachment.filename,
26
+ original_extension: getExtension(
27
+ attachment.original_extension,
28
+ attachment.filename,
29
+ ),
30
+ thumbnailUrl: attachment.thumbnail.uri,
31
+
32
+ previewUrl: attachment.preview.uri,
33
+ previewWidth: attachment.preview.width,
34
+ previewHeight: attachment.preview.height,
35
+
36
+ largePreviewUrl: attachment.large_preview.uri,
37
+ largePreviewHeight: attachment.large_preview.height,
38
+ largePreviewWidth: attachment.large_preview.width,
39
+
40
+ // You have to query for the real image. See below.
41
+ url: attachment.large_preview.uri, // @Legacy
42
+ width: attachment.large_preview.width, // @Legacy
43
+ height: attachment.large_preview.height, // @Legacy
44
+ name: attachment.filename, // @Legacy
45
+
46
+ // @Undocumented
47
+ attributionApp: attachment.attribution_app
48
+ ? {
49
+ attributionAppID: attachment.attribution_app.id,
50
+ name: attachment.attribution_app.name,
51
+ logo: attachment.attribution_app.square_logo,
52
+ }
53
+ : null,
54
+
55
+ // @TODO No idea what this is, should we expose it?
56
+ // Ben - July 15th 2017
57
+ // renderAsSticker: attachment.render_as_sticker,
58
+
59
+ // This is _not_ the real URI, this is still just a large preview.
60
+ // To get the URL we'll need to support a POST query to
61
+ //
62
+ // https://www.facebook.com/webgraphql/query/
63
+ //
64
+ // With the following query params:
65
+ //
66
+ // query_id:728987990612546
67
+ // variables:{"id":"100009069356507","photoID":"10213724771692996"}
68
+ // dpr:1
69
+ //
70
+ // No special form though.
71
+ };
72
+ case "MessageAnimatedImage":
73
+ return {
74
+ type: "animated_image",
75
+ ID: attachment.legacy_attachment_id,
76
+ filename: attachment.filename,
77
+ original_extension: getExtension(
78
+ attachment.original_extension,
79
+ attachment.filename,
80
+ ),
81
+
82
+ previewUrl: attachment.preview_image.uri,
83
+ previewWidth: attachment.preview_image.width,
84
+ previewHeight: attachment.preview_image.height,
85
+
86
+ url: attachment.animated_image.uri,
87
+ width: attachment.animated_image.width,
88
+ height: attachment.animated_image.height,
89
+
90
+ thumbnailUrl: attachment.preview_image.uri, // @Legacy
91
+ name: attachment.filename, // @Legacy
92
+ facebookUrl: attachment.animated_image.uri, // @Legacy
93
+ rawGifImage: attachment.animated_image.uri, // @Legacy
94
+ animatedGifUrl: attachment.animated_image.uri, // @Legacy
95
+ animatedGifPreviewUrl: attachment.preview_image.uri, // @Legacy
96
+ animatedWebpUrl: attachment.animated_image.uri, // @Legacy
97
+ animatedWebpPreviewUrl: attachment.preview_image.uri, // @Legacy
98
+
99
+ // @Undocumented
100
+ attributionApp: attachment.attribution_app
101
+ ? {
102
+ attributionAppID: attachment.attribution_app.id,
103
+ name: attachment.attribution_app.name,
104
+ logo: attachment.attribution_app.square_logo,
105
+ }
106
+ : null,
107
+ };
108
+ case "MessageVideo":
109
+ return {
110
+ type: "video",
111
+ ID: attachment.legacy_attachment_id,
112
+ filename: attachment.filename,
113
+ original_extension: getExtension(
114
+ attachment.original_extension,
115
+ attachment.filename,
116
+ ),
117
+ duration: attachment.playable_duration_in_ms,
118
+
119
+ thumbnailUrl: attachment.large_image.uri, // @Legacy
120
+
121
+ previewUrl: attachment.large_image.uri,
122
+ previewWidth: attachment.large_image.width,
123
+ previewHeight: attachment.large_image.height,
124
+
125
+ url: attachment.playable_url,
126
+ width: attachment.original_dimensions.x,
127
+ height: attachment.original_dimensions.y,
128
+
129
+ videoType: attachment.video_type.toLowerCase(),
130
+ };
131
+ case "MessageFile":
132
+ return {
133
+ type: "file",
134
+ ID: attachment.message_file_fbid,
135
+ filename: attachment.filename,
136
+ original_extension: getExtension(
137
+ attachment.original_extension,
138
+ attachment.filename,
139
+ ),
140
+
141
+ url: attachment.url,
142
+ isMalicious: attachment.is_malicious,
143
+ contentType: attachment.content_type,
144
+
145
+ name: attachment.filename, // @Legacy
146
+ mimeType: "", // @Legacy
147
+ fileSize: -1, // @Legacy
148
+ };
149
+ case "MessageAudio":
150
+ return {
151
+ type: "audio",
152
+ ID: attachment.url_shimhash, // Not fowardable
153
+ filename: attachment.filename,
154
+ original_extension: getExtension(
155
+ attachment.original_extension,
156
+ attachment.filename,
157
+ ),
158
+
159
+ duration: attachment.playable_duration_in_ms,
160
+ audioType: attachment.audio_type,
161
+ url: attachment.playable_url,
162
+
163
+ isVoiceMail: attachment.is_voicemail,
164
+ };
165
+ default:
166
+ return {
167
+ error: "Don't know about attachment type " + attachment.__typename,
168
+ };
169
+ }
170
+ }
171
+
172
+ function formatExtensibleAttachment(attachment) {
173
+ if (attachment.story_attachment) {
174
+ return {
175
+ type: "share",
176
+ ID: attachment.legacy_attachment_id,
177
+ url: attachment.story_attachment.url,
178
+
179
+ title: attachment.story_attachment.title_with_entities.text,
180
+ description:
181
+ attachment.story_attachment.description &&
182
+ attachment.story_attachment.description.text,
183
+ source:
184
+ attachment.story_attachment.source == null
185
+ ? null
186
+ : attachment.story_attachment.source.text,
187
+
188
+ image:
189
+ attachment.story_attachment.media == null
190
+ ? null
191
+ : attachment.story_attachment.media.animated_image == null &&
192
+ attachment.story_attachment.media.image == null
193
+ ? null
194
+ : (
195
+ attachment.story_attachment.media.animated_image ||
196
+ attachment.story_attachment.media.image
197
+ ).uri,
198
+ width:
199
+ attachment.story_attachment.media == null
200
+ ? null
201
+ : attachment.story_attachment.media.animated_image == null &&
202
+ attachment.story_attachment.media.image == null
203
+ ? null
204
+ : (
205
+ attachment.story_attachment.media.animated_image ||
206
+ attachment.story_attachment.media.image
207
+ ).width,
208
+ height:
209
+ attachment.story_attachment.media == null
210
+ ? null
211
+ : attachment.story_attachment.media.animated_image == null &&
212
+ attachment.story_attachment.media.image == null
213
+ ? null
214
+ : (
215
+ attachment.story_attachment.media.animated_image ||
216
+ attachment.story_attachment.media.image
217
+ ).height,
218
+ playable:
219
+ attachment.story_attachment.media == null
220
+ ? null
221
+ : attachment.story_attachment.media.is_playable,
222
+ duration:
223
+ attachment.story_attachment.media == null
224
+ ? null
225
+ : attachment.story_attachment.media.playable_duration_in_ms,
226
+ playableUrl:
227
+ attachment.story_attachment.media == null
228
+ ? null
229
+ : attachment.story_attachment.media.playable_url,
230
+
231
+ subattachments: attachment.story_attachment.subattachments,
232
+
233
+ // Format example:
234
+ //
235
+ // [{
236
+ // key: "width",
237
+ // value: { text: "1280" }
238
+ // }]
239
+ //
240
+ // That we turn into:
241
+ //
242
+ // {
243
+ // width: "1280"
244
+ // }
245
+ //
246
+ properties: attachment.story_attachment.properties.reduce(function (
247
+ obj,
248
+ cur,
249
+ ) {
250
+ obj[cur.key] = cur.value.text;
251
+ return obj;
252
+ }, {}),
253
+
254
+ // Deprecated fields
255
+ animatedImageSize: "", // @Legacy
256
+ facebookUrl: "", // @Legacy
257
+ styleList: "", // @Legacy
258
+ target: "", // @Legacy
259
+ thumbnailUrl:
260
+ attachment.story_attachment.media == null
261
+ ? null
262
+ : attachment.story_attachment.media.animated_image == null &&
263
+ attachment.story_attachment.media.image == null
264
+ ? null
265
+ : (
266
+ attachment.story_attachment.media.animated_image ||
267
+ attachment.story_attachment.media.image
268
+ ).uri, // @Legacy
269
+ thumbnailWidth:
270
+ attachment.story_attachment.media == null
271
+ ? null
272
+ : attachment.story_attachment.media.animated_image == null &&
273
+ attachment.story_attachment.media.image == null
274
+ ? null
275
+ : (
276
+ attachment.story_attachment.media.animated_image ||
277
+ attachment.story_attachment.media.image
278
+ ).width, // @Legacy
279
+ thumbnailHeight:
280
+ attachment.story_attachment.media == null
281
+ ? null
282
+ : attachment.story_attachment.media.animated_image == null &&
283
+ attachment.story_attachment.media.image == null
284
+ ? null
285
+ : (
286
+ attachment.story_attachment.media.animated_image ||
287
+ attachment.story_attachment.media.image
288
+ ).height, // @Legacy
289
+ };
290
+ } else {
291
+ return { error: "Don't know what to do with extensible_attachment." };
292
+ }
293
+ }
294
+
295
+ function formatReactionsGraphQL(reaction) {
296
+ return {
297
+ reaction: reaction.reaction,
298
+ userID: reaction.user.id,
299
+ };
300
+ }
301
+
302
+ function formatEventData(event) {
303
+ if (event == null) {
304
+ return {};
305
+ }
306
+
307
+ switch (event.__typename) {
308
+ case "ThemeColorExtensibleMessageAdminText":
309
+ return {
310
+ color: event.theme_color,
311
+ };
312
+ case "ThreadNicknameExtensibleMessageAdminText":
313
+ return {
314
+ nickname: event.nickname,
315
+ participantID: event.participant_id,
316
+ };
317
+ case "ThreadIconExtensibleMessageAdminText":
318
+ return {
319
+ threadIcon: event.thread_icon,
320
+ };
321
+ case "InstantGameUpdateExtensibleMessageAdminText":
322
+ return {
323
+ gameID: event.game == null ? null : event.game.id,
324
+ update_type: event.update_type,
325
+ collapsed_text: event.collapsed_text,
326
+ expanded_text: event.expanded_text,
327
+ instant_game_update_data: event.instant_game_update_data,
328
+ };
329
+ case "GameScoreExtensibleMessageAdminText":
330
+ return {
331
+ game_type: event.game_type,
332
+ };
333
+ case "RtcCallLogExtensibleMessageAdminText":
334
+ return {
335
+ event: event.event,
336
+ is_video_call: event.is_video_call,
337
+ server_info_data: event.server_info_data,
338
+ };
339
+ case "GroupPollExtensibleMessageAdminText":
340
+ return {
341
+ event_type: event.event_type,
342
+ total_count: event.total_count,
343
+ question: event.question,
344
+ };
345
+ case "AcceptPendingThreadExtensibleMessageAdminText":
346
+ return {
347
+ accepter_id: event.accepter_id,
348
+ requester_id: event.requester_id,
349
+ };
350
+ case "ConfirmFriendRequestExtensibleMessageAdminText":
351
+ return {
352
+ friend_request_recipient: event.friend_request_recipient,
353
+ friend_request_sender: event.friend_request_sender,
354
+ };
355
+ case "AddContactExtensibleMessageAdminText":
356
+ return {
357
+ contact_added_id: event.contact_added_id,
358
+ contact_adder_id: event.contact_adder_id,
359
+ };
360
+ case "AdExtensibleMessageAdminText":
361
+ return {
362
+ ad_client_token: event.ad_client_token,
363
+ ad_id: event.ad_id,
364
+ ad_preferences_link: event.ad_preferences_link,
365
+ ad_properties: event.ad_properties,
366
+ };
367
+ // never data
368
+ case "ParticipantJoinedGroupCallExtensibleMessageAdminText":
369
+ case "ThreadEphemeralTtlModeExtensibleMessageAdminText":
370
+ case "StartedSharingVideoExtensibleMessageAdminText":
371
+ case "LightweightEventCreateExtensibleMessageAdminText":
372
+ case "LightweightEventNotifyExtensibleMessageAdminText":
373
+ case "LightweightEventNotifyBeforeEventExtensibleMessageAdminText":
374
+ case "LightweightEventUpdateTitleExtensibleMessageAdminText":
375
+ case "LightweightEventUpdateTimeExtensibleMessageAdminText":
376
+ case "LightweightEventUpdateLocationExtensibleMessageAdminText":
377
+ case "LightweightEventDeleteExtensibleMessageAdminText":
378
+ return {};
379
+ default:
380
+ return {
381
+ error: "Don't know what to with event data type " + event.__typename,
382
+ };
383
+ }
384
+ }
385
+
386
+ function formatMessagesGraphQLResponse(data) {
387
+ const messageThread = data.o0.data.message_thread;
388
+ const threadID = messageThread.thread_key.thread_fbid
389
+ ? messageThread.thread_key.thread_fbid
390
+ : messageThread.thread_key.other_user_id;
391
+
392
+ const messages = messageThread.messages.nodes.map(function (d) {
393
+ switch (d.__typename) {
394
+ case "UserMessage":
395
+ // Give priority to stickers. They're seen as normal messages but we've
396
+ // been considering them as attachments.
397
+ var maybeStickerAttachment;
398
+ if (d.sticker) {
399
+ maybeStickerAttachment = [
400
+ {
401
+ type: "sticker",
402
+ ID: d.sticker.id,
403
+ url: d.sticker.url,
404
+
405
+ packID: d.sticker.pack ? d.sticker.pack.id : null,
406
+ spriteUrl: d.sticker.sprite_image,
407
+ spriteUrl2x: d.sticker.sprite_image_2x,
408
+ width: d.sticker.width,
409
+ height: d.sticker.height,
410
+
411
+ caption: d.snippet, // Not sure what the heck caption was.
412
+ description: d.sticker.label, // Not sure about this one either.
413
+
414
+ frameCount: d.sticker.frame_count,
415
+ frameRate: d.sticker.frame_rate,
416
+ framesPerRow: d.sticker.frames_per_row,
417
+ framesPerCol: d.sticker.frames_per_col,
418
+
419
+ stickerID: d.sticker.id, // @Legacy
420
+ spriteURI: d.sticker.sprite_image, // @Legacy
421
+ spriteURI2x: d.sticker.sprite_image_2x, // @Legacy
422
+ },
423
+ ];
424
+ }
425
+
426
+ var mentionsObj = {};
427
+ if (d.message !== null) {
428
+ d.message.ranges.forEach((e) => {
429
+ mentionsObj[e.entity.id] = d.message.text.substr(
430
+ e.offset,
431
+ e.length,
432
+ );
433
+ });
434
+ }
435
+
436
+ return {
437
+ type: "message",
438
+ attachments: maybeStickerAttachment
439
+ ? maybeStickerAttachment
440
+ : d.blob_attachments && d.blob_attachments.length > 0
441
+ ? d.blob_attachments.map(formatAttachmentsGraphQLResponse)
442
+ : d.extensible_attachment
443
+ ? [formatExtensibleAttachment(d.extensible_attachment)]
444
+ : [],
445
+ body: d.message !== null ? d.message.text : "",
446
+ isGroup: messageThread.thread_type === "GROUP",
447
+ messageID: d.message_id,
448
+ senderID: d.message_sender.id,
449
+ threadID: threadID,
450
+ timestamp: d.timestamp_precise,
451
+
452
+ mentions: mentionsObj,
453
+ isUnread: d.unread,
454
+
455
+ // New
456
+ messageReactions: d.message_reactions
457
+ ? d.message_reactions.map(formatReactionsGraphQL)
458
+ : null,
459
+ isSponsored: d.is_sponsored,
460
+ snippet: d.snippet,
461
+ };
462
+ case "ThreadNameMessage":
463
+ return {
464
+ type: "event",
465
+ messageID: d.message_id,
466
+ threadID: threadID,
467
+ isGroup: messageThread.thread_type === "GROUP",
468
+ senderID: d.message_sender.id,
469
+ timestamp: d.timestamp_precise,
470
+ eventType: "change_thread_name",
471
+ snippet: d.snippet,
472
+ eventData: {
473
+ threadName: d.thread_name,
474
+ },
475
+
476
+ // @Legacy
477
+ author: d.message_sender.id,
478
+ logMessageType: "log:thread-name",
479
+ logMessageData: { name: d.thread_name },
480
+ };
481
+ case "ThreadImageMessage":
482
+ return {
483
+ type: "event",
484
+ messageID: d.message_id,
485
+ threadID: threadID,
486
+ isGroup: messageThread.thread_type === "GROUP",
487
+ senderID: d.message_sender.id,
488
+ timestamp: d.timestamp_precise,
489
+ eventType: "change_thread_image",
490
+ snippet: d.snippet,
491
+ eventData:
492
+ d.image_with_metadata == null
493
+ ? {} /* removed image */
494
+ : {
495
+ /* image added */
496
+ threadImage: {
497
+ attachmentID: d.image_with_metadata.legacy_attachment_id,
498
+ width: d.image_with_metadata.original_dimensions.x,
499
+ height: d.image_with_metadata.original_dimensions.y,
500
+ url: d.image_with_metadata.preview.uri,
501
+ },
502
+ },
503
+
504
+ // @Legacy
505
+ logMessageType: "log:thread-icon",
506
+ logMessageData: {
507
+ thread_icon: d.image_with_metadata
508
+ ? d.image_with_metadata.preview.uri
509
+ : null,
510
+ },
511
+ };
512
+ case "ParticipantLeftMessage":
513
+ return {
514
+ type: "event",
515
+ messageID: d.message_id,
516
+ threadID: threadID,
517
+ isGroup: messageThread.thread_type === "GROUP",
518
+ senderID: d.message_sender.id,
519
+ timestamp: d.timestamp_precise,
520
+ eventType: "remove_participants",
521
+ snippet: d.snippet,
522
+ eventData: {
523
+ // Array of IDs.
524
+ participantsRemoved: d.participants_removed.map(function (p) {
525
+ return p.id;
526
+ }),
527
+ },
528
+
529
+ // @Legacy
530
+ logMessageType: "log:unsubscribe",
531
+ logMessageData: {
532
+ leftParticipantFbId: d.participants_removed.map(function (p) {
533
+ return p.id;
534
+ }),
535
+ },
536
+ };
537
+ case "ParticipantsAddedMessage":
538
+ return {
539
+ type: "event",
540
+ messageID: d.message_id,
541
+ threadID: threadID,
542
+ isGroup: messageThread.thread_type === "GROUP",
543
+ senderID: d.message_sender.id,
544
+ timestamp: d.timestamp_precise,
545
+ eventType: "add_participants",
546
+ snippet: d.snippet,
547
+ eventData: {
548
+ // Array of IDs.
549
+ participantsAdded: d.participants_added.map(function (p) {
550
+ return p.id;
551
+ }),
552
+ },
553
+
554
+ // @Legacy
555
+ logMessageType: "log:subscribe",
556
+ logMessageData: {
557
+ addedParticipants: d.participants_added.map(function (p) {
558
+ return p.id;
559
+ }),
560
+ },
561
+ };
562
+ case "VideoCallMessage":
563
+ return {
564
+ type: "event",
565
+ messageID: d.message_id,
566
+ threadID: threadID,
567
+ isGroup: messageThread.thread_type === "GROUP",
568
+ senderID: d.message_sender.id,
569
+ timestamp: d.timestamp_precise,
570
+ eventType: "video_call",
571
+ snippet: d.snippet,
572
+
573
+ // @Legacy
574
+ logMessageType: "other",
575
+ };
576
+ case "VoiceCallMessage":
577
+ return {
578
+ type: "event",
579
+ messageID: d.message_id,
580
+ threadID: threadID,
581
+ isGroup: messageThread.thread_type === "GROUP",
582
+ senderID: d.message_sender.id,
583
+ timestamp: d.timestamp_precise,
584
+ eventType: "voice_call",
585
+ snippet: d.snippet,
586
+
587
+ // @Legacy
588
+ logMessageType: "other",
589
+ };
590
+ case "GenericAdminTextMessage":
591
+ return {
592
+ type: "event",
593
+ messageID: d.message_id,
594
+ threadID: threadID,
595
+ isGroup: messageThread.thread_type === "GROUP",
596
+ senderID: d.message_sender.id,
597
+ timestamp: d.timestamp_precise,
598
+ snippet: d.snippet,
599
+ eventType: d.extensible_message_admin_text_type.toLowerCase(),
600
+ eventData: formatEventData(d.extensible_message_admin_text),
601
+
602
+ // @Legacy
603
+ logMessageType: utils.getAdminTextMessageType(
604
+ d.extensible_message_admin_text_type,
605
+ ),
606
+ logMessageData: d.extensible_message_admin_text, // Maybe different?
607
+ };
608
+ default:
609
+ return { error: "Don't know about message type " + d.__typename };
610
+ }
611
+ });
612
+ return messages;
613
+ }
614
+
615
+ module.exports = function (defaultFuncs, api, ctx) {
616
+ return function getThreadHistoryGraphQL(
617
+ threadID,
618
+ amount,
619
+ timestamp,
620
+ callback,
621
+ ) {
622
+ let resolveFunc = function () {};
623
+ let rejectFunc = function () {};
624
+ const returnPromise = new Promise(function (resolve, reject) {
625
+ resolveFunc = resolve;
626
+ rejectFunc = reject;
627
+ });
628
+
629
+ if (!callback) {
630
+ callback = function (err, data) {
631
+ if (err) {
632
+ return rejectFunc(err);
633
+ }
634
+ resolveFunc(data);
635
+ };
636
+ }
637
+
638
+ // `queries` has to be a string. I couldn't tell from the dev console. This
639
+ // took me a really long time to figure out. I deserve a cookie for this.
640
+ const form = {
641
+ av: ctx.globalOptions.pageID,
642
+ queries: JSON.stringify({
643
+ o0: {
644
+ // This doc_id was valid on February 2nd 2017.
645
+ doc_id: "1498317363570230",
646
+ query_params: {
647
+ id: threadID,
648
+ message_limit: amount,
649
+ load_messages: 1,
650
+ load_read_receipts: false,
651
+ before: timestamp,
652
+ },
653
+ },
654
+ }),
655
+ };
656
+
657
+ defaultFuncs
658
+ .post("https://www.facebook.com/api/graphqlbatch/", ctx.jar, form)
659
+ .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
660
+ .then(function (resData) {
661
+ if (resData.error) {
662
+ throw resData;
663
+ }
664
+ // This returns us an array of things. The last one is the success /
665
+ // failure one.
666
+ // @TODO What do we do in this case?
667
+ if (resData[resData.length - 1].error_results !== 0) {
668
+ throw new Error("There was an error_result.");
669
+ }
670
+
671
+ callback(null, formatMessagesGraphQLResponse(resData[0]));
672
+ })
673
+ .catch(function (err) {
674
+ console.error("getThreadHistoryGraphQL", err);
675
+ return callback(err);
676
+ });
677
+
678
+ return returnPromise;
679
+ };
680
+ };