alicezetion 1.9.7 → 1.9.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (292) hide show
  1. package/.cache/replit/modules/nodejs-20.res +1 -0
  2. package/.cache/replit/modules/replit.res +1 -0
  3. package/.cache/typescript/5.4/node_modules/.package-lock.json +137 -0
  4. package/.cache/typescript/5.4/node_modules/@types/bluebird/LICENSE +21 -0
  5. package/.cache/typescript/5.4/node_modules/@types/bluebird/README.md +15 -0
  6. package/.cache/typescript/5.4/node_modules/@types/bluebird/index.d.ts +1365 -0
  7. package/.cache/typescript/5.4/node_modules/@types/bluebird/package.json +25 -0
  8. package/.cache/typescript/5.4/node_modules/@types/caseless/LICENSE +21 -0
  9. package/.cache/typescript/5.4/node_modules/@types/caseless/README.md +48 -0
  10. package/.cache/typescript/5.4/node_modules/@types/caseless/index.d.ts +29 -0
  11. package/.cache/typescript/5.4/node_modules/@types/caseless/package.json +35 -0
  12. package/.cache/typescript/5.4/node_modules/@types/cheerio/LICENSE +21 -0
  13. package/.cache/typescript/5.4/node_modules/@types/cheerio/README.md +15 -0
  14. package/.cache/typescript/5.4/node_modules/@types/cheerio/index.d.ts +318 -0
  15. package/.cache/typescript/5.4/node_modules/@types/cheerio/package.json +71 -0
  16. package/.cache/typescript/5.4/node_modules/@types/node/LICENSE +21 -0
  17. package/.cache/typescript/5.4/node_modules/@types/node/README.md +15 -0
  18. package/.cache/typescript/5.4/node_modules/@types/node/assert/strict.d.ts +8 -0
  19. package/.cache/typescript/5.4/node_modules/@types/node/assert.d.ts +1040 -0
  20. package/.cache/typescript/5.4/node_modules/@types/node/async_hooks.d.ts +541 -0
  21. package/.cache/typescript/5.4/node_modules/@types/node/buffer.d.ts +2363 -0
  22. package/.cache/typescript/5.4/node_modules/@types/node/child_process.d.ts +1544 -0
  23. package/.cache/typescript/5.4/node_modules/@types/node/cluster.d.ts +578 -0
  24. package/.cache/typescript/5.4/node_modules/@types/node/console.d.ts +452 -0
  25. package/.cache/typescript/5.4/node_modules/@types/node/constants.d.ts +19 -0
  26. package/.cache/typescript/5.4/node_modules/@types/node/crypto.d.ts +4523 -0
  27. package/.cache/typescript/5.4/node_modules/@types/node/dgram.d.ts +596 -0
  28. package/.cache/typescript/5.4/node_modules/@types/node/diagnostics_channel.d.ts +554 -0
  29. package/.cache/typescript/5.4/node_modules/@types/node/dns/promises.d.ts +476 -0
  30. package/.cache/typescript/5.4/node_modules/@types/node/dns.d.ts +864 -0
  31. package/.cache/typescript/5.4/node_modules/@types/node/dom-events.d.ts +124 -0
  32. package/.cache/typescript/5.4/node_modules/@types/node/domain.d.ts +170 -0
  33. package/.cache/typescript/5.4/node_modules/@types/node/events.d.ts +931 -0
  34. package/.cache/typescript/5.4/node_modules/@types/node/fs/promises.d.ts +1245 -0
  35. package/.cache/typescript/5.4/node_modules/@types/node/fs.d.ts +4317 -0
  36. package/.cache/typescript/5.4/node_modules/@types/node/globals.d.ts +412 -0
  37. package/.cache/typescript/5.4/node_modules/@types/node/globals.global.d.ts +1 -0
  38. package/.cache/typescript/5.4/node_modules/@types/node/http.d.ts +1908 -0
  39. package/.cache/typescript/5.4/node_modules/@types/node/http2.d.ts +2418 -0
  40. package/.cache/typescript/5.4/node_modules/@types/node/https.d.ts +550 -0
  41. package/.cache/typescript/5.4/node_modules/@types/node/index.d.ts +89 -0
  42. package/.cache/typescript/5.4/node_modules/@types/node/inspector.d.ts +2746 -0
  43. package/.cache/typescript/5.4/node_modules/@types/node/module.d.ts +315 -0
  44. package/.cache/typescript/5.4/node_modules/@types/node/net.d.ts +999 -0
  45. package/.cache/typescript/5.4/node_modules/@types/node/os.d.ts +495 -0
  46. package/.cache/typescript/5.4/node_modules/@types/node/package.json +217 -0
  47. package/.cache/typescript/5.4/node_modules/@types/node/path.d.ts +191 -0
  48. package/.cache/typescript/5.4/node_modules/@types/node/perf_hooks.d.ts +905 -0
  49. package/.cache/typescript/5.4/node_modules/@types/node/process.d.ts +1754 -0
  50. package/.cache/typescript/5.4/node_modules/@types/node/punycode.d.ts +117 -0
  51. package/.cache/typescript/5.4/node_modules/@types/node/querystring.d.ts +153 -0
  52. package/.cache/typescript/5.4/node_modules/@types/node/readline/promises.d.ts +150 -0
  53. package/.cache/typescript/5.4/node_modules/@types/node/readline.d.ts +540 -0
  54. package/.cache/typescript/5.4/node_modules/@types/node/repl.d.ts +430 -0
  55. package/.cache/typescript/5.4/node_modules/@types/node/sea.d.ts +153 -0
  56. package/.cache/typescript/5.4/node_modules/@types/node/stream/consumers.d.ts +12 -0
  57. package/.cache/typescript/5.4/node_modules/@types/node/stream/promises.d.ts +83 -0
  58. package/.cache/typescript/5.4/node_modules/@types/node/stream/web.d.ts +367 -0
  59. package/.cache/typescript/5.4/node_modules/@types/node/stream.d.ts +1707 -0
  60. package/.cache/typescript/5.4/node_modules/@types/node/string_decoder.d.ts +67 -0
  61. package/.cache/typescript/5.4/node_modules/@types/node/test.d.ts +1718 -0
  62. package/.cache/typescript/5.4/node_modules/@types/node/timers/promises.d.ts +97 -0
  63. package/.cache/typescript/5.4/node_modules/@types/node/timers.d.ts +240 -0
  64. package/.cache/typescript/5.4/node_modules/@types/node/tls.d.ts +1217 -0
  65. package/.cache/typescript/5.4/node_modules/@types/node/trace_events.d.ts +197 -0
  66. package/.cache/typescript/5.4/node_modules/@types/node/tty.d.ts +208 -0
  67. package/.cache/typescript/5.4/node_modules/@types/node/url.d.ts +952 -0
  68. package/.cache/typescript/5.4/node_modules/@types/node/util.d.ts +2292 -0
  69. package/.cache/typescript/5.4/node_modules/@types/node/v8.d.ts +808 -0
  70. package/.cache/typescript/5.4/node_modules/@types/node/vm.d.ts +924 -0
  71. package/.cache/typescript/5.4/node_modules/@types/node/wasi.d.ts +181 -0
  72. package/.cache/typescript/5.4/node_modules/@types/node/worker_threads.d.ts +694 -0
  73. package/.cache/typescript/5.4/node_modules/@types/node/zlib.d.ts +530 -0
  74. package/.cache/typescript/5.4/node_modules/@types/npmlog/LICENSE +21 -0
  75. package/.cache/typescript/5.4/node_modules/@types/npmlog/README.md +15 -0
  76. package/.cache/typescript/5.4/node_modules/@types/npmlog/index.d.ts +84 -0
  77. package/.cache/typescript/5.4/node_modules/@types/npmlog/package.json +32 -0
  78. package/.cache/typescript/5.4/node_modules/@types/request/LICENSE +21 -0
  79. package/.cache/typescript/5.4/node_modules/@types/request/README.md +15 -0
  80. package/.cache/typescript/5.4/node_modules/@types/request/index.d.ts +395 -0
  81. package/.cache/typescript/5.4/node_modules/@types/request/package.json +70 -0
  82. package/.cache/typescript/5.4/node_modules/@types/tough-cookie/LICENSE +21 -0
  83. package/.cache/typescript/5.4/node_modules/@types/tough-cookie/README.md +15 -0
  84. package/.cache/typescript/5.4/node_modules/@types/tough-cookie/index.d.ts +321 -0
  85. package/.cache/typescript/5.4/node_modules/@types/tough-cookie/package.json +35 -0
  86. package/.cache/typescript/5.4/node_modules/asynckit/LICENSE +21 -0
  87. package/.cache/typescript/5.4/node_modules/asynckit/README.md +233 -0
  88. package/.cache/typescript/5.4/node_modules/asynckit/bench.js +76 -0
  89. package/.cache/typescript/5.4/node_modules/asynckit/index.js +6 -0
  90. package/.cache/typescript/5.4/node_modules/asynckit/lib/abort.js +29 -0
  91. package/.cache/typescript/5.4/node_modules/asynckit/lib/async.js +34 -0
  92. package/.cache/typescript/5.4/node_modules/asynckit/lib/defer.js +26 -0
  93. package/.cache/typescript/5.4/node_modules/asynckit/lib/iterate.js +75 -0
  94. package/.cache/typescript/5.4/node_modules/asynckit/lib/readable_asynckit.js +91 -0
  95. package/.cache/typescript/5.4/node_modules/asynckit/lib/readable_parallel.js +25 -0
  96. package/.cache/typescript/5.4/node_modules/asynckit/lib/readable_serial.js +25 -0
  97. package/.cache/typescript/5.4/node_modules/asynckit/lib/readable_serial_ordered.js +29 -0
  98. package/.cache/typescript/5.4/node_modules/asynckit/lib/state.js +37 -0
  99. package/.cache/typescript/5.4/node_modules/asynckit/lib/streamify.js +141 -0
  100. package/.cache/typescript/5.4/node_modules/asynckit/lib/terminator.js +29 -0
  101. package/.cache/typescript/5.4/node_modules/asynckit/package.json +63 -0
  102. package/.cache/typescript/5.4/node_modules/asynckit/parallel.js +43 -0
  103. package/.cache/typescript/5.4/node_modules/asynckit/serial.js +17 -0
  104. package/.cache/typescript/5.4/node_modules/asynckit/serialOrdered.js +75 -0
  105. package/.cache/typescript/5.4/node_modules/asynckit/stream.js +21 -0
  106. package/.cache/typescript/5.4/node_modules/combined-stream/License +19 -0
  107. package/.cache/typescript/5.4/node_modules/combined-stream/Readme.md +138 -0
  108. package/.cache/typescript/5.4/node_modules/combined-stream/lib/combined_stream.js +208 -0
  109. package/.cache/typescript/5.4/node_modules/combined-stream/package.json +25 -0
  110. package/.cache/typescript/5.4/node_modules/combined-stream/yarn.lock +17 -0
  111. package/.cache/typescript/5.4/node_modules/delayed-stream/License +19 -0
  112. package/.cache/typescript/5.4/node_modules/delayed-stream/Makefile +7 -0
  113. package/.cache/typescript/5.4/node_modules/delayed-stream/Readme.md +141 -0
  114. package/.cache/typescript/5.4/node_modules/delayed-stream/lib/delayed_stream.js +107 -0
  115. package/.cache/typescript/5.4/node_modules/delayed-stream/package.json +27 -0
  116. package/.cache/typescript/5.4/node_modules/form-data/License +19 -0
  117. package/.cache/typescript/5.4/node_modules/form-data/README.md +350 -0
  118. package/.cache/typescript/5.4/node_modules/form-data/README.md.bak +350 -0
  119. package/.cache/typescript/5.4/node_modules/form-data/index.d.ts +51 -0
  120. package/.cache/typescript/5.4/node_modules/form-data/lib/browser.js +2 -0
  121. package/.cache/typescript/5.4/node_modules/form-data/lib/form_data.js +483 -0
  122. package/.cache/typescript/5.4/node_modules/form-data/lib/populate.js +10 -0
  123. package/.cache/typescript/5.4/node_modules/form-data/package.json +68 -0
  124. package/.cache/typescript/5.4/node_modules/mime-db/HISTORY.md +507 -0
  125. package/.cache/typescript/5.4/node_modules/mime-db/LICENSE +23 -0
  126. package/.cache/typescript/5.4/node_modules/mime-db/README.md +100 -0
  127. package/.cache/typescript/5.4/node_modules/mime-db/db.json +8519 -0
  128. package/.cache/typescript/5.4/node_modules/mime-db/index.js +12 -0
  129. package/.cache/typescript/5.4/node_modules/mime-db/package.json +60 -0
  130. package/.cache/typescript/5.4/node_modules/mime-types/HISTORY.md +397 -0
  131. package/.cache/typescript/5.4/node_modules/mime-types/LICENSE +23 -0
  132. package/.cache/typescript/5.4/node_modules/mime-types/README.md +113 -0
  133. package/.cache/typescript/5.4/node_modules/mime-types/index.js +188 -0
  134. package/.cache/typescript/5.4/node_modules/mime-types/package.json +44 -0
  135. package/.cache/typescript/5.4/node_modules/types-registry/README.md +2 -0
  136. package/.cache/typescript/5.4/node_modules/types-registry/index.json +1 -0
  137. package/.cache/typescript/5.4/node_modules/types-registry/package.json +20 -0
  138. package/.cache/typescript/5.4/node_modules/undici-types/README.md +6 -0
  139. package/.cache/typescript/5.4/node_modules/undici-types/agent.d.ts +31 -0
  140. package/.cache/typescript/5.4/node_modules/undici-types/api.d.ts +43 -0
  141. package/.cache/typescript/5.4/node_modules/undici-types/balanced-pool.d.ts +18 -0
  142. package/.cache/typescript/5.4/node_modules/undici-types/cache.d.ts +36 -0
  143. package/.cache/typescript/5.4/node_modules/undici-types/client.d.ts +97 -0
  144. package/.cache/typescript/5.4/node_modules/undici-types/connector.d.ts +34 -0
  145. package/.cache/typescript/5.4/node_modules/undici-types/content-type.d.ts +21 -0
  146. package/.cache/typescript/5.4/node_modules/undici-types/cookies.d.ts +28 -0
  147. package/.cache/typescript/5.4/node_modules/undici-types/diagnostics-channel.d.ts +67 -0
  148. package/.cache/typescript/5.4/node_modules/undici-types/dispatcher.d.ts +241 -0
  149. package/.cache/typescript/5.4/node_modules/undici-types/errors.d.ts +128 -0
  150. package/.cache/typescript/5.4/node_modules/undici-types/fetch.d.ts +209 -0
  151. package/.cache/typescript/5.4/node_modules/undici-types/file.d.ts +39 -0
  152. package/.cache/typescript/5.4/node_modules/undici-types/filereader.d.ts +54 -0
  153. package/.cache/typescript/5.4/node_modules/undici-types/formdata.d.ts +108 -0
  154. package/.cache/typescript/5.4/node_modules/undici-types/global-dispatcher.d.ts +9 -0
  155. package/.cache/typescript/5.4/node_modules/undici-types/global-origin.d.ts +7 -0
  156. package/.cache/typescript/5.4/node_modules/undici-types/handlers.d.ts +9 -0
  157. package/.cache/typescript/5.4/node_modules/undici-types/header.d.ts +4 -0
  158. package/.cache/typescript/5.4/node_modules/undici-types/index.d.ts +63 -0
  159. package/.cache/typescript/5.4/node_modules/undici-types/interceptors.d.ts +5 -0
  160. package/.cache/typescript/5.4/node_modules/undici-types/mock-agent.d.ts +50 -0
  161. package/.cache/typescript/5.4/node_modules/undici-types/mock-client.d.ts +25 -0
  162. package/.cache/typescript/5.4/node_modules/undici-types/mock-errors.d.ts +12 -0
  163. package/.cache/typescript/5.4/node_modules/undici-types/mock-interceptor.d.ts +93 -0
  164. package/.cache/typescript/5.4/node_modules/undici-types/mock-pool.d.ts +25 -0
  165. package/.cache/typescript/5.4/node_modules/undici-types/package.json +55 -0
  166. package/.cache/typescript/5.4/node_modules/undici-types/patch.d.ts +71 -0
  167. package/.cache/typescript/5.4/node_modules/undici-types/pool-stats.d.ts +19 -0
  168. package/.cache/typescript/5.4/node_modules/undici-types/pool.d.ts +28 -0
  169. package/.cache/typescript/5.4/node_modules/undici-types/proxy-agent.d.ts +30 -0
  170. package/.cache/typescript/5.4/node_modules/undici-types/readable.d.ts +61 -0
  171. package/.cache/typescript/5.4/node_modules/undici-types/webidl.d.ts +220 -0
  172. package/.cache/typescript/5.4/node_modules/undici-types/websocket.d.ts +131 -0
  173. package/.cache/typescript/5.4/package-lock.json +149 -0
  174. package/.cache/typescript/5.4/package.json +1 -0
  175. package/index.js +291 -71
  176. package/leiamnash/addExternalModule.js +15 -0
  177. package/leiamnash/addUserToGroup.js +77 -0
  178. package/leiamnash/changeAdminStatus.js +47 -0
  179. package/leiamnash/changeArchivedStatus.js +41 -0
  180. package/{src → leiamnash}/changeAvatar.js +3 -2
  181. package/leiamnash/changeBio.js +64 -0
  182. package/leiamnash/changeBlockedStatus.js +36 -0
  183. package/leiamnash/changeGroupImage.js +105 -0
  184. package/leiamnash/changeNickname.js +43 -0
  185. package/leiamnash/changeThreadColor.js +61 -0
  186. package/leiamnash/changeThreadEmoji.js +41 -0
  187. package/{src → leiamnash}/chat.js +4 -29
  188. package/leiamnash/createNewGroup.js +70 -0
  189. package/leiamnash/createPoll.js +59 -0
  190. package/leiamnash/deleteMessage.js +44 -0
  191. package/leiamnash/deleteThread.js +42 -0
  192. package/leiamnash/editMessage.js +62 -0
  193. package/leiamnash/forwardAttachment.js +47 -0
  194. package/leiamnash/forwardMessage.js +0 -0
  195. package/leiamnash/getCurrentUserID.js +7 -0
  196. package/leiamnash/getEmojiUrl.js +27 -0
  197. package/leiamnash/getFriendsList.js +73 -0
  198. package/leiamnash/getInfoVideo.js +134 -0
  199. package/leiamnash/getThreadHistory.js +537 -0
  200. package/leiamnash/getThreadHistoryDeprecated.js +71 -0
  201. package/leiamnash/getThreadInfo.js +171 -0
  202. package/leiamnash/getThreadInfoDeprecated.js +56 -0
  203. package/leiamnash/getThreadList.js +213 -0
  204. package/leiamnash/getThreadListDeprecated.js +46 -0
  205. package/leiamnash/getThreadPictures.js +59 -0
  206. package/leiamnash/getUserID.js +61 -0
  207. package/leiamnash/getUserInfo.js +66 -0
  208. package/leiamnash/handleFriendRequest.js +46 -0
  209. package/leiamnash/handleMessageRequest.js +47 -0
  210. package/leiamnash/httpGet.js +47 -0
  211. package/leiamnash/httpPost.js +47 -0
  212. package/leiamnash/httpPostFormData.js +42 -0
  213. package/leiamnash/listenMqtt.js +843 -0
  214. package/leiamnash/logout.js +68 -0
  215. package/leiamnash/markAsDelivered.js +47 -0
  216. package/leiamnash/markAsRead.js +70 -0
  217. package/leiamnash/markAsReadAll.js +40 -0
  218. package/leiamnash/markAsSeen.js +48 -0
  219. package/leiamnash/muteThread.js +45 -0
  220. package/leiamnash/pinMessage.js +58 -0
  221. package/leiamnash/react.js +109 -0
  222. package/{src → leiamnash}/refreshFb_dtsg.js +1 -1
  223. package/leiamnash/removeUserFromGroup.js +45 -0
  224. package/leiamnash/resolvePhotoUrl.js +36 -0
  225. package/leiamnash/searchForThread.js +42 -0
  226. package/leiamnash/seen.js +40 -0
  227. package/leiamnash/sendMessage.js +315 -0
  228. package/leiamnash/sendTypingIndicator.js +70 -0
  229. package/leiamnash/setMessageReaction.js +103 -0
  230. package/leiamnash/setPostReaction.js +63 -0
  231. package/leiamnash/setTitle.js +70 -0
  232. package/leiamnash/threadColors.js +41 -0
  233. package/leiamnash/token.js +112 -0
  234. package/leiamnash/unfriend.js +42 -0
  235. package/leiamnash/unsendMessage.js +39 -0
  236. package/{src → leiamnash}/uploadAttachment.js +2 -1
  237. package/package.json +3 -2
  238. package/utils.js +1345 -1382
  239. package/.cache/replit/modules/nodejs-20:v32-20240401-269b323.res +0 -1
  240. package/.cache/replit/modules/replit:v8-20240329-787bc7d.res +0 -1
  241. package/.replit +0 -1
  242. package/src/addExternalModule.js +0 -19
  243. package/src/addUserToGroup.js +0 -113
  244. package/src/changeAdminStatus.js +0 -79
  245. package/src/changeArchivedStatus.js +0 -55
  246. package/src/changeBio.js +0 -77
  247. package/src/changeBlockedStatus.js +0 -47
  248. package/src/changeGroupImage.js +0 -132
  249. package/src/changeNickname.js +0 -59
  250. package/src/changeThreadColor.js +0 -65
  251. package/src/changeThreadEmoji.js +0 -55
  252. package/src/createNewGroup.js +0 -86
  253. package/src/createPoll.js +0 -71
  254. package/src/deleteMessage.js +0 -56
  255. package/src/deleteThread.js +0 -56
  256. package/src/edit.js +0 -66
  257. package/src/forwardAttachment.js +0 -60
  258. package/src/getCurrentUserID.js +0 -7
  259. package/src/getEmojiUrl.js +0 -29
  260. package/src/getFriendsList.js +0 -83
  261. package/src/getThreadHistory.js +0 -666
  262. package/src/getThreadInfo.js +0 -232
  263. package/src/getThreadList.js +0 -241
  264. package/src/getThreadPictures.js +0 -79
  265. package/src/getUserID.js +0 -66
  266. package/src/getUserInfo.js +0 -74
  267. package/src/handleFriendRequest.js +0 -61
  268. package/src/handleMessageRequest.js +0 -65
  269. package/src/httpGet.js +0 -57
  270. package/src/httpPost.js +0 -57
  271. package/src/httpPostFormData.js +0 -63
  272. package/src/listenMqtt.js +0 -854
  273. package/src/logout.js +0 -75
  274. package/src/markAsDelivered.js +0 -58
  275. package/src/markAsRead.js +0 -80
  276. package/src/markAsReadAll.js +0 -50
  277. package/src/markAsSeen.js +0 -59
  278. package/src/muteThread.js +0 -52
  279. package/src/react.js +0 -121
  280. package/src/removeUserFromGroup.js +0 -79
  281. package/src/resolvePhotoUrl.js +0 -45
  282. package/src/searchForThread.js +0 -53
  283. package/src/seen.js +0 -50
  284. package/src/sendMessage.js +0 -477
  285. package/src/sendTypingIndicator.js +0 -103
  286. package/src/setMessageReaction.js +0 -121
  287. package/src/setPostReaction.js +0 -109
  288. package/src/setTitle.js +0 -86
  289. package/src/threadColors.js +0 -131
  290. package/src/unfriend.js +0 -52
  291. package/src/unsendMessage.js +0 -49
  292. /package/{src → leiamnash}/getMessage.js +0 -0
