rebel-chat-api 4.8.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (123) hide show
  1. package/.cache/replit/__replit_disk_meta.json +1 -0
  2. package/.cache/replit/modules/nodejs-18:v11-20230920-bd784b9.res +1 -0
  3. package/.cache/replit/modules.stamp +0 -0
  4. package/.cache/replit/nix/env.json +1 -0
  5. package/.github/workflows/5 +1 -0
  6. package/.github/workflows/publish.yml +21 -0
  7. package/.replit +11 -0
  8. package/.upm/store.json +1 -0
  9. package/Extra/Database/index.js +360 -0
  10. package/Extra/ExtraAddons.js +82 -0
  11. package/Extra/ExtraFindUID.js +62 -0
  12. package/Extra/ExtraGetThread.js +340 -0
  13. package/Extra/ExtraScreenShot.js +430 -0
  14. package/Extra/ExtraUptimeRobot.js +38 -0
  15. package/Extra/Html/Classic/6 +1 -0
  16. package/Extra/Html/Classic/script.js +119 -0
  17. package/Extra/Html/Classic/style.css +8 -0
  18. package/Extra/Security/Index.js +146 -0
  19. package/Extra/Security/S +1 -0
  20. package/Extra/Security/Step_1.js +6 -0
  21. package/Extra/Security/Step_2.js +22 -0
  22. package/Extra/Security/Step_3.js +22 -0
  23. package/Extra/src/Change_Environment.js +24 -0
  24. package/Extra/src/Check_Update.js +67 -0
  25. package/Extra/src/History.js +115 -0
  26. package/Extra/src/Instant_Update.js +65 -0
  27. package/Extra/src/Last-Run.js +65 -0
  28. package/Extra/src/Premium.js +81 -0
  29. package/Extra/src/Release_Memory.js +41 -0
  30. package/Extra/src/U +1 -0
  31. package/Extra/src/Websocket.js +213 -0
  32. package/Extra/src/image/20231015_051416.png +0 -0
  33. package/Extra/src/image/T +1 -0
  34. package/Extra/src/uuid.js +137 -0
  35. package/Func/& +1 -0
  36. package/Func/AcceptAgreement.js +31 -0
  37. package/Func/ClearCache.js +64 -0
  38. package/Func/ReportV1.js +54 -0
  39. package/LICENSE +24 -0
  40. package/Language/6 +1 -0
  41. package/Language/index.json +216 -0
  42. package/Main.js +1211 -0
  43. package/README.md +147 -0
  44. package/SECURITY.md +18 -0
  45. package/broadcast.js +38 -0
  46. package/gitattributes +2 -0
  47. package/gitignore.txt +10 -0
  48. package/index.js +1363 -0
  49. package/logger.js +66 -0
  50. package/package.json +91 -0
  51. package/src/Dev_Horizon_Data.js +125 -0
  52. package/src/Premium.js +25 -0
  53. package/src/Screenshot.js +83 -0
  54. package/src/T +1 -0
  55. package/src/addExternalModule.js +16 -0
  56. package/src/addUserToGroup.js +79 -0
  57. package/src/changeAdminStatus.js +79 -0
  58. package/src/changeArchivedStatus.js +41 -0
  59. package/src/changeAvt.js +85 -0
  60. package/src/changeBio.js +65 -0
  61. package/src/changeBlockedStatus.js +36 -0
  62. package/src/changeGroupImage.js +106 -0
  63. package/src/changeNickname.js +45 -0
  64. package/src/changeThreadColor.js +62 -0
  65. package/src/changeThreadEmoji.js +42 -0
  66. package/src/createNewGroup.js +70 -0
  67. package/src/createPoll.js +60 -0
  68. package/src/deleteMessage.js +45 -0
  69. package/src/deleteThread.js +43 -0
  70. package/src/forwardAttachment.js +48 -0
  71. package/src/getAccessToken.js +28 -0
  72. package/src/getCurrentUserID.js +7 -0
  73. package/src/getEmojiUrl.js +27 -0
  74. package/src/getFriendsList.js +73 -0
  75. package/src/getMessage.js +80 -0
  76. package/src/getThreadHistory.js +537 -0
  77. package/src/getThreadInfo.js +425 -0
  78. package/src/getThreadList.js +213 -0
  79. package/src/getThreadMain.js +220 -0
  80. package/src/getThreadPictures.js +59 -0
  81. package/src/getUID.js +59 -0
  82. package/src/getUserID.js +62 -0
  83. package/src/getUserInfo.js +113 -0
  84. package/src/getUserInfoMain.js +65 -0
  85. package/src/getUserInfoV2.js +32 -0
  86. package/src/getUserInfoV3.js +63 -0
  87. package/src/getUserInfoV4.js +55 -0
  88. package/src/getUserInfoV5.js +61 -0
  89. package/src/handleFriendRequest.js +46 -0
  90. package/src/handleMessageRequest.js +49 -0
  91. package/src/httpGet.js +49 -0
  92. package/src/httpPost.js +48 -0
  93. package/src/httpPostFormData.js +41 -0
  94. package/src/listenMqtt.js +787 -0
  95. package/src/logout.js +68 -0
  96. package/src/markAsDelivered.js +48 -0
  97. package/src/markAsRead.js +70 -0
  98. package/src/markAsReadAll.js +43 -0
  99. package/src/markAsSeen.js +51 -0
  100. package/src/muteThread.js +47 -0
  101. package/src/removeUserFromGroup.js +49 -0
  102. package/src/resolvePhotoUrl.js +37 -0
  103. package/src/searchForThread.js +43 -0
  104. package/src/sendMessage.js +379 -0
  105. package/src/sendTypingIndicator.js +80 -0
  106. package/src/setMessageReaction.js +109 -0
  107. package/src/setPostReaction.js +102 -0
  108. package/src/setTitle.js +74 -0
  109. package/src/threadColors.js +39 -0
  110. package/src/unfriend.js +43 -0
  111. package/src/unsendMessage.js +40 -0
  112. package/test/data/5 +1 -0
  113. package/test/data/shareAttach.js +146 -0
  114. package/test/data/something.mov +0 -0
  115. package/test/data/test.png +0 -0
  116. package/test/data/test.txt +7 -0
  117. package/test/env/.env +0 -0
  118. package/test/env/P +1 -0
  119. package/test/example-config.json +18 -0
  120. package/test/test-page.js +140 -0
  121. package/test/test.js +385 -0
  122. package/test/testv2.js +3 -0
  123. package/utils.js +1648 -0
