fca-smart-shankar 12.0.0 → 13.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 (285) hide show
  1. package/.replit +12 -3
  2. package/.upm/store.json +1 -0
  3. package/CHANGELOG.md +2 -0
  4. package/README.md +0 -1
  5. package/generated-icon.png +0 -0
  6. package/index.js +507 -437
  7. package/package.json +378 -42
  8. package/replit.nix +3 -1
  9. package/shankar-fca.json +4 -0
  10. package/src/addUserToGroup.js +3 -3
  11. package/src/changeAdminStatus.js +2 -2
  12. package/src/changeArchivedStatus.js +2 -2
  13. package/src/changeAvatar.js +8 -8
  14. package/src/changeAvatarV2.js +1 -1
  15. package/src/changeBio.js +4 -4
  16. package/src/changeBlockedStatus.js +2 -2
  17. package/src/changeCover.js +2 -2
  18. package/src/changeGroupImage.js +4 -4
  19. package/src/changeName.js +2 -2
  20. package/src/changeNickname.js +2 -2
  21. package/src/changeThreadColor.js +3 -3
  22. package/src/changeThreadEmoji.js +2 -2
  23. package/src/changeUsername.js +3 -3
  24. package/src/createCommentPost.js +5 -5
  25. package/src/createNewGroup.js +5 -5
  26. package/src/createPoll.js +2 -2
  27. package/src/createPost.js +6 -5
  28. package/src/deleteMessage.js +2 -2
  29. package/src/deleteThread.js +2 -2
  30. package/src/editMessage.js +30 -18
  31. package/src/follow.js +8 -8
  32. package/src/forwardAttachment.js +2 -2
  33. package/src/getAccess.js +2 -2
  34. package/src/getAvatarUser.js +2 -2
  35. package/src/getCurrentUserID.js +4 -4
  36. package/src/getFriendsList.js +3 -3
  37. package/src/getMessage.js +2 -2
  38. package/src/getThreadHistory.js +2 -2
  39. package/src/getThreadHistoryDeprecated.js +2 -2
  40. package/src/getThreadInfo.js +1 -1
  41. package/src/getThreadInfoDeprecated.js +2 -2
  42. package/src/getThreadList.js +3 -3
  43. package/src/getThreadListDeprecated.js +3 -3
  44. package/src/getThreadPictures.js +2 -2
  45. package/src/getUID.js +4 -4
  46. package/src/getUserID.js +3 -3
  47. package/src/getUserInfo.js +52 -18
  48. package/src/handleFriendRequest.js +5 -5
  49. package/src/handleMessageRequest.js +2 -2
  50. package/src/httpGet.js +3 -3
  51. package/src/httpPost.js +3 -3
  52. package/src/httpPostFormData.js +3 -3
  53. package/src/listenMqtt.js +648 -659
  54. package/src/listenNotification.js +1 -1
  55. package/src/logout.js +3 -3
  56. package/src/markAsDelivered.js +5 -2
  57. package/src/markAsRead.js +5 -2
  58. package/src/markAsReadAll.js +2 -2
  59. package/src/markAsSeen.js +2 -2
  60. package/src/muteThread.js +2 -2
  61. package/src/refreshFb_dtsg.js +3 -3
  62. package/src/removeUserFromGroup.js +2 -2
  63. package/src/resolvePhotoUrl.js +2 -2
  64. package/src/searchStickers.js +1 -1
  65. package/src/sendMessage.js +11 -8
  66. package/src/sendMessageMqtt.js +4 -4
  67. package/src/sendTypingIndicator.js +14 -5
  68. package/src/sendTypingIndicatorV2.js +1 -1
  69. package/src/setMessageReaction.js +3 -3
  70. package/src/setPostReaction.js +4 -4
  71. package/src/setProfileGuard.js +3 -3
  72. package/src/setStoryReaction.js +1 -1
  73. package/src/setTitle.js +3 -3
  74. package/src/shareContact.js +1 -1
  75. package/src/shareLink.js +1 -1
  76. package/src/stopListenMqtt.js +5 -2
  77. package/src/unfriend.js +2 -2
  78. package/src/unsendMessage.js +2 -2
  79. package/src/uploadAttachment.js +2 -2
  80. package/test/data/shareAttach.js +146 -0
  81. package/test/data/something.mov +0 -0
  82. package/test/data/test.png +0 -0
  83. package/test/data/test.txt +7 -0
  84. package/test/test-page.js +1 -1
  85. package/utils.js +564 -391
  86. package/.cache/nix/binary-cache-v6.sqlite +0 -0
  87. package/.cache/nix/binary-cache-v6.sqlite-journal +0 -0
  88. package/.cache/replit/env/latest +0 -125
  89. package/.cache/replit/env/latest.json +0 -1
  90. package/.cache/replit/modules/nix.res +0 -1
  91. package/.cache/replit/modules/nodejs-20.res +0 -1
  92. package/.cache/replit/modules/replit.res +0 -1
  93. package/.cache/replit/modules.stamp +0 -0
  94. package/.cache/replit/nix/env.json +0 -1
  95. package/.cache/typescript/5.6/node_modules/.package-lock.json +0 -171
  96. package/.cache/typescript/5.6/node_modules/@types/bluebird/LICENSE +0 -21
  97. package/.cache/typescript/5.6/node_modules/@types/bluebird/README.md +0 -15
  98. package/.cache/typescript/5.6/node_modules/@types/bluebird/index.d.ts +0 -1365
  99. package/.cache/typescript/5.6/node_modules/@types/bluebird/package.json +0 -25
  100. package/.cache/typescript/5.6/node_modules/@types/caseless/LICENSE +0 -21
  101. package/.cache/typescript/5.6/node_modules/@types/caseless/README.md +0 -48
  102. package/.cache/typescript/5.6/node_modules/@types/caseless/index.d.ts +0 -29
  103. package/.cache/typescript/5.6/node_modules/@types/caseless/package.json +0 -35
  104. package/.cache/typescript/5.6/node_modules/@types/cheerio/LICENSE +0 -21
  105. package/.cache/typescript/5.6/node_modules/@types/cheerio/README.md +0 -15
  106. package/.cache/typescript/5.6/node_modules/@types/cheerio/index.d.ts +0 -318
  107. package/.cache/typescript/5.6/node_modules/@types/cheerio/package.json +0 -71
  108. package/.cache/typescript/5.6/node_modules/@types/mocha/LICENSE +0 -21
  109. package/.cache/typescript/5.6/node_modules/@types/mocha/README.md +0 -15
  110. package/.cache/typescript/5.6/node_modules/@types/mocha/index.d.ts +0 -2929
  111. package/.cache/typescript/5.6/node_modules/@types/mocha/package.json +0 -56
  112. package/.cache/typescript/5.6/node_modules/@types/node/LICENSE +0 -21
  113. package/.cache/typescript/5.6/node_modules/@types/node/README.md +0 -15
  114. package/.cache/typescript/5.6/node_modules/@types/node/assert/strict.d.ts +0 -8
  115. package/.cache/typescript/5.6/node_modules/@types/node/assert.d.ts +0 -1040
  116. package/.cache/typescript/5.6/node_modules/@types/node/async_hooks.d.ts +0 -541
  117. package/.cache/typescript/5.6/node_modules/@types/node/buffer.buffer.d.ts +0 -385
  118. package/.cache/typescript/5.6/node_modules/@types/node/buffer.d.ts +0 -1933
  119. package/.cache/typescript/5.6/node_modules/@types/node/child_process.d.ts +0 -1549
  120. package/.cache/typescript/5.6/node_modules/@types/node/cluster.d.ts +0 -579
  121. package/.cache/typescript/5.6/node_modules/@types/node/compatibility/disposable.d.ts +0 -16
  122. package/.cache/typescript/5.6/node_modules/@types/node/compatibility/index.d.ts +0 -9
  123. package/.cache/typescript/5.6/node_modules/@types/node/compatibility/indexable.d.ts +0 -23
  124. package/.cache/typescript/5.6/node_modules/@types/node/compatibility/iterators.d.ts +0 -21
  125. package/.cache/typescript/5.6/node_modules/@types/node/console.d.ts +0 -452
  126. package/.cache/typescript/5.6/node_modules/@types/node/constants.d.ts +0 -19
  127. package/.cache/typescript/5.6/node_modules/@types/node/crypto.d.ts +0 -4475
  128. package/.cache/typescript/5.6/node_modules/@types/node/dgram.d.ts +0 -596
  129. package/.cache/typescript/5.6/node_modules/@types/node/diagnostics_channel.d.ts +0 -554
  130. package/.cache/typescript/5.6/node_modules/@types/node/dns/promises.d.ts +0 -476
  131. package/.cache/typescript/5.6/node_modules/@types/node/dns.d.ts +0 -865
  132. package/.cache/typescript/5.6/node_modules/@types/node/dom-events.d.ts +0 -124
  133. package/.cache/typescript/5.6/node_modules/@types/node/domain.d.ts +0 -170
  134. package/.cache/typescript/5.6/node_modules/@types/node/events.d.ts +0 -931
  135. package/.cache/typescript/5.6/node_modules/@types/node/fs/promises.d.ts +0 -1275
  136. package/.cache/typescript/5.6/node_modules/@types/node/fs.d.ts +0 -4396
  137. package/.cache/typescript/5.6/node_modules/@types/node/globals.d.ts +0 -566
  138. package/.cache/typescript/5.6/node_modules/@types/node/globals.typedarray.d.ts +0 -21
  139. package/.cache/typescript/5.6/node_modules/@types/node/http.d.ts +0 -1958
  140. package/.cache/typescript/5.6/node_modules/@types/node/http2.d.ts +0 -2558
  141. package/.cache/typescript/5.6/node_modules/@types/node/https.d.ts +0 -543
  142. package/.cache/typescript/5.6/node_modules/@types/node/index.d.ts +0 -92
  143. package/.cache/typescript/5.6/node_modules/@types/node/inspector.d.ts +0 -3966
  144. package/.cache/typescript/5.6/node_modules/@types/node/module.d.ts +0 -402
  145. package/.cache/typescript/5.6/node_modules/@types/node/net.d.ts +0 -1001
  146. package/.cache/typescript/5.6/node_modules/@types/node/os.d.ts +0 -495
  147. package/.cache/typescript/5.6/node_modules/@types/node/package.json +0 -220
  148. package/.cache/typescript/5.6/node_modules/@types/node/path.d.ts +0 -200
  149. package/.cache/typescript/5.6/node_modules/@types/node/perf_hooks.d.ts +0 -965
  150. package/.cache/typescript/5.6/node_modules/@types/node/process.d.ts +0 -1963
  151. package/.cache/typescript/5.6/node_modules/@types/node/punycode.d.ts +0 -117
  152. package/.cache/typescript/5.6/node_modules/@types/node/querystring.d.ts +0 -153
  153. package/.cache/typescript/5.6/node_modules/@types/node/readline/promises.d.ts +0 -162
  154. package/.cache/typescript/5.6/node_modules/@types/node/readline.d.ts +0 -589
  155. package/.cache/typescript/5.6/node_modules/@types/node/repl.d.ts +0 -430
  156. package/.cache/typescript/5.6/node_modules/@types/node/sea.d.ts +0 -153
  157. package/.cache/typescript/5.6/node_modules/@types/node/sqlite.d.ts +0 -213
  158. package/.cache/typescript/5.6/node_modules/@types/node/stream/consumers.d.ts +0 -12
  159. package/.cache/typescript/5.6/node_modules/@types/node/stream/promises.d.ts +0 -90
  160. package/.cache/typescript/5.6/node_modules/@types/node/stream/web.d.ts +0 -609
  161. package/.cache/typescript/5.6/node_modules/@types/node/stream.d.ts +0 -1726
  162. package/.cache/typescript/5.6/node_modules/@types/node/string_decoder.d.ts +0 -67
  163. package/.cache/typescript/5.6/node_modules/@types/node/test.d.ts +0 -2248
  164. package/.cache/typescript/5.6/node_modules/@types/node/timers/promises.d.ts +0 -97
  165. package/.cache/typescript/5.6/node_modules/@types/node/timers.d.ts +0 -240
  166. package/.cache/typescript/5.6/node_modules/@types/node/tls.d.ts +0 -1226
  167. package/.cache/typescript/5.6/node_modules/@types/node/trace_events.d.ts +0 -197
  168. package/.cache/typescript/5.6/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +0 -385
  169. package/.cache/typescript/5.6/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +0 -19
  170. package/.cache/typescript/5.6/node_modules/@types/node/ts5.6/index.d.ts +0 -92
  171. package/.cache/typescript/5.6/node_modules/@types/node/tty.d.ts +0 -208
  172. package/.cache/typescript/5.6/node_modules/@types/node/url.d.ts +0 -972
  173. package/.cache/typescript/5.6/node_modules/@types/node/util.d.ts +0 -2371
  174. package/.cache/typescript/5.6/node_modules/@types/node/v8.d.ts +0 -808
  175. package/.cache/typescript/5.6/node_modules/@types/node/vm.d.ts +0 -976
  176. package/.cache/typescript/5.6/node_modules/@types/node/wasi.d.ts +0 -181
  177. package/.cache/typescript/5.6/node_modules/@types/node/worker_threads.d.ts +0 -745
  178. package/.cache/typescript/5.6/node_modules/@types/node/zlib.d.ts +0 -539
  179. package/.cache/typescript/5.6/node_modules/@types/request/LICENSE +0 -21
  180. package/.cache/typescript/5.6/node_modules/@types/request/README.md +0 -15
  181. package/.cache/typescript/5.6/node_modules/@types/request/index.d.ts +0 -395
  182. package/.cache/typescript/5.6/node_modules/@types/request/package.json +0 -70
  183. package/.cache/typescript/5.6/node_modules/@types/tough-cookie/LICENSE +0 -21
  184. package/.cache/typescript/5.6/node_modules/@types/tough-cookie/README.md +0 -15
  185. package/.cache/typescript/5.6/node_modules/@types/tough-cookie/index.d.ts +0 -321
  186. package/.cache/typescript/5.6/node_modules/@types/tough-cookie/package.json +0 -35
  187. package/.cache/typescript/5.6/node_modules/asynckit/LICENSE +0 -21
  188. package/.cache/typescript/5.6/node_modules/asynckit/README.md +0 -233
  189. package/.cache/typescript/5.6/node_modules/asynckit/bench.js +0 -76
  190. package/.cache/typescript/5.6/node_modules/asynckit/index.js +0 -6
  191. package/.cache/typescript/5.6/node_modules/asynckit/lib/abort.js +0 -29
  192. package/.cache/typescript/5.6/node_modules/asynckit/lib/async.js +0 -34
  193. package/.cache/typescript/5.6/node_modules/asynckit/lib/defer.js +0 -26
  194. package/.cache/typescript/5.6/node_modules/asynckit/lib/iterate.js +0 -75
  195. package/.cache/typescript/5.6/node_modules/asynckit/lib/readable_asynckit.js +0 -91
  196. package/.cache/typescript/5.6/node_modules/asynckit/lib/readable_parallel.js +0 -25
  197. package/.cache/typescript/5.6/node_modules/asynckit/lib/readable_serial.js +0 -25
  198. package/.cache/typescript/5.6/node_modules/asynckit/lib/readable_serial_ordered.js +0 -29
  199. package/.cache/typescript/5.6/node_modules/asynckit/lib/state.js +0 -37
  200. package/.cache/typescript/5.6/node_modules/asynckit/lib/streamify.js +0 -141
  201. package/.cache/typescript/5.6/node_modules/asynckit/lib/terminator.js +0 -29
  202. package/.cache/typescript/5.6/node_modules/asynckit/package.json +0 -63
  203. package/.cache/typescript/5.6/node_modules/asynckit/parallel.js +0 -43
  204. package/.cache/typescript/5.6/node_modules/asynckit/serial.js +0 -17
  205. package/.cache/typescript/5.6/node_modules/asynckit/serialOrdered.js +0 -75
  206. package/.cache/typescript/5.6/node_modules/asynckit/stream.js +0 -21
  207. package/.cache/typescript/5.6/node_modules/combined-stream/License +0 -19
  208. package/.cache/typescript/5.6/node_modules/combined-stream/Readme.md +0 -138
  209. package/.cache/typescript/5.6/node_modules/combined-stream/lib/combined_stream.js +0 -208
  210. package/.cache/typescript/5.6/node_modules/combined-stream/package.json +0 -25
  211. package/.cache/typescript/5.6/node_modules/combined-stream/yarn.lock +0 -17
  212. package/.cache/typescript/5.6/node_modules/delayed-stream/License +0 -19
  213. package/.cache/typescript/5.6/node_modules/delayed-stream/Makefile +0 -7
  214. package/.cache/typescript/5.6/node_modules/delayed-stream/Readme.md +0 -141
  215. package/.cache/typescript/5.6/node_modules/delayed-stream/lib/delayed_stream.js +0 -107
  216. package/.cache/typescript/5.6/node_modules/delayed-stream/package.json +0 -27
  217. package/.cache/typescript/5.6/node_modules/form-data/License +0 -19
  218. package/.cache/typescript/5.6/node_modules/form-data/Readme.md +0 -350
  219. package/.cache/typescript/5.6/node_modules/form-data/index.d.ts +0 -51
  220. package/.cache/typescript/5.6/node_modules/form-data/lib/browser.js +0 -2
  221. package/.cache/typescript/5.6/node_modules/form-data/lib/form_data.js +0 -484
  222. package/.cache/typescript/5.6/node_modules/form-data/lib/populate.js +0 -10
  223. package/.cache/typescript/5.6/node_modules/form-data/package.json +0 -72
  224. package/.cache/typescript/5.6/node_modules/mime-db/HISTORY.md +0 -507
  225. package/.cache/typescript/5.6/node_modules/mime-db/LICENSE +0 -23
  226. package/.cache/typescript/5.6/node_modules/mime-db/README.md +0 -100
  227. package/.cache/typescript/5.6/node_modules/mime-db/db.json +0 -8519
  228. package/.cache/typescript/5.6/node_modules/mime-db/index.js +0 -12
  229. package/.cache/typescript/5.6/node_modules/mime-db/package.json +0 -60
  230. package/.cache/typescript/5.6/node_modules/mime-types/HISTORY.md +0 -397
  231. package/.cache/typescript/5.6/node_modules/mime-types/LICENSE +0 -23
  232. package/.cache/typescript/5.6/node_modules/mime-types/README.md +0 -113
  233. package/.cache/typescript/5.6/node_modules/mime-types/index.js +0 -188
  234. package/.cache/typescript/5.6/node_modules/mime-types/package.json +0 -44
  235. package/.cache/typescript/5.6/node_modules/safe-buffer/LICENSE +0 -21
  236. package/.cache/typescript/5.6/node_modules/safe-buffer/README.md +0 -584
  237. package/.cache/typescript/5.6/node_modules/safe-buffer/index.d.ts +0 -187
  238. package/.cache/typescript/5.6/node_modules/safe-buffer/index.js +0 -65
  239. package/.cache/typescript/5.6/node_modules/safe-buffer/package.json +0 -51
  240. package/.cache/typescript/5.6/node_modules/types-registry/README.md +0 -2
  241. package/.cache/typescript/5.6/node_modules/types-registry/index.json +0 -1
  242. package/.cache/typescript/5.6/node_modules/types-registry/package.json +0 -20
  243. package/.cache/typescript/5.6/node_modules/undici-types/LICENSE +0 -21
  244. package/.cache/typescript/5.6/node_modules/undici-types/README.md +0 -6
  245. package/.cache/typescript/5.6/node_modules/undici-types/agent.d.ts +0 -31
  246. package/.cache/typescript/5.6/node_modules/undici-types/api.d.ts +0 -43
  247. package/.cache/typescript/5.6/node_modules/undici-types/balanced-pool.d.ts +0 -29
  248. package/.cache/typescript/5.6/node_modules/undici-types/cache.d.ts +0 -36
  249. package/.cache/typescript/5.6/node_modules/undici-types/client.d.ts +0 -108
  250. package/.cache/typescript/5.6/node_modules/undici-types/connector.d.ts +0 -34
  251. package/.cache/typescript/5.6/node_modules/undici-types/content-type.d.ts +0 -21
  252. package/.cache/typescript/5.6/node_modules/undici-types/cookies.d.ts +0 -28
  253. package/.cache/typescript/5.6/node_modules/undici-types/diagnostics-channel.d.ts +0 -66
  254. package/.cache/typescript/5.6/node_modules/undici-types/dispatcher.d.ts +0 -255
  255. package/.cache/typescript/5.6/node_modules/undici-types/env-http-proxy-agent.d.ts +0 -21
  256. package/.cache/typescript/5.6/node_modules/undici-types/errors.d.ts +0 -149
  257. package/.cache/typescript/5.6/node_modules/undici-types/eventsource.d.ts +0 -61
  258. package/.cache/typescript/5.6/node_modules/undici-types/fetch.d.ts +0 -209
  259. package/.cache/typescript/5.6/node_modules/undici-types/file.d.ts +0 -39
  260. package/.cache/typescript/5.6/node_modules/undici-types/filereader.d.ts +0 -54
  261. package/.cache/typescript/5.6/node_modules/undici-types/formdata.d.ts +0 -108
  262. package/.cache/typescript/5.6/node_modules/undici-types/global-dispatcher.d.ts +0 -9
  263. package/.cache/typescript/5.6/node_modules/undici-types/global-origin.d.ts +0 -7
  264. package/.cache/typescript/5.6/node_modules/undici-types/handlers.d.ts +0 -15
  265. package/.cache/typescript/5.6/node_modules/undici-types/header.d.ts +0 -4
  266. package/.cache/typescript/5.6/node_modules/undici-types/index.d.ts +0 -71
  267. package/.cache/typescript/5.6/node_modules/undici-types/interceptors.d.ts +0 -17
  268. package/.cache/typescript/5.6/node_modules/undici-types/mock-agent.d.ts +0 -50
  269. package/.cache/typescript/5.6/node_modules/undici-types/mock-client.d.ts +0 -25
  270. package/.cache/typescript/5.6/node_modules/undici-types/mock-errors.d.ts +0 -12
  271. package/.cache/typescript/5.6/node_modules/undici-types/mock-interceptor.d.ts +0 -93
  272. package/.cache/typescript/5.6/node_modules/undici-types/mock-pool.d.ts +0 -25
  273. package/.cache/typescript/5.6/node_modules/undici-types/package.json +0 -55
  274. package/.cache/typescript/5.6/node_modules/undici-types/patch.d.ts +0 -33
  275. package/.cache/typescript/5.6/node_modules/undici-types/pool-stats.d.ts +0 -19
  276. package/.cache/typescript/5.6/node_modules/undici-types/pool.d.ts +0 -39
  277. package/.cache/typescript/5.6/node_modules/undici-types/proxy-agent.d.ts +0 -28
  278. package/.cache/typescript/5.6/node_modules/undici-types/readable.d.ts +0 -60
  279. package/.cache/typescript/5.6/node_modules/undici-types/retry-agent.d.ts +0 -8
  280. package/.cache/typescript/5.6/node_modules/undici-types/retry-handler.d.ts +0 -116
  281. package/.cache/typescript/5.6/node_modules/undici-types/util.d.ts +0 -18
  282. package/.cache/typescript/5.6/node_modules/undici-types/webidl.d.ts +0 -222
  283. package/.cache/typescript/5.6/node_modules/undici-types/websocket.d.ts +0 -150
  284. package/.cache/typescript/5.6/package-lock.json +0 -183
  285. package/.cache/typescript/5.6/package.json +0 -1
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  const utils = require("../utils");
4
- // @NethWs3Dev
4
+ const log = require("npmlog");
5
5
 