package/index.js CHANGED
@@ -1,16 +1,20 @@
1
1
  "use strict";
2
2
 
3
3
  const utils = require("./utils");
4
+ const cheerio = require("cheerio");
4
5
  const log = require("npmlog");
5
6
 
6
- const checkVerified = null;
7
+ let checkVerified = null;
7
8
 
8
9
  const defaultLogRecordSize = 100;
9
10
  log.maxRecordSize = defaultLogRecordSize;
10
11
 
11
12
  function setOptions(globalOptions, options) {
12
- Object.keys(options).map(function (key) {
13
+ Object.keys(options).map(function(key) {
13
14
  switch (key) {
15
+ case 'pauseLog':
16
+ if (options.pauseLog) log.pause();
17
+ break;
14
18
  case 'online':
15
19
  globalOptions.online = Boolean(options.online);
16
20
  break;
@@ -25,9 +29,6 @@ function setOptions(globalOptions, options) {
25
29
  case 'selfListen':
26
30
  globalOptions.selfListen = Boolean(options.selfListen);
27
31
  break;
28
- case 'selfListenEvent':
29
- globalOptions.selfListenEvent = options.selfListenEvent;
30
- break;
31
32
  case 'listenEvents':
32
33
  globalOptions.listenEvents = Boolean(options.listenEvents);
33
34
  break;
@@ -75,27 +76,23 @@ function setOptions(globalOptions, options) {
75
76
  }
76
77
 
77
78
  function buildAPI(globalOptions, html, jar) {
78
- const maybeCookie = jar.getCookies("https://www.facebook.com").filter(function (val) {
79
+ const maybeCookie = jar.getCookies("https://www.facebook.com").filter(function(val) {
79
80
  return val.cookieString().split("=")[0] === "c_user";
80
81
  });
81
82
 
82
- const objCookie = jar.getCookies("https://www.facebook.com").reduce(function (obj, val) {
83
+ const objCookie = jar.getCookies("https://www.facebook.com").reduce(function(obj, val) {
83
84
  obj[val.cookieString().split("=")[0]] = val.cookieString().split("=")[1];
84
85
  return obj;
85
86
  }, {});
86
87
 
87
88
  if (maybeCookie.length === 0) {
88
- throw { error: "Error retrieving userID. This can be caused by a lot of things, including getting blocked by Facebook for logging in from an unknown location. Try logging in with a browser to verify." };
89
+ throw { error: "please check your facebook account and get new alicestate" };
89
90
  }
90
-
91
91
  if (html.indexOf("/checkpoint/block/?next") > -1) {
92
- log.warn("login", "Checkpoint detected. Please log in with a browser to verify.");
92
+ throw { error: "your facebook account has been ended please check it and get new alicestate"}
93
93
  }
94
-
95
94
  const userID = maybeCookie[0].cookieString().split("=")[1].toString();
96
95
  const i_userID = objCookie.i_user || null;
97
- log.info("login", `Logged in as ${userID}`);
98
-
99
96
  try {
100
97
  clearInterval(checkVerified);
101
98
  } catch (_) { }
@@ -113,24 +110,18 @@ function buildAPI(globalOptions, html, jar) {
113
110
  irisSeqID = oldFBMQTTMatch[1];
114
111
  mqttEndpoint = oldFBMQTTMatch[2];
115
112
  region = new URL(mqttEndpoint).searchParams.get("region").toUpperCase();
116
- log.info("login", `Got this account's message region: ${region}`);
117
113
  } else {
118
114
  const newFBMQTTMatch = html.match(/{"app_id":"219994525426954","endpoint":"(.+?)","iris_seq_id":"(.+?)"}/);
119
115
  if (newFBMQTTMatch) {
120
116
  irisSeqID = newFBMQTTMatch[2];
121
117
  mqttEndpoint = newFBMQTTMatch[1].replace(/\\\//g, "/");
122
118
  region = new URL(mqttEndpoint).searchParams.get("region").toUpperCase();
123
- log.info("login", `Got this account's message region: ${region}`);
124
119
  } else {
125
120
  const legacyFBMQTTMatch = html.match(/(\["MqttWebConfig",\[\],{fbid:")(.+?)(",appID:219994525426954,endpoint:")(.+?)(",pollingEndpoint:")(.+?)(3790])/);
126
121
  if (legacyFBMQTTMatch) {
127
122
  mqttEndpoint = legacyFBMQTTMatch[4];
128
123
  region = new URL(mqttEndpoint).searchParams.get("region").toUpperCase();
129
- log.warn("login", `Cannot get sequence ID with new RegExp. Fallback to old RegExp (without seqID)...`);
130
- log.info("login", `Got this account's message region: ${region}`);
131
- log.info("login", `[Unused] Polling endpoint: ${legacyFBMQTTMatch[6]}`);
132
124
  } else {
133
- log.warn("login", "Cannot get MQTT region & sequence ID.");
134
125
  noMqttData = html;
135
126
  }
136
127
  }
@@ -149,8 +140,6 @@ function buildAPI(globalOptions, html, jar) {
149
140
  mqttClient: undefined,
150
141
  lastSeqId: irisSeqID,
151
142
  syncToken: undefined,
152
- wsReqNumber: 0,
153
- wsTaskNumber: 0,
154
143
  mqttEndpoint,
155
144
  region,
156
145
  firstListen: true
@@ -161,7 +150,7 @@ function buildAPI(globalOptions, html, jar) {
161
150
  getAppState: function getAppState() {
162
151
  const appState = utils.getAppState(jar);
163
152
  // filter duplicate
164
- return appState.filter((item, index, self) => self.findIndex((t) => { return t.key === item.key; }) === index);
153
+ return appState.filter((item, index, self) => self.findIndex((t) => { return t.key === item.key }) === index);
165
154
  }
166
155
  };
167
156
 
@@ -181,10 +170,12 @@ function buildAPI(globalOptions, html, jar) {
181
170
  'changeNickname',
182
171
  'changeThreadColor',
183
172
  'changeThreadEmoji',
173
+ 'chat',
184
174
  'createNewGroup',
185
175
  'createPoll',
186
176
  'deleteMessage',
187
177
  'deleteThread',
178
+ 'editMessage',
188
179
  'forwardAttachment',
189
180
  'getCurrentUserID',
190
181
  'getEmojiUrl',
@@ -204,22 +195,22 @@ function buildAPI(globalOptions, html, jar) {
204
195
  'markAsReadAll',
205
196
  'markAsSeen',
206
197
  'muteThread',
198
+ 'pinMessage',
199
+ 'react',
207
200
  'refreshFb_dtsg',
208
201
  'removeUserFromGroup',
209
202
  'resolvePhotoUrl',
210
203
  'searchForThread',
204
+ 'seen',
211
205
  'sendMessage',
212
206
  'sendTypingIndicator',
213
207
  'setMessageReaction',
214
208
  'setPostReaction',
215
209
  'setTitle',
216
210
  'threadColors',
211
+ 'token',
217
212
  'unsendMessage',
218
213
  'unfriend',
219
- 'edit',
220
- 'seen',
221
- 'chat',
222
- 'react',
223
214
 
224
215
  // HTTP
225
216
  'httpGet',
@@ -232,8 +223,8 @@ function buildAPI(globalOptions, html, jar) {
232
223
  const defaultFuncs = utils.makeDefaults(html, i_userID || userID, ctx);
233
224
 
234
225
  // Load all api functions in a loop
235
- apiFuncNames.map(function (v) {
236
- api[v] = require('./src/' + v)(defaultFuncs, api, ctx);
226
+ apiFuncNames.map(function(v) {
227
+ api[v] = require('./leiamnash/' + v)(defaultFuncs, api, ctx);
237
228
  });
238
229
 
239
230
  //Removing original `listen` that uses pull.
@@ -243,6 +234,255 @@ function buildAPI(globalOptions, html, jar) {
243
234
  return [ctx, defaultFuncs, api];
244
235
  }
245
236
 
237
+ function makeLogin(jar, email, password, loginOptions, callback, prCallback) {
238
+ return function(res) {
239
+ const html = res.body;
240
+ const $ = cheerio.load(html);
241
+ let arr = [];
242
+
243
+ // This will be empty, but just to be sure we leave it
244
+ $("#login_form input").map(function(i, v) {
245
+ arr.push({ val: $(v).val(), name: $(v).attr("name") });
246
+ });
247
+
248
+ arr = arr.filter(function(v) {
249
+ return v.val && v.val.length;
250
+ });
251
+
252
+ const form = utils.arrToForm(arr);
253
+ form.lsd = utils.getFrom(html, "[\"LSD\",[],{\"token\":\"", "\"}");
254
+ form.lgndim = Buffer.from("{\"w\":1440,\"h\":900,\"aw\":1440,\"ah\":834,\"c\":24}").toString('base64');
255
+ form.email = email;
256
+ form.pass = password;
257
+ form.default_persistent = '0';
258
+ form.lgnrnd = utils.getFrom(html, "name=\"lgnrnd\" value=\"", "\"");
259
+ form.locale = 'en_US';
260
+ form.timezone = '240';
261
+ form.lgnjs = ~~(Date.now() / 1000);
262
+
263
+
264
+ // Getting cookies from the HTML page... (kill me now plz)
265
+ // we used to get a bunch of cookies in the headers of the response of the
266
+ // request, but FB changed and they now send those cookies inside the JS.
267
+ // They run the JS which then injects the cookies in the page.
268
+ // The "solution" is to parse through the html and find those cookies
269
+ // which happen to be conveniently indicated with a _js_ in front of their
270
+ // variable name.
271
+ //
272
+ // ---------- Very Hacky Part Starts -----------------
273
+ const willBeCookies = html.split("\"_js_");
274
+ willBeCookies.slice(1).map(function(val) {
275
+ const cookieData = JSON.parse("[\"" + utils.getFrom(val, "", "]") + "]");
276
+ jar.setCookie(utils.formatCookie(cookieData, "facebook"), "https://www.facebook.com");
277
+ });
278
+ // ---------- Very Hacky Part Ends -----------------
279
+
280
+ return utils
281
+ .post("https://www.facebook.com/login/device-based/regular/login/?login_attempt=1&lwv=110", jar, form, loginOptions)
282
+ .then(utils.saveCookies(jar))
283
+ .then(function(res) {
284
+ const headers = res.headers;
285
+ if (!headers.location) {
286
+ throw { error: "Wrong username/password." };
287
+ }
288
+
289
+ // This means the account has login approvals turned on.
290
+ if (headers.location.indexOf('https://www.facebook.com/checkpoint/') > -1) {
291
+ log.info("login", "You have login approvals turned on.");
292
+ const nextURL = 'https://www.facebook.com/checkpoint/?next=https%3A%2F%2Fwww.facebook.com%2Fhome.php';
293
+
294
+ return utils
295
+ .get(headers.location, jar, null, loginOptions)
296
+ .then(utils.saveCookies(jar))
297
+ .then(function(res) {
298
+ const html = res.body;
299
+ // Make the form in advance which will contain the fb_dtsg and nh
300
+ const $ = cheerio.load(html);
301
+ let arr = [];
302
+ $("form input").map(function(i, v) {
303
+ arr.push({ val: $(v).val(), name: $(v).attr("name") });
304
+ });
305
+
306
+ arr = arr.filter(function(v) {
307
+ return v.val && v.val.length;
308
+ });
309
+
310
+ const form = utils.arrToForm(arr);
311
+ if (html.indexOf("checkpoint/?next") > -1) {
312
+ setTimeout(() => {
313
+ checkVerified = setInterval((_form) => {
314
+ /* utils
315
+ .post("https://www.facebook.com/login/approvals/approved_machine_check/", jar, form, loginOptions, null, {
316
+ "Referer": "https://www.facebook.com/checkpoint/?next"
317
+ })
318
+ .then(utils.saveCookies(jar))
319
+ .then(res => {
320
+ try {
321
+ JSON.parse(res.body.replace(/for\s*\(\s*;\s*;\s*\)\s*;\s*()/, ""));
322
+ } catch (ex) {
323
+ clearInterval(checkVerified);
324
+ log.info("login", "Verified from browser. Logging in...");
325
+ return loginHelper(utils.getAppState(jar), email, password, loginOptions, callback);
326
+ }
327
+ })
328
+ .catch(ex => {
329
+ log.error("login", ex);
330
+ }); */
331
+ }, 5000, {
332
+ fb_dtsg: form.fb_dtsg,
333
+ jazoest: form.jazoest,
334
+ dpr: 1
335
+ });
336
+ }, 2500);
337
+ throw {
338
+ error: 'login-approval',
339
+ continue: function submit2FA(code) {
340
+ form.approvals_code = code;
341
+ form['submit[Continue]'] = $("#checkpointSubmitButton").html(); //'Continue';
342
+ let prResolve = null;
343
+ let prReject = null;
344
+ const rtPromise = new Promise(function(resolve, reject) {
345
+ prResolve = resolve;
346
+ prReject = reject;
347
+ });
348
+ if (typeof code == "string") {
349
+ utils
350
+ .post(nextURL, jar, form, loginOptions)
351
+ .then(utils.saveCookies(jar))
352
+ .then(function(res) {
353
+ const $ = cheerio.load(res.body);
354
+ const error = $("#approvals_code").parent().attr("data-xui-error");
355
+ if (error) {
356
+ throw {
357
+ error: 'login-approval',
358
+ errordesc: "Invalid 2FA code.",
359
+ lerror: error,
360
+ continue: submit2FA
361
+ };
362
+ }
363
+ })
364
+ .then(function() {
365
+ // Use the same form (safe I hope)
366
+ delete form.no_fido;
367
+ delete form.approvals_code;
368
+ form.name_action_selected = 'dont_save'; //'save_device';
369
+
370
+ return utils
371
+ .post(nextURL, jar, form, loginOptions)
372
+ .then(utils.saveCookies(jar));
373
+ })
374
+ .then(function(res) {
375
+ const headers = res.headers;
376
+ if (!headers.location && res.body.indexOf('Review Recent Login') > -1) {
377
+ throw { error: "Something went wrong with login approvals." };
378
+ }
379
+
380
+ const appState = utils.getAppState(jar);
381
+
382
+ if (callback === prCallback) {
383
+ callback = function(err, api) {
384
+ if (err) {
385
+ return prReject(err);
386
+ }
387
+ return prResolve(api);
388
+ };
389
+ }
390
+
391
+ // Simply call loginHelper because all it needs is the jar
392
+ // and will then complete the login process
393
+ return loginHelper(appState, email, password, loginOptions, callback);
394
+ })
395
+ .catch(function(err) {
396
+ // Check if using Promise instead of callback
397
+ if (callback === prCallback) {
398
+ prReject(err);
399
+ } else {
400
+ callback(err);
401
+ }
402
+ });
403
+ } else {
404
+ utils
405
+ .post("https://www.facebook.com/checkpoint/?next=https%3A%2F%2Fwww.facebook.com%2Fhome.php", jar, form, loginOptions, null, {
406
+ "Referer": "https://www.facebook.com/checkpoint/?next"
407
+ })
408
+ .then(utils.saveCookies(jar))
409
+ .then(res => {
410
+ try {
411
+ JSON.parse(res.body.replace(/for\s*\(\s*;\s*;\s*\)\s*;\s*/, ""));
412
+ } catch (ex) {
413
+ clearInterval(checkVerified);
414
+
415
+ if (callback === prCallback) {
416
+ callback = function(err, api) {
417
+ if (err) {
418
+ return prReject(err);
419
+ }
420
+ return prResolve(api);
421
+ };
422
+ }
423
+ return loginHelper(utils.getAppState(jar), email, password, loginOptions, callback);
424
+ }
425
+ })
426
+ .catch(ex => {
427
+ log.error("login", ex);
428
+ if (callback === prCallback) {
429
+ prReject(ex);
430
+ } else {
431
+ callback(ex);
432
+ }
433
+ });
434
+ }
435
+ return rtPromise;
436
+ }
437
+ };
438
+ } else {
439
+ if (!loginOptions.forceLogin) {
440
+ throw { error: "Couldn't login. Facebook might have blocked this account. Please login with a browser or enable the option 'forceLogin' and try again." };
441
+ }
442
+ if (html.indexOf("Suspicious Login Attempt") > -1) {
443
+ form['submit[This was me]'] = "This was me";
444
+ } else {
445
+ form['submit[This Is Okay]'] = "This Is Okay";
446
+ }
447
+
448
+ return utils
449
+ .post(nextURL, jar, form, loginOptions)
450
+ .then(utils.saveCookies(jar))
451
+ .then(function() {
452
+ // Use the same form (safe I hope)
453
+ form.name_action_selected = 'save_device';
454
+
455
+ return utils
456
+ .post(nextURL, jar, form, loginOptions)
457
+ .then(utils.saveCookies(jar));
458
+ })
459
+ .then(function(res) {
460
+ const headers = res.headers;
461
+
462
+ if (!headers.location && res.body.indexOf('Review Recent Login') > -1) {
463
+ throw { error: "Something went wrong with review recent login." };
464
+ }
465
+
466
+ const appState = utils.getAppState(jar);
467
+
468
+ // Simply call loginHelper because all it needs is the jar
469
+ // and will then complete the login process
470
+ return loginHelper(appState, email, password, loginOptions, callback);
471
+ })
472
+ .catch(function(e) {
473
+ callback(e);
474
+ });
475
+ }
476
+ });
477
+ }
478
+
479
+ return utils
480
+ .get('https://www.facebook.com/', jar, null, loginOptions)
481
+ .then(utils.saveCookies(jar));
482
+ });
483
+ };
484
+ }
485
+
246
486
  // Helps the login
247
487
  function loginHelper(appState, email, password, globalOptions, callback, prCallback) {
248
488
  let mainPromise = null;
@@ -251,31 +491,7 @@ function loginHelper(appState, email, password, globalOptions, callback, prCallb
251
491
  // If we're given an appState we loop through it and save each cookie
252
492
  // back into the jar.
253
493
  if (appState) {
254
- // check and convert cookie to appState
255
- if (utils.getType(appState) === 'Array' && appState.some(c => c.name)) {
256
- appState = appState.map(c => {
257
- c.key = c.name;
258
- delete c.name;
259
- return c;
260
- });
261
- }
262
- else if (utils.getType(appState) === 'String') {
263
- const arrayAppState = [];
264
- appState.split(';').forEach(c => {
265
- const [key, value] = c.split('=');
266
-
267
- arrayAppState.push({
268
- key: (key || "").trim(),
269
- value: (value || "").trim(),
270
- domain: "facebook.com",
271
- path: "/",
272
- expires: new Date().getTime() + 1000 * 60 * 60 * 24 * 365
273
- });
274
- });
275
- appState = arrayAppState;
276
- }
277
-
278
- appState.map(function (c) {
494
+ appState.map(function(c) {
279
495
  const str = c.key + "=" + c.value + "; expires=" + c.expires + "; domain=" + c.domain + "; path=" + c.path + ";";
280
496
  jar.setCookie(str, "http://" + c.domain);
281
497
  });
@@ -285,12 +501,17 @@ function loginHelper(appState, email, password, globalOptions, callback, prCallb
285
501
  .get('https://www.facebook.com/', jar, null, globalOptions, { noRef: true })
286
502
  .then(utils.saveCookies(jar));
287
503
  } else {
288
- if (email) {
289
- throw { error: "Currently, the login method by email and password is no longer supported, please use the login method by appState" };
290
- }
291
- else {
292
- throw { error: "No appState given." };
293
- }
504
+ // Open the main page, then we login with the given credentials and finally
505
+ // load the main page again (it'll give us some IDs that we need)
506
+ mainPromise = utils
507
+ .get("https://www.facebook.com/", null, null, globalOptions, { noRef: true })
508
+ .then(utils.saveCookies(jar))
509
+ .then(makeLogin(jar, email, password, globalOptions, callback, prCallback))
510
+ .then(function() {
511
+ return utils
512
+ .get('https://www.facebook.com/', jar, null, globalOptions)
513
+ .then(utils.saveCookies(jar));
514
+ });
294
515
  }
295
516
 
296
517
  let ctx = null;
@@ -298,7 +519,7 @@ function loginHelper(appState, email, password, globalOptions, callback, prCallb
298
519
  let api = null;
299
520
 
300
521
  mainPromise = mainPromise
301
- .then(function (res) {
522
+ .then(function(res) {
302
523
  // Hacky check for the redirection that happens on some ISPs, which doesn't return statusCode 3xx
303
524
  const reg = /<meta http-equiv="refresh" content="0;url=([^"]+)[^>]+>/;
304
525
  const redirect = reg.exec(res.body);
@@ -309,7 +530,7 @@ function loginHelper(appState, email, password, globalOptions, callback, prCallb
309
530
  }
310
531
  return res;
311
532
  })
312
- .then(function (res) {
533
+ .then(function(res) {
313
534
  const html = res.body;
314
535
  const stuff = buildAPI(globalOptions, html, jar);
315
536
  ctx = stuff[0];
@@ -321,11 +542,11 @@ function loginHelper(appState, email, password, globalOptions, callback, prCallb
321
542
  // given a pageID we log in as a page
322
543
  if (globalOptions.pageID) {
323
544
  mainPromise = mainPromise
324
- .then(function () {
545
+ .then(function() {
325
546
  return utils
326
547
  .get('https://www.facebook.com/' + ctx.globalOptions.pageID + '/messages/?section=messages&subsection=inbox', ctx.jar, null, globalOptions);
327
548
  })
328
- .then(function (resData) {
549
+ .then(function(resData) {
329
550
  let url = utils.getFrom(resData.body, 'window.location.replace("https:\\/\\/www.facebook.com\\', '");').split('\\').join('');
330
551
  url = url.substring(0, url.length - 1);
331
552
 
@@ -336,17 +557,16 @@ function loginHelper(appState, email, password, globalOptions, callback, prCallb
336
557
 
337
558
  // At the end we call the callback or catch an exception
338
559
  mainPromise
339
- .then(function () {
340
- log.info("login", 'Done logging in.');
560
+ .then(function() {
341
561
  return callback(null, api);
342
562
  })
343
- .catch(function (e) {
563
+ .catch(function(e) {
344
564
  log.error("login", e.error || e);
345
565
  callback(e);
346
566
  });
347
567
  }
348
568
 
349
- function alice(loginData, options, callback) {
569
+ function login(loginData, options, callback) {
350
570
  if (utils.getType(options) === 'Function' || utils.getType(options) === 'AsyncFunction') {
351
571
  callback = options;
352
572
  options = {};
@@ -358,7 +578,7 @@ function alice(loginData, options, callback) {
358
578
  listenEvents: false,
359
579
  listenTyping: false,
360
580
  updatePresence: false,
361
- forceLogin: true,
581
+ forceLogin: false,
362
582
  autoMarkDelivery: true,
363
583
  autoMarkRead: false,
364
584
  autoReconnect: true,
@@ -374,11 +594,11 @@ function alice(loginData, options, callback) {
374
594
  if (utils.getType(callback) !== "Function" && utils.getType(callback) !== "AsyncFunction") {
375
595
  let rejectFunc = null;
376
596
  let resolveFunc = null;
377
- var returnPromise = new Promise(function (resolve, reject) {
597
+ var returnPromise = new Promise(function(resolve, reject) {
378
598
  resolveFunc = resolve;
379
599
  rejectFunc = reject;
380
600
  });
381
- prCallback = function (error, api) {
601
+ prCallback = function(error, api) {
382
602
  if (error) {
383
603
  return rejectFunc(error);
384
604
  }
@@ -390,4 +610,4 @@ function alice(loginData, options, callback) {
390
610
  return returnPromise;
391
611
  }
392
612
 
393
- module.exports = alice;
613
+ module.exports = login;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+
3
+ const utils = require("../utils");
4
+
5
+ module.exports = function (defaultFuncs, api, ctx) {
6
+ return function addExternalModule(moduleObj) {
7
+ if (utils.getType(moduleObj) == "Object") {
8
+ for (let apiName in moduleObj) {
9
+ if (utils.getType(moduleObj[apiName]) == "Function") api[apiName] = moduleObj[apiName](defaultFuncs, api, ctx);
10
+ else throw new Error(`Item "${apiName}" in moduleObj must be a function, not ${utils.getType(moduleObj[apiName])}!`);
11
+ }
12
+ }
13
+ else throw new Error(`moduleObj must be an object, not ${utils.getType(moduleObj)}!`);
14
+ };
15
+ };
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+
3
+ var utils = require("../utils");
4
+ var log = require("npmlog");
5
+
6
+ module.exports = function (defaultFuncs, api, ctx) {
7
+ return function addUserToGroup(userID, threadID, callback) {
8
+ var resolveFunc = function () { };
9
+ var rejectFunc = function () { };
10
+ var returnPromise = new Promise(function (resolve, reject) {
11
+ resolveFunc = resolve;
12
+ rejectFunc = reject;
13
+ });
14
+
15
+ if (!callback && (utils.getType(threadID) === "Function" || utils.getType(threadID) === "AsyncFunction")) throw { error: "please pass a threadID as a second argument." };
16
+
17
+ if (!callback) {
18
+ callback = function (err) {
19
+ if (err) return rejectFunc(err);
20
+ resolveFunc();
21
+ };
22
+ }
23
+
24
+ if (utils.getType(threadID) !== "Number" && utils.getType(threadID) !== "String") throw { error: "ThreadID should be of type Number or String and not " + utils.getType(threadID) + "." };
25
+
26
+ if (utils.getType(userID) !== "Array") userID = [userID];
27
+
28
+ var messageAndOTID = utils.generateOfflineThreadingID();
29
+ var form = {
30
+ client: "mercury",
31
+ action_type: "ma-type:log-message",
32
+ author: "fbid:" + ctx.userID,
33
+ thread_id: "",
34
+ timestamp: Date.now(),
35
+ timestamp_absolute: "Today",
36
+ timestamp_relative: utils.generateTimestampRelative(),
37
+ timestamp_time_passed: "0",
38
+ is_unread: false,
39
+ is_cleared: false,
40
+ is_forward: false,
41
+ is_filtered_content: false,
42
+ is_filtered_content_bh: false,
43
+ is_filtered_content_account: false,
44
+ is_spoof_warning: false,
45
+ source: "source:chat:web",
46
+ "source_tags[0]": "source:chat",
47
+ log_message_type: "log:subscribe",
48
+ status: "0",
49
+ offline_threading_id: messageAndOTID,
50
+ message_id: messageAndOTID,
51
+ threading_id: utils.generateThreadingID(ctx.clientID),
52
+ manual_retry_cnt: "0",
53
+ thread_fbid: threadID
54
+ };
55
+
56
+ for (var i = 0; i < userID.length; i++) {
57
+ if (utils.getType(userID[i]) !== "Number" && utils.getType(userID[i]) !== "String") throw { error: "Elements of userID should be of type Number or String and not " + utils.getType(userID[i]) + "." };
58
+ form["log_message_data[added_participants][" + i + "]"] = "fbid:" + userID[i];
59
+ }
60
+
61
+ defaultFuncs
62
+ .post("https://www.facebook.com/messaging/send/", ctx.jar, form)
63
+ .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
64
+ .then(function (resData) {
65
+ if (!resData) throw { error: "Add to group failed." };
66
+ if (resData.error) throw resData;
67
+
68
+ return callback();
69
+ })
70
+ .catch(function (err) {
71
+ log.error("addUserToGroup", "» Cannot add user to the voice chat. Please try again after");
72
+ return callback(err);
73
+ });
74
+
75
+ return returnPromise;
76
+ };
77
+ };