@@ -0,0 +1 @@
1
+ {"nonce":3493746595190385874,"last_updated":{"seconds":1697897208,"nanos":121013000}}
@@ -0,0 +1 @@
1
+ {"type":"resolve","resolvedModuleId":"nodejs-18:v11-20230920-bd784b9","inputHash":"","resolutionPath":["nodejs-18:v3-20230608-f4cd419","nodejs-18:v4-20230623-0b7a606","nodejs-18:v5-20230706-ccb32c4","nodejs-18:v6-20230711-6807d41","nodejs-18:v7-20230905-8d7bacf","nodejs-18:v8-20230907-87be05d","nodejs-18:v9-20230908-bb1b9fd","nodejs-18:v10-20230914-1095880","nodejs-18:v11-20230920-bd784b9"],"error":"","Changed":true}
File without changes
@@ -0,0 +1 @@
1
+ {"entries":{"replit.nix":{"env":{"AR":"ar","AS":"as","CC":"gcc","CONFIG_SHELL":"/nix/store/dsd5gz46hdbdk2rfdimqddhq6m8m8fqs-bash-5.1-p16/bin/bash","CXX":"g++","HOST_PATH":"/nix/store/dj805sw07vvpbxx39c8g67x8qddg0ikw-nodejs-18.12.1/bin:/nix/store/w8q2bwi6rdhsa1dz9i8mqznddk5l7p26-typescript-language-server-3.3.2/bin:/nix/store/zdcnqq55qi214j46zgw2qa1jp4dpdf2m-yarn-1.22.19/bin:/nix/store/n1wjpwirjdkvkqyfjjg8qafgdhpr5w2m-jest-cli-23.6.0/bin:/nix/store/a7gvj343m05j2s32xcnwr35v31ynlypr-coreutils-9.1/bin:/nix/store/mydc6f4k2z73xlcz7ilif3v2lcaiqvza-findutils-4.9.0/bin:/nix/store/j9p3g8472iijd50vhdprx0nmk2fqn5gv-diffutils-3.8/bin:/nix/store/89zs7rms6x00xfq4dq6m7mjnhkr8a6r4-gnused-4.8/bin:/nix/store/86bp03jkmsl6f92w0yzg4s59g5mhxwmy-gnugrep-3.7/bin:/nix/store/hwcdqw4jrjnd37wxqgsd47hd0j8bnj09-gawk-5.1.1/bin:/nix/store/cfbhw8r8ags41vwqaz47r583d0p4h4a1-gnutar-1.34/bin:/nix/store/p3m1ndl1lapwrlh698bnb5lvvxh67378-gzip-1.12/bin:/nix/store/a8mhcagrsly7c7mpjrpsnaahk4aax056-bzip2-1.0.8-bin/bin:/nix/store/mblgz65m3zv9x548a3d5m96fj2pbwr09-gnumake-4.3/bin:/nix/store/dsd5gz46hdbdk2rfdimqddhq6m8m8fqs-bash-5.1-p16/bin:/nix/store/v7ljksji50mg3w61dykaa3n3y79n6nil-patch-2.7.6/bin:/nix/store/zlcnmqq14jz5x9439jf937mvayyl63da-xz-5.2.7-bin/bin:/nix/store/y6aj732zm9m87c82fpvf103a1xb22blp-file-5.43/bin","LD":"ld","LOCALE_ARCHIVE":"/usr/lib/locale/locale-archive","NIX_BINTOOLS":"/nix/store/1d6ian3r8kdzspw8hacjhl3xkp40g1lj-binutils-wrapper-2.39","NIX_BINTOOLS_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu":"1","NIX_BUILD_CORES":"16","NIX_BUILD_TOP":"/tmp","NIX_CC":"/nix/store/dq0xwmsk1g0i2ayg6pb7y87na2knzylh-gcc-wrapper-11.3.0","NIX_CC_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu":"1","NIX_CFLAGS_COMPILE":" -frandom-seed=w7rihbbvnp -isystem /nix/store/dj805sw07vvpbxx39c8g67x8qddg0ikw-nodejs-18.12.1/include -isystem /nix/store/dj805sw07vvpbxx39c8g67x8qddg0ikw-nodejs-18.12.1/include","NIX_ENFORCE_NO_NATIVE":"1","NIX_HARDENING_ENABLE":"fortify stackprotector pic strictoverflow format relro bindnow","NIX_INDENT_MAKE":"1","NIX_LDFLAGS":"-rpath /nix/store/w7rihbbvnp89y3vqbkwy2z30wi3mwzhi-nix-shell/lib64 -rpath /nix/store/w7rihbbvnp89y3vqbkwy2z30wi3mwzhi-nix-shell/lib ","NIX_STORE":"/nix/store","NM":"nm","NODE_PATH":"/nix/store/dj805sw07vvpbxx39c8g67x8qddg0ikw-nodejs-18.12.1/lib/node_modules:/nix/store/w8q2bwi6rdhsa1dz9i8mqznddk5l7p26-typescript-language-server-3.3.2/lib/node_modules:/nix/store/n1wjpwirjdkvkqyfjjg8qafgdhpr5w2m-jest-cli-23.6.0/lib/node_modules","OBJCOPY":"objcopy","OBJDUMP":"objdump","PATH":"/nix/store/bap4d0lpcrhpwmpb8ayjcgkmvfj62lnq-bash-interactive-5.1-p16/bin:/nix/store/pr5n59mb4jzmfx6kanwxly0l07p861fg-patchelf-0.15.0/bin:/nix/store/dq0xwmsk1g0i2ayg6pb7y87na2knzylh-gcc-wrapper-11.3.0/bin:/nix/store/1gf2flfqnpqbr1b4p4qz2f72y42bs56r-gcc-11.3.0/bin:/nix/store/57xv61c5zi8pphjbcwxxjlgc34p61ic9-glibc-2.35-163-bin/bin:/nix/store/a7gvj343m05j2s32xcnwr35v31ynlypr-coreutils-9.1/bin:/nix/store/1d6ian3r8kdzspw8hacjhl3xkp40g1lj-binutils-wrapper-2.39/bin:/nix/store/039g378vc3pc3dvi9dzdlrd0i4q93qwf-binutils-2.39/bin:/nix/store/dj805sw07vvpbxx39c8g67x8qddg0ikw-nodejs-18.12.1/bin:/nix/store/w8q2bwi6rdhsa1dz9i8mqznddk5l7p26-typescript-language-server-3.3.2/bin:/nix/store/zdcnqq55qi214j46zgw2qa1jp4dpdf2m-yarn-1.22.19/bin:/nix/store/n1wjpwirjdkvkqyfjjg8qafgdhpr5w2m-jest-cli-23.6.0/bin:/nix/store/a7gvj343m05j2s32xcnwr35v31ynlypr-coreutils-9.1/bin:/nix/store/mydc6f4k2z73xlcz7ilif3v2lcaiqvza-findutils-4.9.0/bin:/nix/store/j9p3g8472iijd50vhdprx0nmk2fqn5gv-diffutils-3.8/bin:/nix/store/89zs7rms6x00xfq4dq6m7mjnhkr8a6r4-gnused-4.8/bin:/nix/store/86bp03jkmsl6f92w0yzg4s59g5mhxwmy-gnugrep-3.7/bin:/nix/store/hwcdqw4jrjnd37wxqgsd47hd0j8bnj09-gawk-5.1.1/bin:/nix/store/cfbhw8r8ags41vwqaz47r583d0p4h4a1-gnutar-1.34/bin:/nix/store/p3m1ndl1lapwrlh698bnb5lvvxh67378-gzip-1.12/bin:/nix/store/a8mhcagrsly7c7mpjrpsnaahk4aax056-bzip2-1.0.8-bin/bin:/nix/store/mblgz65m3zv9x548a3d5m96fj2pbwr09-gnumake-4.3/bin:/nix/store/dsd5gz46hdbdk2rfdimqddhq6m8m8fqs-bash-5.1-p16/bin:/nix/store/v7ljksji50mg3w61dykaa3n3y79n6nil-patch-2.7.6/bin:/nix/store/zlcnmqq14jz5x9439jf937mvayyl63da-xz-5.2.7-bin/bin:/nix/store/y6aj732zm9m87c82fpvf103a1xb22blp-file-5.43/bin","RANLIB":"ranlib","READELF":"readelf","SIZE":"size","SOURCE_DATE_EPOCH":"315532800","STRINGS":"strings","STRIP":"strip","XDG_DATA_DIRS":"/nix/store/pr5n59mb4jzmfx6kanwxly0l07p861fg-patchelf-0.15.0/share","_":"/nix/store/a7gvj343m05j2s32xcnwr35v31ynlypr-coreutils-9.1/bin/env","__ETC_PROFILE_SOURCED":"1","buildInputs":"/nix/store/dj805sw07vvpbxx39c8g67x8qddg0ikw-nodejs-18.12.1 /nix/store/w8q2bwi6rdhsa1dz9i8mqznddk5l7p26-typescript-language-server-3.3.2 /nix/store/zdcnqq55qi214j46zgw2qa1jp4dpdf2m-yarn-1.22.19 /nix/store/n1wjpwirjdkvkqyfjjg8qafgdhpr5w2m-jest-cli-23.6.0","buildPhase":"echo \"------------------------------------------------------------\" \u003e\u003e$out\necho \" WARNING: the existence of this path is not guaranteed.\" \u003e\u003e$out\necho \" It is an internal implementation detail for pkgs.mkShell.\" \u003e\u003e$out\necho \"------------------------------------------------------------\" \u003e\u003e$out\necho \u003e\u003e $out\n# Record all build inputs as runtime dependencies\nexport \u003e\u003e $out\n","builder":"/nix/store/dsd5gz46hdbdk2rfdimqddhq6m8m8fqs-bash-5.1-p16/bin/bash","cmakeFlags":"","configureFlags":"","depsBuildBuild":"","depsBuildBuildPropagated":"","depsBuildTarget":"","depsBuildTargetPropagated":"","depsHostHost":"","depsHostHostPropagated":"","depsTargetTarget":"","depsTargetTargetPropagated":"","doCheck":"","doInstallCheck":"","mesonFlags":"","name":"nix-shell","nativeBuildInputs":"","out":"/nix/store/w7rihbbvnp89y3vqbkwy2z30wi3mwzhi-nix-shell","outputs":"out","patches":"","phases":"buildPhase","propagatedBuildInputs":"","propagatedNativeBuildInputs":"","shell":"/nix/store/dsd5gz46hdbdk2rfdimqddhq6m8m8fqs-bash-5.1-p16/bin/bash","shellHook":"","stdenv":"/nix/store/kmfaajdpyyyg319vfqni5jm9wkxjmf73-stdenv-linux","strictDeps":"","system":"x86_64-linux"},"dependencies":[{"path":"replit.nix","mod_time":"2023-09-14T19:12:19.450788746Z"}],"channel":"stable-22_11","channel_nix_path":"/nix/store/g2zwsf4i26pngib77ask4m00n9pj2a03-nixpkgs-stable-22_11-22.11.tar.gz/nixpkgs-stable-22_11","production":null}}}
@@ -0,0 +1 @@
1
+
@@ -0,0 +1,21 @@
1
+
2
+ name: "publish npm"
3
+
4
+ on: push
5
+
6
+ jobs:
7
+ publish:
8
+ runs-on: ubuntu-latest
9
+ steps:
10
+ - name: checkout
11
+ uses: actions/checkout@v2
12
+ - name: node
13
+ uses: actions/setup-node@v2
14
+ with:
15
+ node-version: 14
16
+ registry-url: https://registry.npmjs.org
17
+ - name: publish
18
+ run: npm publish --access public
19
+ # working-directory: package.json
20
+ env:
21
+ NODE_AUTH_TOKEN: ${{secrets.NPM_AUTH_TOKEN}}
package/.replit ADDED
@@ -0,0 +1,11 @@
1
+ modules = ["nodejs-18:v3-20230608-f4cd419"]
2
+ hidden = [".config", "package-lock.json"]
3
+ run = "npm run start"
4
+
5
+ [nix]
6
+ channel = "stable-23_05"
7
+
8
+ [deployment]
9
+ run = ["sh", "-c", "npm run start"]
10
+ deploymentTarget = "cloudrun"
11
+ ignorePorts = false
@@ -0,0 +1 @@
1
+ {"version":2,"languages":{"nodejs-npm":{"guessedImports":["form-data","readable-stream","is-hexcolor","figlet","duplexify","ansi-to-html","request","mqtt","tough-cookie","cheerio","got","ws","axios","file-url","speakeasy","better-sqlite3","aes-js","https-proxy-agent","encode32","deasync","totp-generator","chalk","lodash","npmlog","pretty-ms","uuid","express","crypto-js","bluebird","puppeteer","fs-extra"],"guessedImportsHash":"116c53188a48b90af5843f31b3138158"}}}
@@ -0,0 +1,360 @@
1
+ var get = require('lodash/get'),
2
+ set = require('lodash/set'),
3
+ got = require("got"),
4
+ BetterDB = require("better-sqlite3"),
5
+ db = new BetterDB(__dirname + "/SyntheticDatabase.sqlite");
6
+ var ReplitURL = process.env.REPLIT_DB_URL
7
+ var ReplID = ReplID
8
+ module.exports = {
9
+ get: function(key, ops,forceFuction) {
10
+ if (ReplID == undefined || forceFuction) {
11
+ if (!key)
12
+ throw new TypeError(
13
+ "No key specified."
14
+ );
15
+ return arbitrate("fetch", { id: key, ops: ops || {} });
16
+ }
17
+ else return got(ReplitURL + "/" + key)
18
+ .then((StrValue) => {
19
+ var strValue = StrValue.body
20
+
21
+ if (ops && ops.raw) return strValue;
22
+ if (!strValue) return null;
23
+ try {
24
+ var value = JSON.parse(strValue);
25
+ } catch (_err) {
26
+ throw new SyntaxError(
27
+ `Failed to parse value of ${key}, try passing a raw option to get the raw value`
28
+ );
29
+ }
30
+ if (value === null || value === undefined) {
31
+ return null;
32
+ }
33
+ return value;
34
+ });
35
+ },
36
+
37
+ set: function(key, value,forceFuction) {
38
+ if (ReplID == undefined || forceFuction) {
39
+ if (!key)
40
+ throw new TypeError(
41
+ "No key specified."
42
+ );
43
+ return arbitrate("set",{
44
+ stringify: false,
45
+ id: key,
46
+ data: value,
47
+ ops: {},
48
+ });
49
+ }
50
+ else return got(ReplitURL, {
51
+ method: "POST",
52
+ headers: { "Content-Type": "application/x-www-form-urlencoded" },
53
+ body: encodeURIComponent(key) + "=" + encodeURIComponent(JSON.stringify(value)),
54
+ });
55
+ },
56
+ has: function(key,forceFuction) {
57
+ if (ReplID == undefined || forceFuction) {
58
+ if (!key)
59
+ throw new TypeError(
60
+ "No key specified."
61
+ );
62
+ return arbitrate("has", { id: key, ops: {} });
63
+ }
64
+ else return got(ReplitURL + "/" + key)
65
+ .then((StrValue) => {
66
+ var strValue = StrValue.body
67
+ if (strValue === "") return false;
68
+ return true;
69
+ });
70
+ },
71
+ delete: function(key,forceFuction) {
72
+ if (ReplID == undefined || forceFuction) {
73
+ if (!key)
74
+ throw new TypeError(
75
+ "No key specified."
76
+ );
77
+ return arbitrate("delete", { id: key, ops: {} });
78
+ }
79
+ else return got(ReplitURL + "/" + key, {
80
+ method: "DELETE",
81
+ });
82
+ },
83
+
84
+ deleteMultiple: function(forceFuction,...args) {
85
+ if (ReplID == undefined || forceFuction) {
86
+ if (!key)
87
+ throw new TypeError(
88
+ "No key specified."
89
+ );
90
+ try {
91
+ for (let i of args) {
92
+ arbitrate("delete", { id: i, ops: {} });
93
+ }
94
+ return true;
95
+ }
96
+ catch (err) {
97
+ return false;
98
+ }
99
+ }
100
+ else {
101
+ const promises = [];
102
+
103
+ for (const arg of args) {
104
+ promises.push(this.delete(arg));
105
+ }
106
+
107
+ Promise.all(promises);
108
+
109
+ return this;
110
+ }
111
+ },
112
+
113
+ empty: async function(forceFuction) {
114
+ if (ReplID == undefined || forceFuction) {
115
+ return arbitrate("clear");
116
+ }
117
+ else {
118
+ const promises = [];
119
+ for (const key of await this.list()) {
120
+ promises.push(this.delete(key));
121
+ }
122
+
123
+ Promise.all(promises);
124
+
125
+ return this;
126
+ }
127
+ },
128
+
129
+ list: async function(forceFuction) {
130
+ if (ReplID == undefined || forceFuction) {
131
+ return arbitrate("all",{ ops: {} });
132
+ }
133
+ else {
134
+ return got(
135
+ ReplitURL + `?encode=true&prefix=${encodeURIComponent(true)}`
136
+ )
137
+ .then((t) => {
138
+ var strValue = t.body
139
+ if (strValue.length === 0) {
140
+ return [];
141
+ }
142
+ return strValue.split("\n").map(decodeURIComponent);
143
+ });
144
+ }
145
+ }
146
+ }
147
+
148
+ var methods = {
149
+ fetch: function(db, params, options) {
150
+ let fetched = db.prepare(`SELECT * FROM ${options.table} WHERE ID = (?)`).get(params.id);
151
+ if (!fetched) return null;
152
+ try {
153
+ fetched = JSON.parse(fetched.json)
154
+ } catch (e) {
155
+ fetched = fetched.json;
156
+ }
157
+ if (params.ops.target) fetched = get(fetched, params.ops.target);
158
+ return fetched;
159
+ },
160
+ set: function(db, params, options) {
161
+ let fetched = db.prepare(`SELECT * FROM ${options.table} WHERE ID = (?)`).get(params.id);
162
+ if (!fetched) {
163
+ db.prepare(`INSERT INTO ${options.table} (ID,json) VALUES (?,?)`).run(params.id, '{}');
164
+ fetched = db.prepare(`SELECT * FROM ${options.table} WHERE ID = (?)`).get(params.id);
165
+ }
166
+ try {
167
+ fetched = JSON.parse(fetched);
168
+ } catch (e) {
169
+ fetched = fetched;
170
+ }
171
+ if (typeof fetched === 'object' && params.ops.target) {
172
+ params.data = JSON.parse(params.data);
173
+ params.data = set(fetched, params.ops.target, params.data);
174
+ }
175
+ else if (params.ops.target) throw new TypeError('Cannot target a non-object.');
176
+ db.prepare(`UPDATE ${options.table} SET json = (?) WHERE ID = (?)`).run(JSON.stringify(params.data), params.id);
177
+ let newData = db.prepare(`SELECT * FROM ${options.table} WHERE ID = (?)`).get(params.id).json;
178
+ if (newData === '{}') return null;
179
+ else {
180
+ try { newData = JSON.parse(newData);
181
+ }
182
+ catch (e) {
183
+ newData = newData;
184
+ }
185
+ return newData;
186
+ }
187
+ },
188
+ add: function addDB(db, params, options) {
189
+ let fetched = db.prepare(`SELECT * FROM ${options.table} WHERE ID = (?)`).get(params.id);
190
+ if (!fetched) {
191
+ db.prepare(`INSERT INTO ${options.table} (ID,json) VALUES (?,?)`).run(params.id, '{}');
192
+ fetched = db.prepare(`SELECT * FROM ${options.table} WHERE ID = (?)`).get(params.id);
193
+ }
194
+ if (params.ops.target) {
195
+ try {
196
+ fetched = JSON.parse(fetched)
197
+ }
198
+ catch (e) {
199
+ fetched = fetched;
200
+ }
201
+ let oldValue = get(fetched, params.ops.target);
202
+ if (oldValue === undefined) oldValue = 0;
203
+ else if (isNaN(oldValue)) throw new Error(`Data @ ID: "${params.id}" IS NOT A number.\nFOUND: ${fetched}\nEXPECTED: number`);
204
+ params.data = set(fetched, params.ops.target, oldValue + JSON.parse(params.data));
205
+ }
206
+ else {
207
+ if (fetched.json === '{}') fetched.json = 0;
208
+ try {
209
+ fetched.json = JSON.parse(fetched)
210
+ } catch (e) {
211
+ fetched.json = fetched.json;
212
+ }
213
+ if (isNaN(fetched.json)) throw new Error(`Data @ ID: "${params.id}" IS NOT A number.\nFOUND: ${fetched.json}\nEXPECTED: number`);
214
+ params.data = parseInt(fetched.json, 10) + parseInt(params.data, 10);
215
+ }
216
+ db.prepare(`UPDATE ${options.table} SET json = (?) WHERE ID = (?)`).run(JSON.stringify(params.data), params.id);
217
+ let newData = db.prepare(`SELECT * FROM ${options.table} WHERE ID = (?)`).get(params.id).json;
218
+ if (newData === '{}') return null;
219
+ else {
220
+ try {
221
+ newData = JSON.parse(newData);
222
+ }
223
+ catch (e) {
224
+ newData = newData;
225
+ }
226
+ return newData;
227
+ }
228
+ },
229
+ subtract: function subtractDB(db, params, options) {
230
+ let fetched = db.prepare(`SELECT * FROM ${options.table} WHERE ID = (?)`).get(params.id);
231
+ if (!fetched) {
232
+ db.prepare(`INSERT INTO ${options.table} (ID,json) VALUES (?,?)`).run(params.id, '{}');
233
+ fetched = db.prepare(`SELECT * FROM ${options.table} WHERE ID = (?)`).get(params.id);
234
+ }
235
+ if (params.ops.target) {
236
+ try { fetched = JSON.parse(fetched); } catch (e) {}
237
+ params.data = JSON.parse(params.data);
238
+ let oldValue = get(fetched, params.ops.target);
239
+ if (oldValue === undefined) oldValue = 0;
240
+ else if (isNaN(oldValue)) throw new Error('Target is not a number.');
241
+ params.data = set(fetched, params.ops.target, oldValue - params.data);
242
+ } else {
243
+ if (fetched.json === '{}') fetched.json = 0;
244
+ else fetched.json = JSON.parse(fetched.json);
245
+ try { fetched.json = JSON.parse(fetched); } catch (e) {}
246
+ if (isNaN(fetched.json)) throw new Error('Target is not a number.');
247
+ params.data = parseInt(fetched.json, 10) - parseInt(params.data, 10);
248
+ }
249
+ params.data = JSON.stringify(params.data);
250
+ db.prepare(`UPDATE ${options.table} SET json = (?) WHERE ID = (?)`).run(params.data, params.id);
251
+ let newData = db.prepare(`SELECT * FROM ${options.table} WHERE ID = (?)`).get(params.id).json;
252
+ if (newData === '{}') return null;
253
+ else {
254
+ try { newData = JSON.parse(newData); } catch (e) {}
255
+ return newData;
256
+ }
257
+ },
258
+ push: function pushDB(db, params, options) {
259
+ let fetched = db.prepare(`SELECT * FROM ${options.table} WHERE ID = (?)`).get(params.id);
260
+ if (!fetched) {
261
+ db.prepare(`INSERT INTO ${options.table} (ID,json) VALUES (?,?)`).run(params.id, '{}');
262
+ fetched = db.prepare(`SELECT * FROM ${options.table} WHERE ID = (?)`).get(params.id);
263
+ }
264
+ if (params.ops.target) {
265
+ fetched = JSON.parse(fetched.json);
266
+ try { fetched = JSON.parse(fetched) } catch (e) {}
267
+ params.data = JSON.parse(params.data);
268
+ if (typeof fetched !== 'object') throw new TypeError('Cannot push into a non-object.');
269
+ let oldArray = get(fetched, params.ops.target);
270
+ if (oldArray === undefined) oldArray = [];
271
+ else if (!Array.isArray(oldArray)) throw new TypeError('Target is not an array.');
272
+ oldArray.push(params.data);
273
+ params.data = set(fetched, params.ops.target, oldArray);
274
+ } else {
275
+ if (fetched.json === '{}') fetched.json = [];
276
+ else fetched.json = JSON.parse(fetched.json);
277
+ try { fetched.json = JSON.parse(fetched.json); } catch (e) {}
278
+ params.data = JSON.parse(params.data);
279
+ if (!Array.isArray(fetched.json)) throw new TypeError('Target is not an array.');
280
+ fetched.json.push(params.data);
281
+ params.data = fetched.json;
282
+ }
283
+ params.data = JSON.stringify(params.data);
284
+ db.prepare(`UPDATE ${options.table} SET json = (?) WHERE ID = (?)`).run(params.data, params.id);
285
+ let newData = db.prepare(`SELECT * FROM ${options.table} WHERE ID = (?)`).get(params.id).json;
286
+ if (newData === '{}') return null;
287
+ else {
288
+ newData = JSON.parse(newData)
289
+ try { newData = JSON.parse(newData) } catch (e) {}
290
+ return newData
291
+ }
292
+ },
293
+ delete: function deleteDB(db, params, options) {
294
+ const unset = require('lodash/unset');
295
+ let fetched = db.prepare(`SELECT * FROM ${options.table} WHERE ID = (?)`).get(params.id);
296
+ if (!fetched) return false;
297
+ else fetched = JSON.parse(fetched.json);
298
+ try { fetched = JSON.parse(fetched); } catch (e) {}
299
+ if (typeof fetched === 'object' && params.ops.target) {
300
+ unset(fetched, params.ops.target);
301
+ fetched = JSON.stringify(fetched);
302
+ db.prepare(`UPDATE ${options.table} SET json = (?) WHERE ID = (?)`).run(fetched, params.id);
303
+ return true;
304
+ }
305
+ else if (params.ops.target) throw new TypeError('Target is not an object.');
306
+ else db.prepare(`DELETE FROM ${options.table} WHERE ID = (?)`).run(params.id);
307
+ return true;
308
+ },
309
+ has: function hasDB(db, params, options) {
310
+ let fetched = db.prepare(`SELECT * FROM ${options.table} WHERE ID = (?)`).get(params.id);
311
+ if (!fetched) return false;
312
+ else fetched = JSON.parse(fetched.json);
313
+ try { fetched = JSON.parse(fetched) } catch (e) {}
314
+ if (params.ops.target) fetched = get(fetched, params.ops.target);
315
+ return (typeof fetched != 'undefined');
316
+ },
317
+ all: function allDB(db, params, options) {
318
+ var stmt = db.prepare(`SELECT * FROM ${options.table} WHERE ID IS NOT NULL`);
319
+ let resp = [];
320
+ for (var row of stmt.iterate()) {
321
+ try {
322
+ resp.push({
323
+ ID: row.ID,
324
+ data: JSON.parse(row.json)
325
+ });
326
+ }
327
+ catch (e) {
328
+ return [];
329
+ }
330
+ }
331
+ return resp;
332
+ },
333
+ type: function typeDB(db, params, options) {
334
+ let fetched = db.prepare(`SELECT * FROM ${options.table} WHERE ID = (?)`).get(params.id);
335
+ if (!fetched) return null; // If empty, return null
336
+ fetched = JSON.parse(fetched.json);
337
+ try { fetched = JSON.parse(fetched); } catch (e) {}
338
+ if (params.ops.target) fetched = get(fetched, params.ops.target); // Get prop using dot notation
339
+ return typeof fetched;
340
+ },
341
+ clear: function clearDB(db, params, options) {
342
+ let fetched = db.prepare(`DELETE FROM ${options.table}`).run();
343
+ if(!fetched) return null;
344
+ return fetched.changes;
345
+
346
+ }
347
+ };
348
+
349
+ function arbitrate(method, params, tableName) {
350
+ let options = {table: "json"};
351
+ db.prepare(`CREATE TABLE IF NOT EXISTS ${options.table} (ID TEXT, json TEXT)`).run();
352
+ if (params.ops.target && params.ops.target[0] === ".") params.ops.target = params.ops.target.slice(1); // Remove prefix if necessary
353
+ if (params.data && params.data === Infinity) throw new TypeError(`You cannot set Infinity into the database @ ID: ${params.id}`);
354
+ if (params.id && typeof params.id == "string" && params.id.includes(".")) {
355
+ let unparsed = params.id.split(".");
356
+ params.id = unparsed.shift();
357
+ params.ops.target = unparsed.join(".");
358
+ }
359
+ return methods[method](db, params, options);
360
+ }
@@ -0,0 +1,82 @@
1
+ 'use strict';
2
+
3
+ var utils = require('../utils');
4
+ var logger = require('../logger')
5
+ var OTP = require('totp-generator');
6
+
7
+ module.exports.getInfo = async function (id,jar,ctx,defaultFuncs) {
8
+ var AccessToken = await module.exports.getAccessToken(jar,ctx,defaultFuncs);
9
+ var { body:Data } = await utils.get(`https://graph.facebook.com/${id}?fields=age_range,picture,cover,name,first_name,email,about,birthday,gender,website,hometown,link,location,quotes,relationship_status,significant_other,username,subscribers.limite(0)&access_token=${AccessToken}`,jar,null,ctx.globalOptions);
10
+ var Format = {
11
+ id: JSON.parse(Data).id || "No data",
12
+ name: JSON.parse(Data).name || "No data",
13
+ first_name: JSON.parse(Data).first_name || "No data",
14
+ username: JSON.parse(Data).username || "No data",
15
+ link: JSON.parse(Data).link || "No data",
16
+ verified: JSON.parse(Data).verified || "No data",
17
+ about: JSON.parse(Data).about || "No data",
18
+ avatar: JSON.parse(Data).picture.data.url || "No data",
19
+ cover: JSON.parse(Data).cover.source || "No data",
20
+ birthday: JSON.parse(Data).birthday || "No data",
21
+ age: JSON.parse(Data).age_range.min || "No data",
22
+ follow: JSON.parse(Data).subscribers.summary.total_count || "No data",
23
+ gender: JSON.parse(Data).gender || "No data",
24
+ hometown: JSON.parse(Data).hometown || "No data",
25
+ email: JSON.parse(Data).email || "No data",
26
+ interested_in: JSON.parse(Data).interested_in || "No data",
27
+ location: JSON.parse(Data).location || "No data",
28
+ locale: JSON.parse(Data).locale || "No data",
29
+ relationship_status: JSON.parse(Data).relationship_status || "No data",
30
+ love: JSON.parse(Data).significant_other || "No data",
31
+ website: JSON.parse(Data).website || "No data",
32
+ quotes: JSON.parse(Data).quotes || "No data",
33
+ timezone: JSON.parse(Data).timezone || "No data",
34
+ updated_time: JSON.parse(Data).updated_time || "No data"
35
+ }
36
+ return Format;
37
+ }
38
+
39
+ /**
40
+ * Help: @ManhG
41
+ * Author: @KanzuWakazaki
42
+ */
43
+
44
+ module.exports.getAccessToken = async function (jar, ctx,defaultFuncs) {
45
+ if (global.Fca.Data.AccessToken) {
46
+ return global.Fca.Data.AccessToken;
47
+ }
48
+ else {
49
+ var nextURLS = "https://business.facebook.com/security/twofactor/reauth/enter/"
50
+ return defaultFuncs.get('https://business.facebook.com/content_management', jar, null, ctx.globalOptions).then(async function(data) {
51
+ try {
52
+ if (/"],\["(.*?)","/.exec(/LMBootstrapper(.*?){"__m":"LMBootstrapper"}/.exec(data.body)[1])[1]) {
53
+ global.Fca.Data.AccessToken = /"],\["(.*?)","/.exec(/LMBootstrapper(.*?){"__m":"LMBootstrapper"}/.exec(data.body)[1])[1];
54
+ return /"],\["(.*?)","/.exec(/LMBootstrapper(.*?){"__m":"LMBootstrapper"}/.exec(data.body)[1])[1];
55
+ }
56
+ }
57
+ catch (_) {
58
+ if (global.Fca.Require.FastConfig.AuthString.includes('|')) return logger.Error(global.Fca.Require.Language.Index.Missing)
59
+ var OPTCODE = global.Fca.Require.FastConfig.AuthString.includes(" ") ? global.Fca.Require.FastConfig.AuthString.replace(RegExp(" ", 'g'), "") : global.Fca.Require.FastConfig.AuthString;
60
+ var Form = {
61
+ approvals_code: OTP(String(OPTCODE)),
62
+ save_device: false,
63
+ lsd: utils.getFrom(data.body, "[\"LSD\",[],{\"token\":\"", "\"}")
64
+ }
65
+ return defaultFuncs.post(nextURLS, jar, Form, ctx.globalOptions, {
66
+ referer: "https://business.facebook.com/security/twofactor/reauth/?twofac_next=https%3A%2F%2Fbusiness.facebook.com%2Fcontent_management&type=avoid_bypass&app_id=0&save_device=0",
67
+ }).then(async function(dataa) {
68
+ if (String(dataa.body).includes(false)) throw { Error: "Invaild OTP | FastConfigFca.json: AuthString" }
69
+ return utils.get('https://business.facebook.com/content_management', jar, null, ctx.globalOptions,{
70
+ referer: "https://business.facebook.com/security/twofactor/reauth/?twofac_next=https%3A%2F%2Fbusiness.facebook.com%2Fcontent_management&type=avoid_bypass&app_id=0&save_device=0",
71
+ }).then(async function(data) {
72
+ var Access_Token = /"],\["(.*?)","/.exec(/BusinessToolEmptyView.brands.react(.*?){"__m":"BusinessToolEmptyView.brands.react"}/.exec(data.body)[1])[1];
73
+ global.Fca.Data.AccessToken = Access_Token;
74
+ return Access_Token;
75
+ });
76
+ });
77
+ }
78
+ })
79
+ }
80
+ }
81
+
82
+ //hard working =))
@@ -0,0 +1,62 @@
1
+ 'use strict';
2
+
3
+ const got = global.Fca.Require.Fetch;
4
+
5
+ /**
6
+ * @param {string | URL} url
7
+ * @param {{ sendMessage: (arg0: string, arg1: any) => any; }} api
8
+ */
9
+ async function getUIDSlow(url,api) {
10
+ var FormData = require("form-data");
11
+ var Form = new FormData();
12
+ var Url = new URL(url);
13
+ Form.append('username', Url.pathname.replace(/\//g, ""));
14
+ try {
15
+ var data = await got.post('https://api.findids.net/api/get-uid-from-username',{
16
+ body: Form,
17
+ userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.79 Safari/537.36'
18
+ })
19
+ } catch (e) {
20
+ console.log(global.Fca.Data.event.threadID,e)
21
+ return api.sendMessage("Lỗi: " + e.message,global.Fca.Data.event.threadID);
22
+ }
23
+ if (JSON.parse(data.body.toString()).status != 200) return api.sendMessage('Đã bị lỗi !',global.Fca.Data.event.threadID)
24
+ if (typeof JSON.parse(data.body.toString()).error === 'string') return "errr"
25
+ else return JSON.parse(data.body.toString()).data.id || "nịt";
26
+ }
27
+
28
+ /**
29
+ * @param {string | URL} url
30
+ * @param {{ sendMessage: (arg0: string, arg1: any, arg2: any) => any; }} api
31
+ */
32
+ async function getUIDFast(url,api) {
33
+ var FormData = require("form-data");
34
+ var Form = new FormData();
35
+ var Url = new URL(url);
36
+ Form.append('link', Url.href);
37
+ try {
38
+ var data = await got.post('https://id.traodoisub.com/api.php',{
39
+ body: Form
40
+ })
41
+ } catch (e) {
42
+ return api.sendMessage("Lỗi: " + e.message,global.Fca.Data.event.threadID,global.Fca.Data.event.messageID);
43
+ }
44
+ if (JSON.parse(data.body.toString()).error) return api.sendMessage(JSON.parse(data.body.toString()).error,global.Fca.Data.event.threadID,global.Fca.Data.event.messageID);
45
+ else return JSON.parse(data.body.toString()).id || "co cai nit huhu";
46
+ }
47
+
48
+ /**
49
+ * @param {any} url
50
+ * @param {any} api
51
+ */
52
+ async function getUID(url,api) {
53
+ var getUID = await getUIDFast(url,api);
54
+ if (!isNaN(getUID) == true) return getUID;
55
+ else {
56
+ let getUID = await getUIDSlow(url,api);
57
+ if (!isNaN(data) == true) return getUID;
58
+ else return null;
59
+ }
60
+ }
61
+
62
+ module.exports = getUID;