6
6
  module.exports = function (defaultFuncs, api, ctx) {
7
7
  function handleUpload(image, callback) {
@@ -36,7 +36,7 @@ module.exports = function (defaultFuncs, api, ctx) {
36
36
  callback(null, resData);
37
37
  })
38
38
  .catch(function (err) {
39
- console.error("handleUpload", err);
39
+ log.error("handleUpload", err);
40
40
  return callback(err);
41
41
  });
42
42
  }
@@ -74,7 +74,7 @@ module.exports = function (defaultFuncs, api, ctx) {
74
74
  const form = {
75
75
  client: "mercury",
76
76
  action_type: "ma-type:log-message",
77
- author: "fbid:" + (ctx.userID),
77
+ author: "fbid:" + (ctx.i_userID || ctx.userID),
78
78
  author_email: "",
79
79
  ephemeral_ttl_mode: "0",
80
80
  is_filtered_content: false,
@@ -125,7 +125,7 @@ module.exports = function (defaultFuncs, api, ctx) {
125
125
  return callback();
126
126
  })
127
127
  .catch(function (err) {
128
- console.error("changeGroupImage", err);
128
+ log.error("changeGroupImage", err);
129
129
  return callback(err);
130
130
  });
131
131
  });
package/src/changeName.js CHANGED
@@ -27,7 +27,7 @@ module.exports = function (defaultFuncs, api, ctx) {
27
27
 
28
28
  var { first_name, middle_name, last_name } = input;
29
29
  if (!first_name || !last_name) {
30
- console.error('changeName', 'name is not be accepted');
30
+ log.error('changeName', 'name is not be accepted');
31
31
  return cb('name is not be accepted');
32
32
  }
33
33
 
@@ -70,7 +70,7 @@ module.exports = function (defaultFuncs, api, ctx) {
70
70
  return cb();
71
71
  })
