alicezetion 1.9.6 → 1.9.8
Sign up to get free protection for your applications and to get access to all the features.
- package/.cache/replit/modules/nodejs-20.res +1 -0
- package/.cache/replit/modules/replit.res +1 -0
- package/.cache/typescript/5.4/node_modules/.package-lock.json +137 -0
- package/.cache/typescript/5.4/node_modules/@types/bluebird/LICENSE +21 -0
- package/.cache/typescript/5.4/node_modules/@types/bluebird/README.md +15 -0
- package/.cache/typescript/5.4/node_modules/@types/bluebird/index.d.ts +1365 -0
- package/.cache/typescript/5.4/node_modules/@types/bluebird/package.json +25 -0
- package/.cache/typescript/5.4/node_modules/@types/caseless/LICENSE +21 -0
- package/.cache/typescript/5.4/node_modules/@types/caseless/README.md +48 -0
- package/.cache/typescript/5.4/node_modules/@types/caseless/index.d.ts +29 -0
- package/.cache/typescript/5.4/node_modules/@types/caseless/package.json +35 -0
- package/.cache/typescript/5.4/node_modules/@types/cheerio/LICENSE +21 -0
- package/.cache/typescript/5.4/node_modules/@types/cheerio/README.md +15 -0
- package/.cache/typescript/5.4/node_modules/@types/cheerio/index.d.ts +318 -0
- package/.cache/typescript/5.4/node_modules/@types/cheerio/package.json +71 -0
- package/.cache/typescript/5.4/node_modules/@types/node/LICENSE +21 -0
- package/.cache/typescript/5.4/node_modules/@types/node/README.md +15 -0
- package/.cache/typescript/5.4/node_modules/@types/node/assert/strict.d.ts +8 -0
- package/.cache/typescript/5.4/node_modules/@types/node/assert.d.ts +1040 -0
- package/.cache/typescript/5.4/node_modules/@types/node/async_hooks.d.ts +541 -0
- package/.cache/typescript/5.4/node_modules/@types/node/buffer.d.ts +2363 -0
- package/.cache/typescript/5.4/node_modules/@types/node/child_process.d.ts +1544 -0
- package/.cache/typescript/5.4/node_modules/@types/node/cluster.d.ts +578 -0
- package/.cache/typescript/5.4/node_modules/@types/node/console.d.ts +452 -0
- package/.cache/typescript/5.4/node_modules/@types/node/constants.d.ts +19 -0
- package/.cache/typescript/5.4/node_modules/@types/node/crypto.d.ts +4523 -0
- package/.cache/typescript/5.4/node_modules/@types/node/dgram.d.ts +596 -0
- package/.cache/typescript/5.4/node_modules/@types/node/diagnostics_channel.d.ts +554 -0
- package/.cache/typescript/5.4/node_modules/@types/node/dns/promises.d.ts +476 -0
- package/.cache/typescript/5.4/node_modules/@types/node/dns.d.ts +864 -0
- package/.cache/typescript/5.4/node_modules/@types/node/dom-events.d.ts +124 -0
- package/.cache/typescript/5.4/node_modules/@types/node/domain.d.ts +170 -0
- package/.cache/typescript/5.4/node_modules/@types/node/events.d.ts +931 -0
- package/.cache/typescript/5.4/node_modules/@types/node/fs/promises.d.ts +1245 -0
- package/.cache/typescript/5.4/node_modules/@types/node/fs.d.ts +4317 -0
- package/.cache/typescript/5.4/node_modules/@types/node/globals.d.ts +412 -0
- package/.cache/typescript/5.4/node_modules/@types/node/globals.global.d.ts +1 -0
- package/.cache/typescript/5.4/node_modules/@types/node/http.d.ts +1908 -0
- package/.cache/typescript/5.4/node_modules/@types/node/http2.d.ts +2418 -0
- package/.cache/typescript/5.4/node_modules/@types/node/https.d.ts +550 -0
- package/.cache/typescript/5.4/node_modules/@types/node/index.d.ts +89 -0
- package/.cache/typescript/5.4/node_modules/@types/node/inspector.d.ts +2746 -0
- package/.cache/typescript/5.4/node_modules/@types/node/module.d.ts +315 -0
- package/.cache/typescript/5.4/node_modules/@types/node/net.d.ts +999 -0
- package/.cache/typescript/5.4/node_modules/@types/node/os.d.ts +495 -0
- package/.cache/typescript/5.4/node_modules/@types/node/package.json +217 -0
- package/.cache/typescript/5.4/node_modules/@types/node/path.d.ts +191 -0
- package/.cache/typescript/5.4/node_modules/@types/node/perf_hooks.d.ts +905 -0
- package/.cache/typescript/5.4/node_modules/@types/node/process.d.ts +1754 -0
- package/.cache/typescript/5.4/node_modules/@types/node/punycode.d.ts +117 -0
- package/.cache/typescript/5.4/node_modules/@types/node/querystring.d.ts +153 -0
- package/.cache/typescript/5.4/node_modules/@types/node/readline/promises.d.ts +150 -0
- package/.cache/typescript/5.4/node_modules/@types/node/readline.d.ts +540 -0
- package/.cache/typescript/5.4/node_modules/@types/node/repl.d.ts +430 -0
- package/.cache/typescript/5.4/node_modules/@types/node/sea.d.ts +153 -0
- package/.cache/typescript/5.4/node_modules/@types/node/stream/consumers.d.ts +12 -0
- package/.cache/typescript/5.4/node_modules/@types/node/stream/promises.d.ts +83 -0
- package/.cache/typescript/5.4/node_modules/@types/node/stream/web.d.ts +367 -0
- package/.cache/typescript/5.4/node_modules/@types/node/stream.d.ts +1707 -0
- package/.cache/typescript/5.4/node_modules/@types/node/string_decoder.d.ts +67 -0
- package/.cache/typescript/5.4/node_modules/@types/node/test.d.ts +1718 -0
- package/.cache/typescript/5.4/node_modules/@types/node/timers/promises.d.ts +97 -0
- package/.cache/typescript/5.4/node_modules/@types/node/timers.d.ts +240 -0
- package/.cache/typescript/5.4/node_modules/@types/node/tls.d.ts +1217 -0
- package/.cache/typescript/5.4/node_modules/@types/node/trace_events.d.ts +197 -0
- package/.cache/typescript/5.4/node_modules/@types/node/tty.d.ts +208 -0
- package/.cache/typescript/5.4/node_modules/@types/node/url.d.ts +952 -0
- package/.cache/typescript/5.4/node_modules/@types/node/util.d.ts +2292 -0
- package/.cache/typescript/5.4/node_modules/@types/node/v8.d.ts +808 -0
- package/.cache/typescript/5.4/node_modules/@types/node/vm.d.ts +924 -0
- package/.cache/typescript/5.4/node_modules/@types/node/wasi.d.ts +181 -0
- package/.cache/typescript/5.4/node_modules/@types/node/worker_threads.d.ts +694 -0
- package/.cache/typescript/5.4/node_modules/@types/node/zlib.d.ts +530 -0
- package/.cache/typescript/5.4/node_modules/@types/npmlog/LICENSE +21 -0
- package/.cache/typescript/5.4/node_modules/@types/npmlog/README.md +15 -0
- package/.cache/typescript/5.4/node_modules/@types/npmlog/index.d.ts +84 -0
- package/.cache/typescript/5.4/node_modules/@types/npmlog/package.json +32 -0
- package/.cache/typescript/5.4/node_modules/@types/request/LICENSE +21 -0
- package/.cache/typescript/5.4/node_modules/@types/request/README.md +15 -0
- package/.cache/typescript/5.4/node_modules/@types/request/index.d.ts +395 -0
- package/.cache/typescript/5.4/node_modules/@types/request/package.json +70 -0
- package/.cache/typescript/5.4/node_modules/@types/tough-cookie/LICENSE +21 -0
- package/.cache/typescript/5.4/node_modules/@types/tough-cookie/README.md +15 -0
- package/.cache/typescript/5.4/node_modules/@types/tough-cookie/index.d.ts +321 -0
- package/.cache/typescript/5.4/node_modules/@types/tough-cookie/package.json +35 -0
- package/.cache/typescript/5.4/node_modules/asynckit/LICENSE +21 -0
- package/.cache/typescript/5.4/node_modules/asynckit/README.md +233 -0
- package/.cache/typescript/5.4/node_modules/asynckit/bench.js +76 -0
- package/.cache/typescript/5.4/node_modules/asynckit/index.js +6 -0
- package/.cache/typescript/5.4/node_modules/asynckit/lib/abort.js +29 -0
- package/.cache/typescript/5.4/node_modules/asynckit/lib/async.js +34 -0
- package/.cache/typescript/5.4/node_modules/asynckit/lib/defer.js +26 -0
- package/.cache/typescript/5.4/node_modules/asynckit/lib/iterate.js +75 -0
- package/.cache/typescript/5.4/node_modules/asynckit/lib/readable_asynckit.js +91 -0
- package/.cache/typescript/5.4/node_modules/asynckit/lib/readable_parallel.js +25 -0
- package/.cache/typescript/5.4/node_modules/asynckit/lib/readable_serial.js +25 -0
- package/.cache/typescript/5.4/node_modules/asynckit/lib/readable_serial_ordered.js +29 -0
- package/.cache/typescript/5.4/node_modules/asynckit/lib/state.js +37 -0
- package/.cache/typescript/5.4/node_modules/asynckit/lib/streamify.js +141 -0
- package/.cache/typescript/5.4/node_modules/asynckit/lib/terminator.js +29 -0
- package/.cache/typescript/5.4/node_modules/asynckit/package.json +63 -0
- package/.cache/typescript/5.4/node_modules/asynckit/parallel.js +43 -0
- package/.cache/typescript/5.4/node_modules/asynckit/serial.js +17 -0
- package/.cache/typescript/5.4/node_modules/asynckit/serialOrdered.js +75 -0
- package/.cache/typescript/5.4/node_modules/asynckit/stream.js +21 -0
- package/.cache/typescript/5.4/node_modules/combined-stream/License +19 -0
- package/.cache/typescript/5.4/node_modules/combined-stream/Readme.md +138 -0
- package/.cache/typescript/5.4/node_modules/combined-stream/lib/combined_stream.js +208 -0
- package/.cache/typescript/5.4/node_modules/combined-stream/package.json +25 -0
- package/.cache/typescript/5.4/node_modules/combined-stream/yarn.lock +17 -0
- package/.cache/typescript/5.4/node_modules/delayed-stream/License +19 -0
- package/.cache/typescript/5.4/node_modules/delayed-stream/Makefile +7 -0
- package/.cache/typescript/5.4/node_modules/delayed-stream/Readme.md +141 -0
- package/.cache/typescript/5.4/node_modules/delayed-stream/lib/delayed_stream.js +107 -0
- package/.cache/typescript/5.4/node_modules/delayed-stream/package.json +27 -0
- package/.cache/typescript/5.4/node_modules/form-data/License +19 -0
- package/.cache/typescript/5.4/node_modules/form-data/README.md +350 -0
- package/.cache/typescript/5.4/node_modules/form-data/README.md.bak +350 -0
- package/.cache/typescript/5.4/node_modules/form-data/index.d.ts +51 -0
- package/.cache/typescript/5.4/node_modules/form-data/lib/browser.js +2 -0
- package/.cache/typescript/5.4/node_modules/form-data/lib/form_data.js +483 -0
- package/.cache/typescript/5.4/node_modules/form-data/lib/populate.js +10 -0
- package/.cache/typescript/5.4/node_modules/form-data/package.json +68 -0
- package/.cache/typescript/5.4/node_modules/mime-db/HISTORY.md +507 -0
- package/.cache/typescript/5.4/node_modules/mime-db/LICENSE +23 -0
- package/.cache/typescript/5.4/node_modules/mime-db/README.md +100 -0
- package/.cache/typescript/5.4/node_modules/mime-db/db.json +8519 -0
- package/.cache/typescript/5.4/node_modules/mime-db/index.js +12 -0
- package/.cache/typescript/5.4/node_modules/mime-db/package.json +60 -0
- package/.cache/typescript/5.4/node_modules/mime-types/HISTORY.md +397 -0
- package/.cache/typescript/5.4/node_modules/mime-types/LICENSE +23 -0
- package/.cache/typescript/5.4/node_modules/mime-types/README.md +113 -0
- package/.cache/typescript/5.4/node_modules/mime-types/index.js +188 -0
- package/.cache/typescript/5.4/node_modules/mime-types/package.json +44 -0
- package/.cache/typescript/5.4/node_modules/types-registry/README.md +2 -0
- package/.cache/typescript/5.4/node_modules/types-registry/index.json +1 -0
- package/.cache/typescript/5.4/node_modules/types-registry/package.json +20 -0
- package/.cache/typescript/5.4/node_modules/undici-types/README.md +6 -0
- package/.cache/typescript/5.4/node_modules/undici-types/agent.d.ts +31 -0
- package/.cache/typescript/5.4/node_modules/undici-types/api.d.ts +43 -0
- package/.cache/typescript/5.4/node_modules/undici-types/balanced-pool.d.ts +18 -0
- package/.cache/typescript/5.4/node_modules/undici-types/cache.d.ts +36 -0
- package/.cache/typescript/5.4/node_modules/undici-types/client.d.ts +97 -0
- package/.cache/typescript/5.4/node_modules/undici-types/connector.d.ts +34 -0
- package/.cache/typescript/5.4/node_modules/undici-types/content-type.d.ts +21 -0
- package/.cache/typescript/5.4/node_modules/undici-types/cookies.d.ts +28 -0
- package/.cache/typescript/5.4/node_modules/undici-types/diagnostics-channel.d.ts +67 -0
- package/.cache/typescript/5.4/node_modules/undici-types/dispatcher.d.ts +241 -0
- package/.cache/typescript/5.4/node_modules/undici-types/errors.d.ts +128 -0
- package/.cache/typescript/5.4/node_modules/undici-types/fetch.d.ts +209 -0
- package/.cache/typescript/5.4/node_modules/undici-types/file.d.ts +39 -0
- package/.cache/typescript/5.4/node_modules/undici-types/filereader.d.ts +54 -0
- package/.cache/typescript/5.4/node_modules/undici-types/formdata.d.ts +108 -0
- package/.cache/typescript/5.4/node_modules/undici-types/global-dispatcher.d.ts +9 -0
- package/.cache/typescript/5.4/node_modules/undici-types/global-origin.d.ts +7 -0
- package/.cache/typescript/5.4/node_modules/undici-types/handlers.d.ts +9 -0
- package/.cache/typescript/5.4/node_modules/undici-types/header.d.ts +4 -0
- package/.cache/typescript/5.4/node_modules/undici-types/index.d.ts +63 -0
- package/.cache/typescript/5.4/node_modules/undici-types/interceptors.d.ts +5 -0
- package/.cache/typescript/5.4/node_modules/undici-types/mock-agent.d.ts +50 -0
- package/.cache/typescript/5.4/node_modules/undici-types/mock-client.d.ts +25 -0
- package/.cache/typescript/5.4/node_modules/undici-types/mock-errors.d.ts +12 -0
- package/.cache/typescript/5.4/node_modules/undici-types/mock-interceptor.d.ts +93 -0
- package/.cache/typescript/5.4/node_modules/undici-types/mock-pool.d.ts +25 -0
- package/.cache/typescript/5.4/node_modules/undici-types/package.json +55 -0
- package/.cache/typescript/5.4/node_modules/undici-types/patch.d.ts +71 -0
- package/.cache/typescript/5.4/node_modules/undici-types/pool-stats.d.ts +19 -0
- package/.cache/typescript/5.4/node_modules/undici-types/pool.d.ts +28 -0
- package/.cache/typescript/5.4/node_modules/undici-types/proxy-agent.d.ts +30 -0
- package/.cache/typescript/5.4/node_modules/undici-types/readable.d.ts +61 -0
- package/.cache/typescript/5.4/node_modules/undici-types/webidl.d.ts +220 -0
- package/.cache/typescript/5.4/node_modules/undici-types/websocket.d.ts +131 -0
- package/.cache/typescript/5.4/package-lock.json +149 -0
- package/.cache/typescript/5.4/package.json +1 -0
- package/index.js +290 -70
- package/leiamnash/addExternalModule.js +15 -0
- package/leiamnash/addUserToGroup.js +77 -0
- package/leiamnash/changeAdminStatus.js +47 -0
- package/leiamnash/changeArchivedStatus.js +41 -0
- package/{src → leiamnash}/changeAvatar.js +3 -2
- package/leiamnash/changeBio.js +64 -0
- package/leiamnash/changeBlockedStatus.js +36 -0
- package/leiamnash/changeGroupImage.js +105 -0
- package/leiamnash/changeNickname.js +43 -0
- package/leiamnash/changeThreadColor.js +61 -0
- package/leiamnash/changeThreadEmoji.js +41 -0
- package/{src → leiamnash}/chat.js +4 -29
- package/leiamnash/createNewGroup.js +70 -0
- package/leiamnash/createPoll.js +59 -0
- package/leiamnash/deleteMessage.js +44 -0
- package/leiamnash/deleteThread.js +42 -0
- package/leiamnash/editMessage.js +62 -0
- package/leiamnash/forwardAttachment.js +47 -0
- package/leiamnash/forwardMessage.js +0 -0
- package/leiamnash/getCurrentUserID.js +7 -0
- package/leiamnash/getEmojiUrl.js +27 -0
- package/leiamnash/getFriendsList.js +73 -0
- package/leiamnash/getInfoVideo.js +134 -0
- package/leiamnash/getThreadHistory.js +537 -0
- package/leiamnash/getThreadHistoryDeprecated.js +71 -0
- package/leiamnash/getThreadInfo.js +171 -0
- package/leiamnash/getThreadInfoDeprecated.js +56 -0
- package/leiamnash/getThreadList.js +213 -0
- package/leiamnash/getThreadListDeprecated.js +46 -0
- package/leiamnash/getThreadPictures.js +59 -0
- package/leiamnash/getUserID.js +61 -0
- package/leiamnash/getUserInfo.js +66 -0
- package/leiamnash/handleFriendRequest.js +46 -0
- package/leiamnash/handleMessageRequest.js +47 -0
- package/leiamnash/httpGet.js +47 -0
- package/leiamnash/httpPost.js +47 -0
- package/leiamnash/httpPostFormData.js +42 -0
- package/leiamnash/listenMqtt.js +843 -0
- package/leiamnash/logout.js +68 -0
- package/leiamnash/markAsDelivered.js +47 -0
- package/leiamnash/markAsRead.js +70 -0
- package/leiamnash/markAsReadAll.js +40 -0
- package/leiamnash/markAsSeen.js +48 -0
- package/leiamnash/muteThread.js +45 -0
- package/leiamnash/pinMessage.js +58 -0
- package/leiamnash/react.js +109 -0
- package/{src → leiamnash}/refreshFb_dtsg.js +1 -1
- package/leiamnash/removeUserFromGroup.js +45 -0
- package/leiamnash/resolvePhotoUrl.js +36 -0
- package/leiamnash/searchForThread.js +42 -0
- package/leiamnash/seen.js +40 -0
- package/leiamnash/sendMessage.js +315 -0
- package/leiamnash/sendTypingIndicator.js +70 -0
- package/leiamnash/setMessageReaction.js +103 -0
- package/leiamnash/setPostReaction.js +63 -0
- package/leiamnash/setTitle.js +70 -0
- package/leiamnash/threadColors.js +41 -0
- package/leiamnash/token.js +112 -0
- package/leiamnash/unfriend.js +42 -0
- package/leiamnash/unsendMessage.js +39 -0
- package/{src → leiamnash}/uploadAttachment.js +2 -1
- package/package.json +3 -2
- package/utils.js +1345 -1382
- package/.cache/replit/modules/nodejs-20:v28-20240213-3f08513.res +0 -1
- package/.cache/replit/modules/replit:v5-20240209-9e3a339.res +0 -1
- package/.replit +0 -1
- package/src/addExternalModule.js +0 -19
- package/src/addUserToGroup.js +0 -113
- package/src/changeAdminStatus.js +0 -79
- package/src/changeArchivedStatus.js +0 -55
- package/src/changeBio.js +0 -77
- package/src/changeBlockedStatus.js +0 -47
- package/src/changeGroupImage.js +0 -132
- package/src/changeNickname.js +0 -59
- package/src/changeThreadColor.js +0 -65
- package/src/changeThreadEmoji.js +0 -55
- package/src/createNewGroup.js +0 -86
- package/src/createPoll.js +0 -71
- package/src/deleteMessage.js +0 -56
- package/src/deleteThread.js +0 -56
- package/src/edit.js +0 -66
- package/src/forwardAttachment.js +0 -60
- package/src/getCurrentUserID.js +0 -7
- package/src/getEmojiUrl.js +0 -29
- package/src/getFriendsList.js +0 -83
- package/src/getThreadHistory.js +0 -666
- package/src/getThreadInfo.js +0 -232
- package/src/getThreadList.js +0 -241
- package/src/getThreadPictures.js +0 -79
- package/src/getUserID.js +0 -66
- package/src/getUserInfo.js +0 -74
- package/src/handleFriendRequest.js +0 -61
- package/src/handleMessageRequest.js +0 -65
- package/src/httpGet.js +0 -57
- package/src/httpPost.js +0 -57
- package/src/httpPostFormData.js +0 -63
- package/src/listenMqtt.js +0 -854
- package/src/logout.js +0 -75
- package/src/markAsDelivered.js +0 -58
- package/src/markAsRead.js +0 -80
- package/src/markAsReadAll.js +0 -50
- package/src/markAsSeen.js +0 -59
- package/src/muteThread.js +0 -52
- package/src/react.js +0 -121
- package/src/removeUserFromGroup.js +0 -79
- package/src/resolvePhotoUrl.js +0 -45
- package/src/searchForThread.js +0 -53
- package/src/seen.js +0 -50
- package/src/sendMessage.js +0 -477
- package/src/sendTypingIndicator.js +0 -103
- package/src/setMessageReaction.js +0 -121
- package/src/setPostReaction.js +0 -109
- package/src/setTitle.js +0 -86
- package/src/threadColors.js +0 -131
- package/src/unfriend.js +0 -52
- package/src/unsendMessage.js +0 -49
- /package/{src → leiamnash}/getMessage.js +0 -0
@@ -1 +0,0 @@
|
|
1
|
-
{"type":"resolve","resolvedModuleId":"nodejs-20:v28-20240213-3f08513","inputHash":"","resolutionPath":["nodejs-20:v8-20230920-bd784b9","nodejs-20:v9-20231020-a3526c9","nodejs-20:v10-20231103-2b03dda","nodejs-20:v11-20231122-8e4093b","nodejs-20:v12-20231130-57acee0","nodejs-20:v13-20231201-3b22c78","nodejs-20:v14-20231206-9a12353","nodejs-20:v15-20231206-d8b5d0b","nodejs-20:v16-20231207-cf9ab20","nodejs-20:v17-20231207-25d440f","nodejs-20:v18-20231211-ac14ad7","nodejs-20:v19-20231216-fb57c71","nodejs-20:v20-20231219-faac932","nodejs-20:v21-20240102-fd07a42","nodejs-20:v22-20240103-2da4911","nodejs-20:v23-20240116-9f73277","nodejs-20:v24-20240117-0bd73cd","nodejs-20:v25-20240206-fdbd396","nodejs-20:v26-20240209-9e3a339","nodejs-20:v27-20240213-5e75727","nodejs-20:v28-20240213-3f08513"],"error":"","Changed":true}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"type":"resolve","resolvedModuleId":"replit:v5-20240209-9e3a339","inputHash":"","resolutionPath":["replit","replit:v1-20231211-d5ddcff","replit:v2-20240117-0bd73cd","replit:v3-20240123-c72e35a","replit:v4-20240206-fdbd396","replit:v5-20240209-9e3a339"],"error":"","Changed":true}
|
package/.replit
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
modules = ["nodejs-20:v8-20230920-bd784b9"]
|
package/src/addExternalModule.js
DELETED
@@ -1,19 +0,0 @@
|
|
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 (const apiName in moduleObj) {
|
9
|
-
if (utils.getType(moduleObj[apiName]) == "Function") {
|
10
|
-
api[apiName] = moduleObj[apiName](defaultFuncs, api, ctx);
|
11
|
-
} else {
|
12
|
-
throw new Error(`Item "${apiName}" in moduleObj must be a function, not ${utils.getType(moduleObj[apiName])}!`);
|
13
|
-
}
|
14
|
-
}
|
15
|
-
} else {
|
16
|
-
throw new Error(`moduleObj must be an object, not ${utils.getType(moduleObj)}!`);
|
17
|
-
}
|
18
|
-
};
|
19
|
-
};
|
package/src/addUserToGroup.js
DELETED
@@ -1,113 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
const utils = require("../utils");
|
4
|
-
const log = require("npmlog");
|
5
|
-
|
6
|
-
module.exports = function (defaultFuncs, api, ctx) {
|
7
|
-
return function addUserToGroup(userID, threadID, callback) {
|
8
|
-
let resolveFunc = function () { };
|
9
|
-
let rejectFunc = function () { };
|
10
|
-
const returnPromise = new Promise(function (resolve, reject) {
|
11
|
-
resolveFunc = resolve;
|
12
|
-
rejectFunc = reject;
|
13
|
-
});
|
14
|
-
|
15
|
-
if (
|
16
|
-
!callback &&
|
17
|
-
(utils.getType(threadID) === "Function" ||
|
18
|
-
utils.getType(threadID) === "AsyncFunction")
|
19
|
-
) {
|
20
|
-
throw new utils.CustomError({ error: "please pass a threadID as a second argument." });
|
21
|
-
}
|
22
|
-
|
23
|
-
if (!callback) {
|
24
|
-
callback = function (err) {
|
25
|
-
if (err) {
|
26
|
-
return rejectFunc(err);
|
27
|
-
}
|
28
|
-
resolveFunc();
|
29
|
-
};
|
30
|
-
}
|
31
|
-
|
32
|
-
if (
|
33
|
-
utils.getType(threadID) !== "Number" &&
|
34
|
-
utils.getType(threadID) !== "String"
|
35
|
-
) {
|
36
|
-
throw new utils.CustomError({
|
37
|
-
error:
|
38
|
-
"ThreadID should be of type Number or String and not " +
|
39
|
-
utils.getType(threadID) +
|
40
|
-
"."
|
41
|
-
});
|
42
|
-
}
|
43
|
-
|
44
|
-
if (utils.getType(userID) !== "Array") {
|
45
|
-
userID = [userID];
|
46
|
-
}
|
47
|
-
|
48
|
-
const messageAndOTID = utils.generateOfflineThreadingID();
|
49
|
-
const form = {
|
50
|
-
client: "mercury",
|
51
|
-
action_type: "ma-type:log-message",
|
52
|
-
author: "fbid:" + (ctx.i_userID || ctx.userID),
|
53
|
-
thread_id: "",
|
54
|
-
timestamp: Date.now(),
|
55
|
-
timestamp_absolute: "Today",
|
56
|
-
timestamp_relative: utils.generateTimestampRelative(),
|
57
|
-
timestamp_time_passed: "0",
|
58
|
-
is_unread: false,
|
59
|
-
is_cleared: false,
|
60
|
-
is_forward: false,
|
61
|
-
is_filtered_content: false,
|
62
|
-
is_filtered_content_bh: false,
|
63
|
-
is_filtered_content_account: false,
|
64
|
-
is_spoof_warning: false,
|
65
|
-
source: "source:chat:web",
|
66
|
-
"source_tags[0]": "source:chat",
|
67
|
-
log_message_type: "log:subscribe",
|
68
|
-
status: "0",
|
69
|
-
offline_threading_id: messageAndOTID,
|
70
|
-
message_id: messageAndOTID,
|
71
|
-
threading_id: utils.generateThreadingID(ctx.clientID),
|
72
|
-
manual_retry_cnt: "0",
|
73
|
-
thread_fbid: threadID
|
74
|
-
};
|
75
|
-
|
76
|
-
for (let i = 0; i < userID.length; i++) {
|
77
|
-
if (
|
78
|
-
utils.getType(userID[i]) !== "Number" &&
|
79
|
-
utils.getType(userID[i]) !== "String"
|
80
|
-
) {
|
81
|
-
throw new utils.CustomError({
|
82
|
-
error:
|
83
|
-
"Elements of userID should be of type Number or String and not " +
|
84
|
-
utils.getType(userID[i]) +
|
85
|
-
"."
|
86
|
-
});
|
87
|
-
}
|
88
|
-
|
89
|
-
form["log_message_data[added_participants][" + i + "]"] =
|
90
|
-
"fbid:" + userID[i];
|
91
|
-
}
|
92
|
-
|
93
|
-
defaultFuncs
|
94
|
-
.post("https://www.facebook.com/messaging/send/", ctx.jar, form)
|
95
|
-
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
96
|
-
.then(function (resData) {
|
97
|
-
if (!resData) {
|
98
|
-
throw new utils.CustomError({ error: "Add to group failed." });
|
99
|
-
}
|
100
|
-
if (resData.error) {
|
101
|
-
throw new utils.CustomError(resData);
|
102
|
-
}
|
103
|
-
|
104
|
-
return callback();
|
105
|
-
})
|
106
|
-
.catch(function (err) {
|
107
|
-
log.error("addUserToGroup", err);
|
108
|
-
return callback(err);
|
109
|
-
});
|
110
|
-
|
111
|
-
return returnPromise;
|
112
|
-
};
|
113
|
-
};
|
package/src/changeAdminStatus.js
DELETED
@@ -1,79 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
const utils = require("../utils");
|
4
|
-
const log = require("npmlog");
|
5
|
-
|
6
|
-
module.exports = function (defaultFuncs, api, ctx) {
|
7
|
-
return function changeAdminStatus(threadID, adminIDs, adminStatus, callback) {
|
8
|
-
if (utils.getType(threadID) !== "String") {
|
9
|
-
throw new utils.CustomError({ error: "changeAdminStatus: threadID must be a string" });
|
10
|
-
}
|
11
|
-
|
12
|
-
if (utils.getType(adminIDs) === "String") {
|
13
|
-
adminIDs = [adminIDs];
|
14
|
-
}
|
15
|
-
|
16
|
-
if (utils.getType(adminIDs) !== "Array") {
|
17
|
-
throw new utils.CustomError({ error: "changeAdminStatus: adminIDs must be an array or string" });
|
18
|
-
}
|
19
|
-
|
20
|
-
if (utils.getType(adminStatus) !== "Boolean") {
|
21
|
-
throw new utils.CustomError({ error: "changeAdminStatus: adminStatus must be a string" });
|
22
|
-
}
|
23
|
-
|
24
|
-
let resolveFunc = function () { };
|
25
|
-
let rejectFunc = function () { };
|
26
|
-
const returnPromise = new Promise(function (resolve, reject) {
|
27
|
-
resolveFunc = resolve;
|
28
|
-
rejectFunc = reject;
|
29
|
-
});
|
30
|
-
|
31
|
-
if (!callback) {
|
32
|
-
callback = function (err) {
|
33
|
-
if (err) {
|
34
|
-
return rejectFunc(err);
|
35
|
-
}
|
36
|
-
resolveFunc();
|
37
|
-
};
|
38
|
-
}
|
39
|
-
|
40
|
-
if (utils.getType(callback) !== "Function" && utils.getType(callback) !== "AsyncFunction") {
|
41
|
-
throw new utils.CustomError({ error: "changeAdminStatus: callback is not a function" });
|
42
|
-
}
|
43
|
-
|
44
|
-
const form = {
|
45
|
-
"thread_fbid": threadID
|
46
|
-
};
|
47
|
-
|
48
|
-
let i = 0;
|
49
|
-
for (const u of adminIDs) {
|
50
|
-
form[`admin_ids[${i++}]`] = u;
|
51
|
-
}
|
52
|
-
form["add"] = adminStatus;
|
53
|
-
|
54
|
-
defaultFuncs
|
55
|
-
.post("https://www.facebook.com/messaging/save_admins/?dpr=1", ctx.jar, form)
|
56
|
-
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
57
|
-
.then(function (resData) {
|
58
|
-
if (resData.error) {
|
59
|
-
switch (resData.error) {
|
60
|
-
case 1976004:
|
61
|
-
throw new utils.CustomError({ error: "Cannot alter admin status: you are not an admin.", rawResponse: resData });
|
62
|
-
case 1357031:
|
63
|
-
throw new utils.CustomError({ error: "Cannot alter admin status: this thread is not a group chat.", rawResponse: resData });
|
64
|
-
default:
|
65
|
-
throw new utils.CustomError({ error: "Cannot alter admin status: unknown error.", rawResponse: resData });
|
66
|
-
}
|
67
|
-
}
|
68
|
-
|
69
|
-
callback();
|
70
|
-
})
|
71
|
-
.catch(function (err) {
|
72
|
-
log.error("changeAdminStatus", err);
|
73
|
-
return callback(err);
|
74
|
-
});
|
75
|
-
|
76
|
-
return returnPromise;
|
77
|
-
};
|
78
|
-
};
|
79
|
-
|
@@ -1,55 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
const utils = require("../utils");
|
4
|
-
const log = require("npmlog");
|
5
|
-
|
6
|
-
module.exports = function (defaultFuncs, api, ctx) {
|
7
|
-
return function changeArchivedStatus(threadOrThreads, archive, callback) {
|
8
|
-
let resolveFunc = function () { };
|
9
|
-
let rejectFunc = function () { };
|
10
|
-
const returnPromise = new Promise(function (resolve, reject) {
|
11
|
-
resolveFunc = resolve;
|
12
|
-
rejectFunc = reject;
|
13
|
-
});
|
14
|
-
|
15
|
-
if (!callback) {
|
16
|
-
callback = function (err) {
|
17
|
-
if (err) {
|
18
|
-
return rejectFunc(err);
|
19
|
-
}
|
20
|
-
resolveFunc();
|
21
|
-
};
|
22
|
-
}
|
23
|
-
|
24
|
-
const form = {};
|
25
|
-
|
26
|
-
if (utils.getType(threadOrThreads) === "Array") {
|
27
|
-
for (let i = 0; i < threadOrThreads.length; i++) {
|
28
|
-
form["ids[" + threadOrThreads[i] + "]"] = archive;
|
29
|
-
}
|
30
|
-
} else {
|
31
|
-
form["ids[" + threadOrThreads + "]"] = archive;
|
32
|
-
}
|
33
|
-
|
34
|
-
defaultFuncs
|
35
|
-
.post(
|
36
|
-
"https://www.facebook.com/ajax/mercury/change_archived_status.php",
|
37
|
-
ctx.jar,
|
38
|
-
form
|
39
|
-
)
|
40
|
-
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
41
|
-
.then(function (resData) {
|
42
|
-
if (resData.error) {
|
43
|
-
throw resData;
|
44
|
-
}
|
45
|
-
|
46
|
-
return callback();
|
47
|
-
})
|
48
|
-
.catch(function (err) {
|
49
|
-
log.error("changeArchivedStatus", err);
|
50
|
-
return callback(err);
|
51
|
-
});
|
52
|
-
|
53
|
-
return returnPromise;
|
54
|
-
};
|
55
|
-
};
|
package/src/changeBio.js
DELETED
@@ -1,77 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
const utils = require("../utils");
|
4
|
-
const log = require("npmlog");
|
5
|
-
|
6
|
-
module.exports = function (defaultFuncs, api, ctx) {
|
7
|
-
return function changeBio(bio, publish, callback) {
|
8
|
-
let resolveFunc = function () { };
|
9
|
-
let rejectFunc = function () { };
|
10
|
-
const returnPromise = new Promise(function (resolve, reject) {
|
11
|
-
resolveFunc = resolve;
|
12
|
-
rejectFunc = reject;
|
13
|
-
});
|
14
|
-
|
15
|
-
if (!callback) {
|
16
|
-
if (utils.getType(publish) == "Function" || utils.getType(publish) == "AsyncFunction") {
|
17
|
-
callback = publish;
|
18
|
-
} else {
|
19
|
-
callback = function (err) {
|
20
|
-
if (err) {
|
21
|
-
return rejectFunc(err);
|
22
|
-
}
|
23
|
-
resolveFunc();
|
24
|
-
};
|
25
|
-
}
|
26
|
-
}
|
27
|
-
|
28
|
-
if (utils.getType(publish) != "Boolean") {
|
29
|
-
publish = false;
|
30
|
-
}
|
31
|
-
|
32
|
-
if (utils.getType(bio) != "String") {
|
33
|
-
bio = "";
|
34
|
-
publish = false;
|
35
|
-
}
|
36
|
-
|
37
|
-
const form = {
|
38
|
-
fb_api_caller_class: "RelayModern",
|
39
|
-
fb_api_req_friendly_name: "ProfileCometSetBioMutation",
|
40
|
-
// This doc_is is valid as of May 23, 2020
|
41
|
-
doc_id: "2725043627607610",
|
42
|
-
variables: JSON.stringify({
|
43
|
-
input: {
|
44
|
-
bio: bio,
|
45
|
-
publish_bio_feed_story: publish,
|
46
|
-
actor_id: ctx.i_userID || ctx.userID,
|
47
|
-
client_mutation_id: Math.round(Math.random() * 1024).toString()
|
48
|
-
},
|
49
|
-
hasProfileTileViewID: false,
|
50
|
-
profileTileViewID: null,
|
51
|
-
scale: 1
|
52
|
-
}),
|
53
|
-
av: ctx.i_userID || ctx.userID
|
54
|
-
};
|
55
|
-
|
56
|
-
defaultFuncs
|
57
|
-
.post(
|
58
|
-
"https://www.facebook.com/api/graphql/",
|
59
|
-
ctx.jar,
|
60
|
-
form
|
61
|
-
)
|
62
|
-
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
63
|
-
.then(function (resData) {
|
64
|
-
if (resData.errors) {
|
65
|
-
throw resData;
|
66
|
-
}
|
67
|
-
|
68
|
-
return callback();
|
69
|
-
})
|
70
|
-
.catch(function (err) {
|
71
|
-
log.error("changeBio", err);
|
72
|
-
return callback(err);
|
73
|
-
});
|
74
|
-
|
75
|
-
return returnPromise;
|
76
|
-
};
|
77
|
-
};
|
@@ -1,47 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
const utils = require("../utils");
|
4
|
-
const log = require("npmlog");
|
5
|
-
|
6
|
-
module.exports = function (defaultFuncs, api, ctx) {
|
7
|
-
return function changeBlockedStatus(userID, block, callback) {
|
8
|
-
let resolveFunc = function () { };
|
9
|
-
let rejectFunc = function () { };
|
10
|
-
const returnPromise = new Promise(function (resolve, reject) {
|
11
|
-
resolveFunc = resolve;
|
12
|
-
rejectFunc = reject;
|
13
|
-
});
|
14
|
-
|
15
|
-
if (!callback) {
|
16
|
-
callback = function (err) {
|
17
|
-
if (err) {
|
18
|
-
return rejectFunc(err);
|
19
|
-
}
|
20
|
-
resolveFunc();
|
21
|
-
};
|
22
|
-
}
|
23
|
-
|
24
|
-
defaultFuncs
|
25
|
-
.post(
|
26
|
-
`https://www.facebook.com/messaging/${block ? "" : "un"}block_messages/`,
|
27
|
-
ctx.jar,
|
28
|
-
{
|
29
|
-
fbid: userID
|
30
|
-
}
|
31
|
-
)
|
32
|
-
.then(utils.saveCookies(ctx.jar))
|
33
|
-
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
34
|
-
.then(function (resData) {
|
35
|
-
if (resData.error) {
|
36
|
-
throw resData;
|
37
|
-
}
|
38
|
-
|
39
|
-
return callback();
|
40
|
-
})
|
41
|
-
.catch(function (err) {
|
42
|
-
log.error("changeBlockedStatus", err);
|
43
|
-
return callback(err);
|
44
|
-
});
|
45
|
-
return returnPromise;
|
46
|
-
};
|
47
|
-
};
|
package/src/changeGroupImage.js
DELETED
@@ -1,132 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
const utils = require("../utils");
|
4
|
-
const log = require("npmlog");
|
5
|
-
|
6
|
-
module.exports = function (defaultFuncs, api, ctx) {
|
7
|
-
function handleUpload(image, callback) {
|
8
|
-
const uploads = [];
|
9
|
-
|
10
|
-
const form = {
|
11
|
-
images_only: "true",
|
12
|
-
"attachment[]": image
|
13
|
-
};
|
14
|
-
|
15
|
-
uploads.push(
|
16
|
-
defaultFuncs
|
17
|
-
.postFormData(
|
18
|
-
"https://upload.facebook.com/ajax/mercury/upload.php",
|
19
|
-
ctx.jar,
|
20
|
-
form,
|
21
|
-
{}
|
22
|
-
)
|
23
|
-
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
24
|
-
.then(function (resData) {
|
25
|
-
if (resData.error) {
|
26
|
-
throw resData;
|
27
|
-
}
|
28
|
-
|
29
|
-
return resData.payload.metadata[0];
|
30
|
-
})
|
31
|
-
);
|
32
|
-
|
33
|
-
// resolve all promises
|
34
|
-
Promise
|
35
|
-
.all(uploads)
|
36
|
-
.then(function (resData) {
|
37
|
-
callback(null, resData);
|
38
|
-
})
|
39
|
-
.catch(function (err) {
|
40
|
-
log.error("handleUpload", err);
|
41
|
-
return callback(err);
|
42
|
-
});
|
43
|
-
}
|
44
|
-
|
45
|
-
return function changeGroupImage(image, threadID, callback) {
|
46
|
-
if (
|
47
|
-
!callback &&
|
48
|
-
(utils.getType(threadID) === "Function" ||
|
49
|
-
utils.getType(threadID) === "AsyncFunction")
|
50
|
-
) {
|
51
|
-
throw { error: "please pass a threadID as a second argument." };
|
52
|
-
}
|
53
|
-
|
54
|
-
if (!utils.isReadableStream(image)) {
|
55
|
-
throw { error: "please pass a readable stream as a first argument." };
|
56
|
-
}
|
57
|
-
|
58
|
-
let resolveFunc = function () { };
|
59
|
-
let rejectFunc = function () { };
|
60
|
-
const returnPromise = new Promise(function (resolve, reject) {
|
61
|
-
resolveFunc = resolve;
|
62
|
-
rejectFunc = reject;
|
63
|
-
});
|
64
|
-
|
65
|
-
if (!callback) {
|
66
|
-
callback = function (err) {
|
67
|
-
if (err) {
|
68
|
-
return rejectFunc(err);
|
69
|
-
}
|
70
|
-
resolveFunc();
|
71
|
-
};
|
72
|
-
}
|
73
|
-
|
74
|
-
const messageAndOTID = utils.generateOfflineThreadingID();
|
75
|
-
const form = {
|
76
|
-
client: "mercury",
|
77
|
-
action_type: "ma-type:log-message",
|
78
|
-
author: "fbid:" + (ctx.i_userID || ctx.userID),
|
79
|
-
author_email: "",
|
80
|
-
ephemeral_ttl_mode: "0",
|
81
|
-
is_filtered_content: false,
|
82
|
-
is_filtered_content_account: false,
|
83
|
-
is_filtered_content_bh: false,
|
84
|
-
is_filtered_content_invalid_app: false,
|
85
|
-
is_filtered_content_quasar: false,
|
86
|
-
is_forward: false,
|
87
|
-
is_spoof_warning: false,
|
88
|
-
is_unread: false,
|
89
|
-
log_message_type: "log:thread-image",
|
90
|
-
manual_retry_cnt: "0",
|
91
|
-
message_id: messageAndOTID,
|
92
|
-
offline_threading_id: messageAndOTID,
|
93
|
-
source: "source:chat:web",
|
94
|
-
"source_tags[0]": "source:chat",
|
95
|
-
status: "0",
|
96
|
-
thread_fbid: threadID,
|
97
|
-
thread_id: "",
|
98
|
-
timestamp: Date.now(),
|
99
|
-
timestamp_absolute: "Today",
|
100
|
-
timestamp_relative: utils.generateTimestampRelative(),
|
101
|
-
timestamp_time_passed: "0"
|
102
|
-
};
|
103
|
-
|
104
|
-
handleUpload(image, function (err, payload) {
|
105
|
-
if (err) {
|
106
|
-
return callback(err);
|
107
|
-
}
|
108
|
-
|
109
|
-
form["thread_image_id"] = payload[0]["image_id"];
|
110
|
-
form["thread_id"] = threadID;
|
111
|
-
|
112
|
-
defaultFuncs
|
113
|
-
.post("https://www.facebook.com/messaging/set_thread_image/", ctx.jar, form)
|
114
|
-
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
115
|
-
.then(function (resData) {
|
116
|
-
// check for errors here
|
117
|
-
|
118
|
-
if (resData.error) {
|
119
|
-
throw resData;
|
120
|
-
}
|
121
|
-
|
122
|
-
return callback();
|
123
|
-
})
|
124
|
-
.catch(function (err) {
|
125
|
-
log.error("changeGroupImage", err);
|
126
|
-
return callback(err);
|
127
|
-
});
|
128
|
-
});
|
129
|
-
|
130
|
-
return returnPromise;
|
131
|
-
};
|
132
|
-
};
|
package/src/changeNickname.js
DELETED
@@ -1,59 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
const utils = require("../utils");
|
4
|
-
const log = require("npmlog");
|
5
|
-
|
6
|
-
module.exports = function (defaultFuncs, api, ctx) {
|
7
|
-
return function changeNickname(nickname, threadID, participantID, callback) {
|
8
|
-
let resolveFunc = function () { };
|
9
|
-
let rejectFunc = function () { };
|
10
|
-
const returnPromise = new Promise(function (resolve, reject) {
|
11
|
-
resolveFunc = resolve;
|
12
|
-
rejectFunc = reject;
|
13
|
-
});
|
14
|
-
if (!callback) {
|
15
|
-
callback = function (err) {
|
16
|
-
if (err) {
|
17
|
-
return rejectFunc(err);
|
18
|
-
}
|
19
|
-
resolveFunc();
|
20
|
-
};
|
21
|
-
}
|
22
|
-
|
23
|
-
const form = {
|
24
|
-
nickname: nickname,
|
25
|
-
participant_id: participantID,
|
26
|
-
thread_or_other_fbid: threadID
|
27
|
-
};
|
28
|
-
|
29
|
-
defaultFuncs
|
30
|
-
.post(
|
31
|
-
"https://www.facebook.com/messaging/save_thread_nickname/?source=thread_settings&dpr=1",
|
32
|
-
ctx.jar,
|
33
|
-
form
|
34
|
-
)
|
35
|
-
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
36
|
-
.then(function (resData) {
|
37
|
-
if (resData.error === 1545014) {
|
38
|
-
throw { error: "Trying to change nickname of user isn't in thread" };
|
39
|
-
}
|
40
|
-
if (resData.error === 1357031) {
|
41
|
-
throw {
|
42
|
-
error:
|
43
|
-
"Trying to change user nickname of a thread that doesn't exist. Have at least one message in the thread before trying to change the user nickname."
|
44
|
-
};
|
45
|
-
}
|
46
|
-
if (resData.error) {
|
47
|
-
throw resData;
|
48
|
-
}
|
49
|
-
|
50
|
-
return callback();
|
51
|
-
})
|
52
|
-
.catch(function (err) {
|
53
|
-
log.error("changeNickname", err);
|
54
|
-
return callback(err);
|
55
|
-
});
|
56
|
-
|
57
|
-
return returnPromise;
|
58
|
-
};
|
59
|
-
};
|
package/src/changeThreadColor.js
DELETED
@@ -1,65 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
const utils = require("../utils");
|
4
|
-
const log = require("npmlog");
|
5
|
-
|
6
|
-
module.exports = function (defaultFuncs, api, ctx) {
|
7
|
-
return function changeThreadColor(color, threadID, callback) {
|
8
|
-
let resolveFunc = function () { };
|
9
|
-
let rejectFunc = function () { };
|
10
|
-
const returnPromise = new Promise(function (resolve, reject) {
|
11
|
-
resolveFunc = resolve;
|
12
|
-
rejectFunc = reject;
|
13
|
-
});
|
14
|
-
|
15
|
-
if (!callback) {
|
16
|
-
callback = function (err) {
|
17
|
-
if (err) {
|
18
|
-
return rejectFunc(err);
|
19
|
-
}
|
20
|
-
resolveFunc(err);
|
21
|
-
};
|
22
|
-
}
|
23
|
-
|
24
|
-
if (!isNaN(color)) {
|
25
|
-
color = color.toString();
|
26
|
-
}
|
27
|
-
const validatedColor = color !== null ? color.toLowerCase() : color; // API only accepts lowercase letters in hex string
|
28
|
-
|
29
|
-
const form = {
|
30
|
-
dpr: 1,
|
31
|
-
queries: JSON.stringify({
|
32
|
-
o0: {
|
33
|
-
//This doc_id is valid as of January 31, 2020
|
34
|
-
doc_id: "1727493033983591",
|
35
|
-
query_params: {
|
36
|
-
data: {
|
37
|
-
actor_id: ctx.i_userID || ctx.userID,
|
38
|
-
client_mutation_id: "0",
|
39
|
-
source: "SETTINGS",
|
40
|
-
theme_id: validatedColor,
|
41
|
-
thread_id: threadID
|
42
|
-
}
|
43
|
-
}
|
44
|
-
}
|
45
|
-
})
|
46
|
-
};
|
47
|
-
|
48
|
-
defaultFuncs
|
49
|
-
.post("https://www.facebook.com/api/graphqlbatch/", ctx.jar, form)
|
50
|
-
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
|
51
|
-
.then(function (resData) {
|
52
|
-
if (resData[resData.length - 1].error_results > 0) {
|
53
|
-
throw new utils.CustomError(resData[0].o0.errors);
|
54
|
-
}
|
55
|
-
|
56
|
-
return callback();
|
57
|
-
})
|
58
|
-
.catch(function (err) {
|
59
|
-
log.error("changeThreadColor", err);
|
60
|
-
return callback(err);
|
61
|
-
});
|
62
|
-
|
63
|
-
return returnPromise;
|
64
|
-
};
|
65
|
-
};
|