72
72
  .catch(function (err) {
73
- console.error('changeName', err);
73
+ log.error('changeName', err);
74
74
  return cb(err);
75
75
  });
76
76
 
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  const utils = require("../utils");
4
- // @NethWs3Dev
4
+ const log = require("npmlog");
5
5
 
6
6
  module.exports = function (defaultFuncs, api, ctx) {
7
7
  return function changeNickname(nickname, threadID, participantID, callback) {
@@ -50,7 +50,7 @@ module.exports = function (defaultFuncs, api, ctx) {
50
50
  return callback();
51
51
  })
52
52
  .catch(function (err) {
53
- console.error("changeNickname", err);
53
+ log.error("changeNickname", err);
54
54
  return callback(err);
55
55
  });
56
56
 
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  const utils = require("../utils");
4
- // @NethWs3Dev
4
+ const log = require("npmlog");
5
5
 
6
6
  module.exports = function (defaultFuncs, api, ctx) {
7
7
  return function changeThreadColor(color, threadID, callback) {
@@ -34,7 +34,7 @@ module.exports = function (defaultFuncs, api, ctx) {
34
34
  doc_id: "1727493033983591",
35
35
  query_params: {
36
36
  data: {
37
- actor_id: ctx.userID,
37
+ actor_id: ctx.i_userID || ctx.userID,
38
38
  client_mutation_id: "0",
39
39
  source: "SETTINGS",
40
40
  theme_id: validatedColor,
@@ -56,7 +56,7 @@ module.exports = function (defaultFuncs, api, ctx) {
56
56
  return callback();
57
57
  })
58
58
  .catch(function (err) {
59
- console.error("changeThreadColor", err);
59
+ log.error("changeThreadColor", err);
60
60
  return callback(err);
61
61
  });
62
62
 
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  const utils = require("../utils");
4
- // @NethWs3Dev
4
+ const log = require("npmlog");
5
5
 
6
6
  module.exports = function (defaultFuncs, api, ctx) {
7
7
  return function changeThreadEmoji(emoji, threadID, callback) {
@@ -46,7 +46,7 @@ module.exports = function (defaultFuncs, api, ctx) {
46
46
  return callback();
47
47
  })
48
48
  .catch(function (err) {
49
- console.error("changeThreadEmoji", err);
49
+ log.error("changeThreadEmoji", err);
50
50
  return callback(err);
51
51
  });
52
52
 
@@ -12,13 +12,13 @@ module.exports = function (defaultFuncs, api, ctx) {
12
12
 
13
13
  if (typeof username == 'function') {
14
14
  var error = 'username must be a string, and not ' + utils.getType(username);
15
- console.error('changeUsername', error);
15
+ log.error('changeUsername', error);
16
16
  return username(error);
17
17
  }
18
18
  if (typeof callback == 'function') cb = callback;
19
19
  if (typeof username != 'string') {
20
20
  var error = 'username must be a string, and not ' + utils.getType(username);
21
- console.error('changeUsername', error);
21
+ log.error('changeUsername', error);
22
22
  return cb(error);
23
23
  }
24
24
 
@@ -50,7 +50,7 @@ module.exports = function (defaultFuncs, api, ctx) {
50
50
  return cb();
51
51
  })
52
52
  .catch(function (err) {
53
- console.error('changeUsername', err);
53
+ log.error('changeUsername', err);
54
54
  return cb(err);
55
55
  });
56
56
 
@@ -135,12 +135,12 @@ module.exports = function (defaultFuncs, api, ctx) {
135
135
 
136
136
  if (typeof msg == 'function') {
137
137
  var error = 'Message must be a string or object!!';
138
- console.error('createCommentPost', error);
138
+ log.error('createCommentPost', error);
139
139
  return msg(error);
140
140
  }
141
141
  if (typeof postID == 'function') {
142
142
  var error = 'postID must be a string!!';
143
- console.error('createCommentPost', error);
143
+ log.error('createCommentPost', error);
144
144
  return postID(error);
145
145
  }
146
146
  if (typeof callback == 'string') {
@@ -167,12 +167,12 @@ module.exports = function (defaultFuncs, api, ctx) {
167
167
  msg.body ? typeof msg.body == 'object' ? msg.body = JSON.stringify(msg.body) : null : msg.body = '';
168
168
  } else {
169
169
  var error = 'Message must be a string or object!!';
170
- console.error('createCommentPost', error);
170
+ log.error('createCommentPost', error);
171
171
  return cb(error);
172
172
  }
173
173
  if (typeof postID != 'string') {
174
174
  var error = 'postID must be a string!!';
175
- console.error('createCommentPost', error);
175
+ log.error('createCommentPost', error);
176
176
  return cb(error);
177
177
  }
178
178
 
@@ -221,7 +221,7 @@ module.exports = function (defaultFuncs, api, ctx) {
221
221
  .then(_ => createContent(form))
222
222
  .then(info => cb(null, info))
223
223
  .catch(function (err) {
224
- console.error('createCommentPost', err);
224
+ log.error('createCommentPost', err);
225
225
  return cb(null, err);
226
226
  })
227
227
 
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  const utils = require("../utils");
4
- // @NethWs3Dev
4
+ const log = require("npmlog");
5
5
 
6
6
  module.exports = function (defaultFuncs, api, ctx) {
7
7
  return function createNewGroup(participantIDs, groupTitle, callback) {
@@ -42,18 +42,18 @@ module.exports = function (defaultFuncs, api, ctx) {
42
42
  fbid: participantIDs[n],
43
43
  });
44
44
  }
45
- pids.push({ fbid: ctx.userID });
45
+ pids.push({ fbid: ctx.i_userID || ctx.userID });
46
46
 
47
47
  const form = {
48
48
  fb_api_caller_class: "RelayModern",
49
49
  fb_api_req_friendly_name: "MessengerGroupCreateMutation",
50
- av: ctx.userID,
50
+ av: ctx.i_userID || ctx.userID,
51
51
  //This doc_id is valid as of January 11th, 2020
52
52
  doc_id: "577041672419534",
53
53
  variables: JSON.stringify({
54
54
  input: {
55
55
  entry_point: "jewel_new_group",
56
- actor_id: ctx.userID,
56
+ actor_id: ctx.i_userID || ctx.userID,
57
57
  participants: pids,
58
58
  client_mutation_id: Math.round(Math.random() * 1024).toString(),
59
59
  thread_settings: {
@@ -79,7 +79,7 @@ module.exports = function (defaultFuncs, api, ctx) {
79
79
  );
80
80
  })
81
81
  .catch(function (err) {
82
- console.error("createNewGroup", err);
82
+ log.error("createNewGroup", err);
83
83
  return callback(err);
84
84
  });
85
85
 
package/src/createPoll.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  const utils = require("../utils");
4
- // @NethWs3Dev
4
+ const log = require("npmlog");
5
5
 
6
6
  module.exports = function (defaultFuncs, api, ctx) {
7
7
  return function createPoll(title, threadID, options, callback) {
@@ -62,7 +62,7 @@ module.exports = function (defaultFuncs, api, ctx) {
62
62
  return callback();
63
63
  })
64
64
  .catch(function (err) {
65
- console.error("createPoll", err);
65
+ log.error("createPoll", err);
66
66
  return callback(err);
67
67
  });
68
68
 
package/src/createPost.js CHANGED
@@ -164,7 +164,7 @@ module.exports = function (defaultFuncs, api, ctx) {
164
164
 
165
165
  if (typeof msg == 'function') {
166
166
  var error = 'Msg must be a string or object and not function';
167
- console.error('createPost', error);
167
+ log.error('createPost', error);
168
168
  return msg(error);
169
169
  }
170
170
  if (typeof callback == 'function') cb = callback;
@@ -172,7 +172,7 @@ module.exports = function (defaultFuncs, api, ctx) {
172
172
  var typeMsg = utils.getType(msg);
173
173
  if (!['Object', 'String'].includes(typeMsg)) {
174
174
  var error = 'Msg must be a string or object and not ' + typeMsg;
175
- console.error('createPost', error);
175
+ log.error('createPost', error);
176
176
  return cb(error);
177
177
  } else if (typeMsg == 'String') msg = { body: msg };
178
178
  msg.allowUserID = msg.allowUserID ? !Array.isArray(msg.allowUserID) ? [msg.allowUserID] : msg.allowUserID : null;
@@ -262,12 +262,13 @@ module.exports = function (defaultFuncs, api, ctx) {
262
262
  .then(_ => handleUrl(msg, form))
263
263
  .then(_ => handleMention(msg, form))
264
264
  .then(_ => createContent(form))
265
- .then((res) => {
265
+ .then(function (res) {
266
266
  if (res.error || res.errors) throw res;
267
+
267
268
  return cb(null, (res[0] || res).data.story_create.story.url);
268
269
  })
269
- .catch((err) => {
270
- //console.error('createPost', err);
270
+ .catch(function (err) {
271
+ log.error('createPost', err);
271
272
  return cb(err);
272
273
  });
273
274
 
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  const utils = require("../utils");
4
- // @NethWs3Dev
4
+ const log = require("npmlog");
5
5
 
6
6
  module.exports = function (defaultFuncs, api, ctx) {
7
7
  return function deleteMessage(messageOrMessages, callback) {
@@ -47,7 +47,7 @@ module.exports = function (defaultFuncs, api, ctx) {
47
47
  return callback();
48
48
  })
49
49
  .catch(function (err) {
50
- console.error("deleteMessage", err);
50
+ log.error("deleteMessage", err);
51
51
  return callback(err);
52
52
  });
53
53
 
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  const utils = require("../utils");
4
- // @NethWs3Dev
4
+ const log = require("npmlog");
5
5
 
6
6
  module.exports = function (defaultFuncs, api, ctx) {
7
7
  return function deleteThread(threadOrThreads, callback) {
@@ -47,7 +47,7 @@ module.exports = function (defaultFuncs, api, ctx) {
47
47
  return callback();
48
48
  })
49
49
  .catch(function (err) {
50
- console.error("deleteThread", err);
50
+ log.error("deleteThread", err);
51
51
  return callback(err);
52
52
  });
53
53
 
@@ -1,8 +1,11 @@
1
1
  "use_strict";
2
+ /**
3
+ * @author RFS-ADRENO
4
+ * @rewrittenBy Isai Ivanov
5
+ */
6
+ const generateOfflineThreadingId = require('../utils');
2
7
 
3
- const { generateOfflineThreadingID } = require('../utils');
4
-
5
- function isCallable(func) {
8
+ function canBeCalled(func) {
6
9
  try {
7
10
  Reflect.apply(func, null, []);
8
11
  return true;
@@ -11,49 +14,58 @@ function isCallable(func) {
11
14
  }
12
15
  }
13
16
 
14
- module.exports = function (defaultFuncs, api, ctx) {
17
+ /**
18
+ * A function for editing bot's messages.
19
+ * @param {string} text - The text with which the bot will edit its messages.
20
+ * @param {string} messageID - The message ID of the message the bot will edit.
21
+ * @param {Object} callback - Callback for the function.
22
+ */
15
23
 
24
+ module.exports = function(defaultFuncs, api, ctx) {
16
25
  return function editMessage(text, messageID, callback) {
17
-
18
-
19
26
  if (!ctx.mqttClient) {
20
27
  throw new Error('Not connected to MQTT');
21
28
  }
29
+
30
+ // modified and fix by kenneth panio the edit now works on secondary profile accounts
22
31
 
23
32
  ctx.wsReqNumber ??= 0;
24
33
  ctx.wsTaskNumber ??= 0;
34
+
25
35
  ctx.wsReqNumber += 1;
26
36
  ctx.wsTaskNumber += 1;
27
37
 
28
- const taskPayload = {
38
+ const queryPayload = {
29
39
  message_id: messageID,
30
40
  text: text,
31
41
  };
32
42
 
33
- const task = {
43
+ const query = {
34
44
  failure_count: null,
35
45
  label: '742',
36
- payload: JSON.stringify(taskPayload),
46
+ payload: JSON.stringify(queryPayload),
37
47
  queue_name: 'edit_message',
38
48
  task_id: ctx.wsTaskNumber,
39
49
  };
40
50
 
41
- const content = {
51
+ const context = {
42
52
  app_id: '2220391788200892',
43
53
  payload: {
44
54
  data_trace_id: null,
45
- epoch_id: parseInt(generateOfflineThreadingID()),
46
- tasks: [],
55
+ epoch_id: parseInt(generateOfflineThreadingId),
56
+ tasks: [query],
47
57
  version_id: '6903494529735864',
48
58
  },
49
59
  request_id: ctx.wsReqNumber,
50
60
  type: 3,
51
61
  };
52
62
 
53
- content.payload.tasks.push(task);
54
- content.payload = JSON.stringify(content.payload);
63
+ context.payload = JSON.stringify(context.payload);
55
64
 
56
- /* if (isCallable(callback)) ctx.reqCallbacks[ctx.wsReqNumber] = callback; */
57
- ctx.mqttClient.publish('/ls_req', JSON.stringify(content), { qos: 1, retain: false });
58
- };
59
- }
65
+ if (canBeCalled(callback)) {
66
+ ctx.reqCallbacks[ctx.wsReqNumber] = callback;
67
+ }
68
+
69
+ ctx.mqttClient.publish('/ls_req', JSON.stringify(context), { qos: 1, retain: false });
70
+ }
71
+ }
package/src/follow.js CHANGED
@@ -7,18 +7,18 @@
7
7
  * Example:
8
8
  * api.follow("100090794779367", true); // Set true to follow, false if otherwise.
9
9
  */
10
-
11
- //Fixed by Neth
12
10
 
13
11
  module.exports = function (defaultFuncs, api, ctx) {
14
12
  return function follow(senderID, boolean, callback) {
15
- /*if (!ctx.mqttClient) {
13
+ if (!ctx.mqttClient) {
16
14
  throw new Error("Not connected to MQTT");
17
- }*/
15
+ }
16
+
18
17
  let form;
18
+
19
19
  if (boolean) {
20
20
  form = {
21
- av: ctx.userID,
21
+ av: ctx.userID || ctx.i_userID,
22
22
  fb_api_req_friendly_name: "CometUserFollowMutation",
23
23
  fb_api_caller_class: "RelayModern",
24
24
  doc_id: "25472099855769847",
@@ -30,7 +30,7 @@ module.exports = function (defaultFuncs, api, ctx) {
30
30
  subscribe_location: "PROFILE",
31
31
  subscribee_id: senderID,
32
32
  tracking: null,
33
- actor_id: ctx.userID,
33
+ actor_id: ctx.userID || ctx.i_userID,
34
34
  client_mutation_id: "1",
35
35
  },
36
36
  scale: 1,
@@ -38,7 +38,7 @@ module.exports = function (defaultFuncs, api, ctx) {
38
38
  };
39
39
  } else {
40
40
  form = {
41
- av: ctx.userID,
41
+ av: ctx.userID || ctx.i_userID,
42
42
  fb_api_req_friendly_name: "CometUserUnfollowMutation",
43
43
  fb_api_caller_class: "RelayModern",
44
44
  doc_id: "25472099855769847",
@@ -51,7 +51,7 @@ module.exports = function (defaultFuncs, api, ctx) {
51
51
  subscribe_location: "PROFILE",
52
52
  tracking: null,
53
53
  unsubscribee_id: senderID,
54
- actor_id: ctx.userID,
54
+ actor_id: ctx.userID || ctx.i_userID,
55
55
  client_mutation_id: "10",
56
56
  },
57
57
  scale: 1,
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  const utils = require("../utils");
4
- // @NethWs3Dev
4
+ const log = require("npmlog");
5
5
 
6
6
  module.exports = function (defaultFuncs, api, ctx) {
7
7
  return function forwardAttachment(attachmentID, userOrUsers, callback) {
@@ -51,7 +51,7 @@ module.exports = function (defaultFuncs, api, ctx) {
51
51
  return callback();
52
52
  })
53
53
  .catch(function (err) {
54
- console.error("forwardAttachment", err);
54
+ log.error("forwardAttachment", err);
55
55
  return callback(err);
56
56
  });
57
57
 
package/src/getAccess.js CHANGED
@@ -83,7 +83,7 @@ module.exports = function (defaultFuncs, api, ctx) {
83
83
  return pCb(null, res[1][1]);
84
84
  })
85
85
  .catch(function (err) {
86
- console.error('getAccess', err.error || err);
86
+ log.error('getAccess', err.error || err);
87
87
  return pCb(err);
88
88
  });
89
89
 
@@ -103,7 +103,7 @@ module.exports = function (defaultFuncs, api, ctx) {
103
103
  }
104
104
  })
105
105
  .catch(function (err) {
106
- console.error('getAccess', typeof callback == 'function' ? (err.error || err) : err);
106
+ log.error('getAccess', typeof callback == 'function' ? (err.error || err) : err);
107
107
  return cb(err);
108
108
  });
109
109
 
@@ -60,7 +60,7 @@ module.exports = function (defaultFuncs, api, ctx) {
60
60
  if (!Array.isArray(userIDs)) userIDs = [userIDs];
61
61
  var [height, width] = size;
62
62
  if (!ctx.access_token) {
63
- console.error('getAvatarUser', 'Cant get access_token');
63
+ log.error('getAvatarUser', 'Cant get access_token');
64
64
  return cb('Cant get access_token');
65
65
  };
66
66
 
@@ -69,7 +69,7 @@ module.exports = function (defaultFuncs, api, ctx) {
69
69
  return cb(null, res);
70
70
  })
71
71
  .catch(function (err) {
72
- console.error('getAvatarUser', err);
72
+ log.error('getAvatarUser', err);
73
73
  return cb(err);
74
74
  });
75
75
 
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
 
3
- module.exports = (defaultFuncs, api, ctx) => {
4
- return () => {
5
- return ctx.userID;
3
+ module.exports = function (defaultFuncs, api, ctx) {
4
+ return function getCurrentUserID() {
5
+ return ctx.i_userID || ctx.userID;
6
6
  };
7
- };
7
+ };
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  const utils = require("../utils");
4
- // @NethWs3Dev
4
+ const log = require("npmlog");
5
5
 
6
6
  // [almost] copy pasted from one of FB's minified file (GenderConst)
7
7
  const GENDERS = {
@@ -61,7 +61,7 @@ module.exports = function (defaultFuncs, api, ctx) {
61
61
  "https://www.facebook.com/chat/user_info_all",
62
62
  ctx.jar,
63
63
  {},
64
- { viewer: ctx.userID },
64
+ { viewer: ctx.i_userID || ctx.userID },
65
65
  )
66
66
  .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
67
67
  .then(function (resData) {
@@ -74,7 +74,7 @@ module.exports = function (defaultFuncs, api, ctx) {
74
74
  callback(null, formatData(resData.payload));
75
75
  })
76
76
  .catch(function (err) {
77
- console.error("getFriendsList", err);
77
+ log.error("getFriendsList", err);
78
78
  return callback(err);
79
79
  });
80
80
 
package/src/getMessage.js CHANGED
@@ -6,7 +6,7 @@
6
6
  */
7
7
 
8
8
  const utils = require("../utils");
9
- // @NethWs3Dev
9
+ const log = require("npmlog");
10
10
 
11
11
  function formatMessage(threadID, data) {
12
12
  switch (data.__typename) {
@@ -294,7 +294,7 @@ module.exports = function (defaultFuncs, api, ctx) {
294
294
  }
295
295
  })
296
296
  .catch((err) => {
297
- console.error("getMessage", err);
297
+ log.error("getMessage", err);
298
298
  callback(err);
299
299
  });
300
300
 
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  const utils = require("../utils");
4
- // @NethWs3Dev
4
+ const log = require("npmlog");
5
5
 
6
6
  function getExtension(original_extension, filename = "") {
7
7
  if (original_extension) {
@@ -671,7 +671,7 @@ module.exports = function (defaultFuncs, api, ctx) {
671
671
  callback(null, formatMessagesGraphQLResponse(resData[0]));
672
672
  })
673
673
  .catch(function (err) {
674
- console.error("getThreadHistoryGraphQL", err);
674
+ log.error("getThreadHistoryGraphQL", err);
675
675
  return callback(err);
676
676
  });
677
677
 
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  var utils = require("../utils");
4
- // @NethWs3Dev
4
+ var log = require("npmlog");
5
5
 
6
6
  module.exports = function(defaultFuncs, api, ctx) {
7
7
  return function getThreadHistory(threadID, amount, timestamp, callback) {
@@ -84,7 +84,7 @@ module.exports = function(defaultFuncs, api, ctx) {
84
84
  });
85
85
  })
86
86
  .catch(function(err) {
87
- console.error("getThreadHistory", err);
87
+ log.error("getThreadHistory", err);
88
88
  return callback(err);
89
89
  });
90
90
  });
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  const utils = require("../utils");
4
- // @NethWs3Dev
4
+ const log = require("npmlog");
5
5
 
6
6
  function formatEventReminders(reminder) {
7
7
  return {
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  var utils = require("../utils");
4
- // @NethWs3Dev
4
+ var log = require("npmlog");
5
5
 
6
6
  module.exports = function(defaultFuncs, api, ctx) {
7
7
  return function getThreadInfo(threadID, callback) {
@@ -71,7 +71,7 @@ module.exports = function(defaultFuncs, api, ctx) {
71
71
  callback(null, utils.formatThread(threadData));
72
72
  })
73
73
  .catch(function(err) {
74
- console.error("getThreadInfo", err);
74
+ log.error("getThreadInfo", err);
75
75
  return callback(err);
76
76
  });
77
77
  });
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  const utils = require("../utils");
4
- // @NethWs3Dev
4
+ const log = require("npmlog");
5
5
 
6
6
  function formatEventReminders(reminder) {
7
7
  return {
@@ -213,7 +213,7 @@ module.exports = function (defaultFuncs, api, ctx) {
213
213
  }
214
214
 
215
215
  const form = {
216
- av: ctx.userID,
216
+ av: ctx.i_userID || ctx.userID,
217
217
  queries: JSON.stringify({
218
218
  o0: {
219
219
  // This doc_id was valid on 2020-07-20
@@ -261,7 +261,7 @@ module.exports = function (defaultFuncs, api, ctx) {
261
261
  );
262
262
  })
263
263
  .catch((err) => {
264
- console.error("getThreadList", err);
264
+ log.error("getThreadList", err);
265
265
  return callback(err);
266
266
  });
267
267