gj-boomlings-api 1.3.1 → 1.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,13 +1,14 @@
1
1
  <div align="center">
2
- <a href="https://www.npmjs.com/package/gj-boomlings-api"><img src="https://shikoshib.github.io/font1.png" width="600"></a><hr>
2
+ <h1>
3
+ <a href="https://www.npmjs.com/package/gj-boomlings-api"><img src="https://shikoshib.github.io/font1.png" width="576"></a>
4
+ </h1>
5
+ A light-weight Geometry Dash API wrapper<br><br>
3
6
  <a href="https://www.npmjs.com/package/gj-boomlings-api"><img src="https://img.shields.io/npm/v/gj-boomlings-api.svg?maxAge=3600" alt="npm version" /></a>
4
- <a href="https://www.npmjs.com/package/gj-boomlings-api"><img src="https://img.shields.io/npm/dm/gj-boomlings-api.svg?maxAge=2592000" /></a>
7
+ <a href="https://www.npmjs.com/package/gj-boomlings-api"><img src="https://img.shields.io/npm/dt/gj-boomlings-api" /></a>
5
8
  <a href="https://snyk.io/test/github/shikoshib/gj-boomlings-api"><img src="https://snyk.io/test/github/shikoshib/gj-boomlings-api/badge.svg" alt="Known Vulnerabilities" /></a>
6
9
  <a href="https://packagequality.com/#?package=gj-boomlings-api"><img src="https://packagequality.com/shield/gj-boomlings-api.svg"/></a>
7
10
  </div>
8
11
 
9
- This package gets info from RobTop's servers (boomlings.com) and converts it into pure and beautiful JSON.
10
-
11
12
  ## Functions
12
13
 
13
14
  ### dlLevel(id)
@@ -30,11 +31,11 @@ Returns:
30
31
  level_version: 3,
31
32
  difficulty: 'Extreme Demon',
32
33
  stars: 10,
33
- downloads: 18914789,
34
- likes: 697155,
34
+ downloads: 19055472,
35
+ likes: 701448,
35
36
  disliked: false,
36
37
  length: 'XL',
37
- password: '121296',
38
+ password: '21296',
38
39
  demon: true,
39
40
  featured: true,
40
41
  epic: true,
@@ -45,6 +46,7 @@ Returns:
45
46
  game_version: '2.1',
46
47
  ldm: false,
47
48
  copied: 25066306,
49
+ large: true,
48
50
  two_p: false,
49
51
  coins: 0,
50
52
  verified_coins: false,
@@ -56,8 +58,8 @@ Returns:
56
58
  fileSize: '9.56 MB',
57
59
  link: 'https://geometrydashcontent.b-cdn.net/songs/467339.mp3'
58
60
  },
59
- pointercrate: {
60
- position: 49,
61
+ pointercrate: {
62
+ position: 50,
61
63
  publisher: 'knobbelboy',
62
64
  verifier: 'knobbelboy'
63
65
  }
@@ -79,9 +81,11 @@ Returns:
79
81
  username: 'RobTop',
80
82
  playerID: 16,
81
83
  accountID: 71,
82
- rank: 219796,
83
- stars: 2375,
84
- diamonds: 2170,
84
+ rank: 220553,
85
+ color1: '#7D00FF',
86
+ color2: '#00FFFF',
87
+ stars: 2389,
88
+ diamonds: 2169,
85
89
  secretCoins: 3,
86
90
  userCoins: 140,
87
91
  demons: 5,
@@ -1,5 +1,12 @@
1
1
  module.exports = {
2
2
  blockUser:
3
+ /**
4
+ * Blocks the user.
5
+ *
6
+ * @param {string} target - The target's player ID or username.
7
+ * @param {string} username - The blocking person's player ID or username.
8
+ * @param {string} password - The blocking person's password.
9
+ */
3
10
  async function(target, username, password) {
4
11
  if(!target || target == "") throw new Error("Please provide a target's player ID or username!");
5
12
  if(!username || username == "") throw new Error("Please provide your player ID or username!");
@@ -9,7 +16,7 @@ module.exports = {
9
16
  const {headers, server} = require("../config.json");
10
17
 
11
18
  let user = await searchUsers(username);
12
- let targetObj = await searchUsers(username);
19
+ let targetObj = await searchUsers(target);
13
20
 
14
21
  const {gjp} = require("../misc/gjp.js");
15
22
 
@@ -1,5 +1,12 @@
1
1
  module.exports = {
2
2
  deleteAccountPost:
3
+ /**
4
+ * Deletes the account post.
5
+ *
6
+ * @param {number} id - The account post ID (returned by `uploadAccountPost()` function).
7
+ * @param {string} str - The deleting person's player ID or username.
8
+ * @param {string} password - The deleting person's password.
9
+ */
3
10
  async function(id, str, password) {
4
11
  if(!id || id == "") throw new Error("Please provide an account post ID!");
5
12
  if(!str || str == "") throw new Error("Please provide a user ID or name!");
@@ -30,6 +37,8 @@ module.exports = {
30
37
  throw new Error(e.response.data);
31
38
  })
32
39
 
40
+ if(res.data == -1) throw new Error(-1);
41
+
33
42
  return 1;
34
43
  }
35
44
  }
@@ -1,5 +1,13 @@
1
1
  module.exports = {
2
2
  deleteComment:
3
+ /**
4
+ * Deletes the comment.
5
+ *
6
+ * @param {number} id - The comment ID (returned by `uploadComment()` function).
7
+ * @param {number} lvl - The ID of a level the comment is posted on.
8
+ * @param {string} str - The deleting person's player ID or username.
9
+ * @param {string} password - The deleting person's password.
10
+ */
3
11
  async function(id, lvl, str, password) {
4
12
  if(!id || id == "") throw new Error("Please provide a comment ID!");
5
13
  if(!lvl || lvl == "") throw new Error("Please provide a level ID!");
@@ -29,6 +37,8 @@ module.exports = {
29
37
  throw new Error(e.response.data);
30
38
  })
31
39
 
40
+ if(res.data == -1) throw new Error(-1);
41
+
32
42
  return 1;
33
43
  }
34
44
  }
@@ -1,5 +1,10 @@
1
1
  module.exports = {
2
2
  dlLevel:
3
+ /**
4
+ * Downloads the level by its ID.
5
+ *
6
+ * @param {number} level - The level ID.
7
+ */
3
8
  async function(level) {
4
9
  const {decB64} = require("../misc/decB64.js");
5
10
  const zlib = require("zlib");
@@ -23,10 +28,11 @@ module.exports = {
23
28
  let res = await axios.post(server + 'downloadGJLevel22.php', data, {
24
29
  headers: headers
25
30
  }).catch(e => {
26
- if(e.response.data == -1) throw new Error("-1 This user is not found.");
27
31
  throw new Error(e.response.data);
28
32
  })
29
33
 
34
+ if(res.data == -1) throw new Error("-1 This level is not found.");
35
+
30
36
  let spl = res.data.split(":");
31
37
  let levelInfo = [];
32
38
  for(let i =0;i<spl.length;i++) {
@@ -48,6 +54,7 @@ module.exports = {
48
54
  let stars = levelInfo[15].split("18:")[1];
49
55
  let ftrd = levelInfo[16].split("19:")[1];
50
56
  let epic = levelInfo[17].split("42:")[1];
57
+ let objs = levelInfo[18].split("45:")[1];
51
58
  let length = levelInfo[19].split("15:")[1];
52
59
  let copiedID = levelInfo[20].split("30:")[1];
53
60
  let twoPlayer = levelInfo[21].split("31:")[1];
@@ -161,13 +168,14 @@ module.exports = {
161
168
  game_version: decodeGameVersion[gameVersion],
162
169
  ldm: demonBoolDecoding[ldm],
163
170
  copied: Number(copiedID),
171
+ large: Number(objs) > 40000 ? true : false,
164
172
  two_p: demonBoolDecoding[twoPlayer],
165
173
  coins: Number(coins),
166
174
  verified_coins: verifiedCoins,
167
175
  song: getLvl.song,
168
176
  }
169
177
 
170
- if(getLvl.pointercrate != undefined) {
178
+ if(getLvl.pointercrate != undefined && server.includes("boomlings.com/database")) {
171
179
  result = {
172
180
  id: Number(id),
173
181
  name: name,
@@ -191,6 +199,7 @@ module.exports = {
191
199
  game_version: decodeGameVersion[gameVersion],
192
200
  ldm: demonBoolDecoding[ldm],
193
201
  copied: Number(copiedID),
202
+ large: Number(objs) > 40000 ? true : false,
194
203
  two_p: demonBoolDecoding[twoPlayer],
195
204
  coins: Number(coins),
196
205
  verified_coins: verifiedCoins,
@@ -27,6 +27,8 @@ module.exports = {
27
27
  throw new Error(e.response.data)
28
28
  })
29
29
 
30
+ if(res.data == -1) throw new Error(-1);
31
+
30
32
  return decMessage(res.data);
31
33
  }
32
34
  }
@@ -7,7 +7,7 @@ module.exports = {
7
7
  const {decCommentFromHistory} = require("../misc/decCommentFromHistory.js");
8
8
  const {getProfile} = require("./getProfile.js");
9
9
 
10
- const user = await getProfile(id);
10
+ const user = await getProfile(str);
11
11
  if(user.commentHistory != "all") throw new Error("Whoops! This user has disabled viewing his comment history!")
12
12
 
13
13
  const CHData = {
@@ -15,7 +15,7 @@ module.exports = {
15
15
  binaryVersion: 35,
16
16
  gdw: 0,
17
17
  secret: "Wmfd2893gb7",
18
- userID: id,
18
+ userID: user.playerID,
19
19
  page: page - 1,
20
20
  mode: 1
21
21
  }
@@ -23,9 +23,10 @@ module.exports = {
23
23
  let res = await axios.post(server + "getGJCommentHistory.php", CHData, {
24
24
  headers: headers
25
25
  }).catch(e => {
26
- if(e.response.data == -1) throw new Error("-1 Not found.");
27
26
  throw new Error(e.response.data);
28
27
  })
28
+
29
+ if(res.data == -1) throw new Error("-1 Not found.");
29
30
 
30
31
  let comments = res.data.split("|");
31
32
  let result = [];
@@ -20,9 +20,10 @@ module.exports = {
20
20
  let res = await axios.post(server + "getGJComments21.php", data, {
21
21
  headers: headers
22
22
  }).catch(e => {
23
- if(e.response.data == -1) throw new Error("-1 This user is not found.");
24
23
  throw new Error(e.response.data);
25
24
  })
25
+
26
+ if(res.data.startsWith("#")) throw new Error("-1 No comments have been found.");
26
27
 
27
28
  let comments = res.data.split("|");
28
29
  let result = [];
@@ -20,10 +20,11 @@ module.exports = {
20
20
  let res = await axios.post(server + "getGJLevels21.php", data, {
21
21
  headers: headers
22
22
  }).catch(e => {
23
- if(e.response.data == -1) throw new Error("-1 Not found.");
24
23
  throw new Error(e.response.data);
25
24
  })
26
25
 
26
+ if(res.data == -1) throw new Error("-1 Not found.");
27
+
27
28
  return await decodeLevel(res.data);
28
29
  }
29
30
  }
@@ -13,10 +13,11 @@ module.exports = {
13
13
  let res = await axios.post(server + "getGJMapPacks21.php", data, {
14
14
  headers: headers
15
15
  }).catch(e => {
16
- if(e.response.data == -1) throw new Error("-1 Not found.");
17
16
  throw new Error(e.response.data);
18
17
  })
19
18
 
19
+ if(res.data.startsWith("#")) throw new Error("-1 Not found.");
20
+
20
21
  let packs = res.data.split("|");
21
22
  let result = [];
22
23
  packs.forEach(p => {
@@ -26,6 +26,8 @@ module.exports = {
26
26
  throw new Error(e.response.data)
27
27
  })
28
28
 
29
+ if(res.data == -1) throw new Error(-1);
30
+
29
31
  let msgs = res.data.split("|");
30
32
  let result = [];
31
33
  msgs.forEach(m => {
@@ -19,10 +19,11 @@ module.exports = {
19
19
  let res = await axios.post(server + "getGJUserInfo20.php", data, {
20
20
  headers: headers
21
21
  }).catch(e => {
22
- if(e.response.data == -1) throw new Error("-1 This user is not found.");
23
22
  throw new Error(e.response.data);
24
23
  })
25
24
 
25
+ if(res.data == -1) throw new Error("-1 This user is not found.");
26
+
26
27
  let spl = res.data.split(':');
27
28
  let userInfo = [];
28
29
  for(let i =0;i<spl.length;i++) {
@@ -51,7 +52,7 @@ module.exports = {
51
52
  let twitch = userInfo[27].split("45:")[1];
52
53
  let modState = userInfo[28].split("49:")[1];
53
54
 
54
- let ytLnk = `htps://youtube.com/channel/${youtube}`;
55
+ let ytLnk = `https://youtube.com/channel/${youtube}`;
55
56
  let twitterLnk = `https://twitter.com/${twitter}`;
56
57
  let twitchLnk = `https://twitch.tv/${twitch}`;
57
58
 
@@ -13,11 +13,10 @@ module.exports = {
13
13
 
14
14
  let res = await axios.post(server + 'getGJSongInfo.php', data, {
15
15
  headers: headers
16
- }).catch(e => {
17
- if(e.response.data == -2) throw new Error(`-2. Couldn't find a song with ID ${song}.`)
18
- throw new Error(e.response.data);
19
16
  })
20
17
 
18
+ if(res.data == -2) throw new Error(`-2. Couldn't find a song with ID ${song}.`)
19
+
21
20
  const result = {
22
21
  "name": res.data.split("|~2~|~")[1].split("~|~3~|~")[0],
23
22
  "id": Number(res.data.split("1~|~")[1].split("~|~2~|")[0]),
@@ -5,11 +5,14 @@ module.exports = {
5
5
 
6
6
  const axios = require("axios");
7
7
  const { headers, secret, server } = require("../config.json");
8
- const { getLevelByID } = require("../functions/getLevelByID.js");
8
+ const { getLevelByID } = require("./getLevelByID.js");
9
+ const { searchUsers } = require("./searchUsers.js");
10
+
11
+ let user = await searchUsers(str);
9
12
 
10
13
  const data = {
11
14
  type: 5,
12
- str: id,
15
+ str: user.playerID,
13
16
  secret: secret,
14
17
  page: Number(page) - 1
15
18
  }
@@ -20,154 +23,11 @@ module.exports = {
20
23
  throw new Error(e.response.data);
21
24
  })
22
25
 
23
- let firstLvlId = res.data.split(":")[1].split(":2:")[0];
24
- let secondLvlId;
25
- let thirdLvlId;
26
- let fourthLvlId;
27
- let fifthLvlId;
28
- let sixthLvlId;
29
- let seventhLvlId;
30
- let eighthLvlId;
31
- let ninthLvlId;
32
- let tenthLvlId;
33
-
34
- let firstLvl = await getLevelByID(firstLvlId);
35
- let secondLvl;
36
- let thirdLvl;
37
- let fourthLvl;
38
- let fifthLvl;
39
- let sixthLvl;
40
- let seventhLvl;
41
- let eighthLvl;
42
- let ninthLvl;
43
- let tenthLvl;
44
-
45
- let result = [firstLvl]
46
-
47
- if(res.data.split("|1:").length - 1 == 1) {
48
- secondLvlId = res.data.split("|1:")[1].split(":2:")[0];
49
- secondLvl = await getLevelByID(secondLvlId);
50
- result = [firstLvl,secondLvl]
51
- }
52
-
53
- if(res.data.split("|1:").length - 1 == 2) {
54
- secondLvlId = res.data.split("|1:")[1].split(":2:")[0];
55
- secondLvl = await getLevelByID(secondLvlId);
56
- thirdLvlId = res.data.split("|1:")[2].split(":2:")[0];
57
- thirdLvl = await getLevelByID(thirdLvlId);
58
- result = [firstLvl,secondLvl,thirdLvl]
59
- }
60
-
61
- if(res.data.split("|1:").length - 1 == 3) {
62
- secondLvlId = res.data.split("|1:")[1].split(":2:")[0];
63
- secondLvl = await getLevelByID(secondLvlId);
64
- thirdLvlId = res.data.split("|1:")[2].split(":2:")[0];
65
- thirdLvl = await getLevelByID(thirdLvlId);
66
- fourthLvlId = res.data.split("|1:")[3].split(":2:")[0];
67
- fourthLvl = await getLevelByID(fourthLvlId);
68
- result = [firstLvl,secondLvl,thirdLvl,fourthLvl]
69
- }
70
-
71
- if(res.data.split("|1:").length - 1 == 4) {
72
- secondLvlId = res.data.split("|1:")[1].split(":2:")[0];
73
- secondLvl = await getLevelByID(secondLvlId);
74
- thirdLvlId = res.data.split("|1:")[2].split(":2:")[0];
75
- thirdLvl = await getLevelByID(thirdLvlId);
76
- fourthLvlId = res.data.split("|1:")[3].split(":2:")[0];
77
- fourthLvl = await getLevelByID(fourthLvlId);
78
- fifthLvlId = res.data.split("|1:")[4].split(":2:")[0];
79
- fifthLvl = await getLevelByID(fifthLvlId);
80
- result = [firstLvl,secondLvl,thirdLvl,fourthLvl,fifthLvl]
81
- }
82
-
83
- if(res.data.split("|1:").length - 1 == 5) {
84
- secondLvlId = res.data.split("|1:")[1].split(":2:")[0];
85
- secondLvl = await getLevelByID(secondLvlId);
86
- thirdLvlId = res.data.split("|1:")[2].split(":2:")[0];
87
- thirdLvl = await getLevelByID(thirdLvlId);
88
- fourthLvlId = res.data.split("|1:")[3].split(":2:")[0];
89
- fourthLvl = await getLevelByID(fourthLvlId);
90
- fifthLvlId = res.data.split("|1:")[4].split(":2:")[0];
91
- fifthLvl = await getLevelByID(fifthLvlId);
92
- sixthLvlId = res.data.split("|1:")[5].split(":2:")[0];
93
- sixthLvl = await getLevelByID(sixthLvlId);
94
- result = [firstLvl,secondLvl,thirdLvl,fourthLvl,fifthLvl,sixthLvl]
95
- }
96
-
97
- if(res.data.split("|1:").length - 1 == 6) {
98
- secondLvlId = res.data.split("|1:")[1].split(":2:")[0];
99
- secondLvl = await getLevelByID(secondLvlId);
100
- thirdLvlId = res.data.split("|1:")[2].split(":2:")[0];
101
- thirdLvl = await getLevelByID(thirdLvlId);
102
- fourthLvlId = res.data.split("|1:")[3].split(":2:")[0];
103
- fourthLvl = await getLevelByID(fourthLvlId);
104
- fifthLvlId = res.data.split("|1:")[4].split(":2:")[0];
105
- fifthLvl = await getLevelByID(fifthLvlId);
106
- sixthLvlId = res.data.split("|1:")[5].split(":2:")[0];
107
- sixthLvl = await getLevelByID(sixthLvlId);
108
- seventhLvlId = res.data.split("|1:")[6].split(":2:")[0];
109
- seventhLvl = await getLevelByID(seventhLvlId);
110
- result = [firstLvl,secondLvl,thirdLvl,fourthLvl,fifthLvl,sixthLvl,seventhLvl]
111
- }
112
-
113
- if(res.data.split("|1:").length - 1 == 7) {
114
- secondLvlId = res.data.split("|1:")[1].split(":2:")[0];
115
- secondLvl = await getLevelByID(secondLvlId);
116
- thirdLvlId = res.data.split("|1:")[2].split(":2:")[0];
117
- thirdLvl = await getLevelByID(thirdLvlId);
118
- fourthLvlId = res.data.split("|1:")[3].split(":2:")[0];
119
- fourthLvl = await getLevelByID(fourthLvlId);
120
- fifthLvlId = res.data.split("|1:")[4].split(":2:")[0];
121
- fifthLvl = await getLevelByID(fifthLvlId);
122
- sixthLvlId = res.data.split("|1:")[5].split(":2:")[0];
123
- sixthLvl = await getLevelByID(sixthLvlId);
124
- seventhLvlId = res.data.split("|1:")[6].split(":2:")[0];
125
- seventhLvl = await getLevelByID(seventhLvlId);
126
- eighthLvlId = res.data.split("|1:")[7].split(":2:")[0];
127
- eighthLvl = await getLevelByID(eighthLvlId);
128
- result = [firstLvl,secondLvl,thirdLvl,fourthLvl,fifthLvl,sixthLvl,seventhLvl,eighthLvl]
129
- }
130
-
131
- if(res.data.split("|1:").length - 1 == 8) {
132
- secondLvlId = res.data.split("|1:")[1].split(":2:")[0];
133
- secondLvl = await getLevelByID(secondLvlId);
134
- thirdLvlId = res.data.split("|1:")[2].split(":2:")[0];
135
- thirdLvl = await getLevelByID(thirdLvlId);
136
- fourthLvlId = res.data.split("|1:")[3].split(":2:")[0];
137
- fourthLvl = await getLevelByID(fourthLvlId);
138
- fifthLvlId = res.data.split("|1:")[4].split(":2:")[0];
139
- fifthLvl = await getLevelByID(fifthLvlId);
140
- sixthLvlId = res.data.split("|1:")[5].split(":2:")[0];
141
- sixthLvl = await getLevelByID(sixthLvlId);
142
- seventhLvlId = res.data.split("|1:")[6].split(":2:")[0];
143
- seventhLvl = await getLevelByID(seventhLvlId);
144
- eighthLvlId = res.data.split("|1:")[7].split(":2:")[0];
145
- eighthLvl = await getLevelByID(eighthLvlId);
146
- ninthLvlId = res.data.split("|1:")[8].split(":2:")[0];
147
- ninthLvl = await getLevelByID(ninthLvlId);
148
- result = [firstLvl,secondLvl,thirdLvl,fourthLvl,fifthLvl,sixthLvl,seventhLvl,eighthLvl,ninthLvl]
149
- }
150
-
151
- if(res.data.split("|1:").length - 1 == 9) {
152
- secondLvlId = res.data.split("|1:")[1].split(":2:")[0];
153
- secondLvl = await getLevelByID(secondLvlId);
154
- thirdLvlId = res.data.split("|1:")[2].split(":2:")[0];
155
- thirdLvl = await getLevelByID(thirdLvlId);
156
- fourthLvlId = res.data.split("|1:")[3].split(":2:")[0];
157
- fourthLvl = await getLevelByID(fourthLvlId);
158
- fifthLvlId = res.data.split("|1:")[4].split(":2:")[0];
159
- fifthLvl = await getLevelByID(fifthLvlId);
160
- sixthLvlId = res.data.split("|1:")[5].split(":2:")[0];
161
- sixthLvl = await getLevelByID(sixthLvlId);
162
- seventhLvlId = res.data.split("|1:")[6].split(":2:")[0];
163
- seventhLvl = await getLevelByID(seventhLvlId);
164
- eighthLvlId = res.data.split("|1:")[7].split(":2:")[0];
165
- eighthLvl = await getLevelByID(eighthLvlId);
166
- ninthLvlId = res.data.split("|1:")[8].split(":2:")[0];
167
- ninthLvl = await getLevelByID(ninthLvlId);
168
- tenthLvlId = res.data.split("|1:")[9].split(":2:")[0];
169
- tenthLvl = await getLevelByID(tenthLvlId);
170
- result = [firstLvl,secondLvl,thirdLvl,fourthLvl,fifthLvl,sixthLvl,seventhLvl,eighthLvl,ninthLvl,tenthLvl]
26
+ let levels = res.data.split("#")[0].split("|");
27
+ let result = [];
28
+ for(const lvl of levels) {
29
+ let id = lvl.split(":")[1];
30
+ result.push(await getLevelByID(id))
171
31
  }
172
32
 
173
33
  return result;
@@ -18,155 +18,12 @@ module.exports = {
18
18
  }).catch(e => {
19
19
  throw new Error(e.response.data);
20
20
  })
21
-
22
- let firstLvlId = res.data.split(":")[1].split(":2:")[0];
23
- let secondLvlId;
24
- let thirdLvlId;
25
- let fourthLvlId;
26
- let fifthLvlId;
27
- let sixthLvlId;
28
- let seventhLvlId;
29
- let eighthLvlId;
30
- let ninthLvlId;
31
- let tenthLvlId;
32
-
33
- let firstLvl = await getLevelByID(firstLvlId);
34
- let secondLvl;
35
- let thirdLvl;
36
- let fourthLvl;
37
- let fifthLvl;
38
- let sixthLvl;
39
- let seventhLvl;
40
- let eighthLvl;
41
- let ninthLvl;
42
- let tenthLvl;
43
-
44
- let result = [firstLvl]
45
-
46
- if(res.data.split("|1:").length - 1 == 1) {
47
- secondLvlId = res.data.split("|1:")[1].split(":2:")[0];
48
- secondLvl = await getLevelByID(secondLvlId);
49
- result = [firstLvl,secondLvl]
50
- }
51
-
52
- if(res.data.split("|1:").length - 1 == 2) {
53
- secondLvlId = res.data.split("|1:")[1].split(":2:")[0];
54
- secondLvl = await getLevelByID(secondLvlId);
55
- thirdLvlId = res.data.split("|1:")[2].split(":2:")[0];
56
- thirdLvl = await getLevelByID(thirdLvlId);
57
- result = [firstLvl,secondLvl,thirdLvl]
58
- }
59
-
60
- if(res.data.split("|1:").length - 1 == 3) {
61
- secondLvlId = res.data.split("|1:")[1].split(":2:")[0];
62
- secondLvl = await getLevelByID(secondLvlId);
63
- thirdLvlId = res.data.split("|1:")[2].split(":2:")[0];
64
- thirdLvl = await getLevelByID(thirdLvlId);
65
- fourthLvlId = res.data.split("|1:")[3].split(":2:")[0];
66
- fourthLvl = await getLevelByID(fourthLvlId);
67
- result = [firstLvl,secondLvl,thirdLvl,fourthLvl]
68
- }
69
-
70
- if(res.data.split("|1:").length - 1 == 4) {
71
- secondLvlId = res.data.split("|1:")[1].split(":2:")[0];
72
- secondLvl = await getLevelByID(secondLvlId);
73
- thirdLvlId = res.data.split("|1:")[2].split(":2:")[0];
74
- thirdLvl = await getLevelByID(thirdLvlId);
75
- fourthLvlId = res.data.split("|1:")[3].split(":2:")[0];
76
- fourthLvl = await getLevelByID(fourthLvlId);
77
- fifthLvlId = res.data.split("|1:")[4].split(":2:")[0];
78
- fifthLvl = await getLevelByID(fifthLvlId);
79
- result = [firstLvl,secondLvl,thirdLvl,fourthLvl,fifthLvl]
80
- }
81
-
82
- if(res.data.split("|1:").length - 1 == 5) {
83
- secondLvlId = res.data.split("|1:")[1].split(":2:")[0];
84
- secondLvl = await getLevelByID(secondLvlId);
85
- thirdLvlId = res.data.split("|1:")[2].split(":2:")[0];
86
- thirdLvl = await getLevelByID(thirdLvlId);
87
- fourthLvlId = res.data.split("|1:")[3].split(":2:")[0];
88
- fourthLvl = await getLevelByID(fourthLvlId);
89
- fifthLvlId = res.data.split("|1:")[4].split(":2:")[0];
90
- fifthLvl = await getLevelByID(fifthLvlId);
91
- sixthLvlId = res.data.split("|1:")[5].split(":2:")[0];
92
- sixthLvl = await getLevelByID(sixthLvlId);
93
- result = [firstLvl,secondLvl,thirdLvl,fourthLvl,fifthLvl,sixthLvl]
94
- }
95
-
96
- if(res.data.split("|1:").length - 1 == 6) {
97
- secondLvlId = res.data.split("|1:")[1].split(":2:")[0];
98
- secondLvl = await getLevelByID(secondLvlId);
99
- thirdLvlId = res.data.split("|1:")[2].split(":2:")[0];
100
- thirdLvl = await getLevelByID(thirdLvlId);
101
- fourthLvlId = res.data.split("|1:")[3].split(":2:")[0];
102
- fourthLvl = await getLevelByID(fourthLvlId);
103
- fifthLvlId = res.data.split("|1:")[4].split(":2:")[0];
104
- fifthLvl = await getLevelByID(fifthLvlId);
105
- sixthLvlId = res.data.split("|1:")[5].split(":2:")[0];
106
- sixthLvl = await getLevelByID(sixthLvlId);
107
- seventhLvlId = res.data.split("|1:")[6].split(":2:")[0];
108
- seventhLvl = await getLevelByID(seventhLvlId);
109
- result = [firstLvl,secondLvl,thirdLvl,fourthLvl,fifthLvl,sixthLvl,seventhLvl]
110
- }
111
-
112
- if(res.data.split("|1:").length - 1 == 7) {
113
- secondLvlId = res.data.split("|1:")[1].split(":2:")[0];
114
- secondLvl = await getLevelByID(secondLvlId);
115
- thirdLvlId = res.data.split("|1:")[2].split(":2:")[0];
116
- thirdLvl = await getLevelByID(thirdLvlId);
117
- fourthLvlId = res.data.split("|1:")[3].split(":2:")[0];
118
- fourthLvl = await getLevelByID(fourthLvlId);
119
- fifthLvlId = res.data.split("|1:")[4].split(":2:")[0];
120
- fifthLvl = await getLevelByID(fifthLvlId);
121
- sixthLvlId = res.data.split("|1:")[5].split(":2:")[0];
122
- sixthLvl = await getLevelByID(sixthLvlId);
123
- seventhLvlId = res.data.split("|1:")[6].split(":2:")[0];
124
- seventhLvl = await getLevelByID(seventhLvlId);
125
- eighthLvlId = res.data.split("|1:")[7].split(":2:")[0];
126
- eighthLvl = await getLevelByID(eighthLvlId);
127
- result = [firstLvl,secondLvl,thirdLvl,fourthLvl,fifthLvl,sixthLvl,seventhLvl,eighthLvl]
128
- }
129
-
130
- if(res.data.split("|1:").length - 1 == 8) {
131
- secondLvlId = res.data.split("|1:")[1].split(":2:")[0];
132
- secondLvl = await getLevelByID(secondLvlId);
133
- thirdLvlId = res.data.split("|1:")[2].split(":2:")[0];
134
- thirdLvl = await getLevelByID(thirdLvlId);
135
- fourthLvlId = res.data.split("|1:")[3].split(":2:")[0];
136
- fourthLvl = await getLevelByID(fourthLvlId);
137
- fifthLvlId = res.data.split("|1:")[4].split(":2:")[0];
138
- fifthLvl = await getLevelByID(fifthLvlId);
139
- sixthLvlId = res.data.split("|1:")[5].split(":2:")[0];
140
- sixthLvl = await getLevelByID(sixthLvlId);
141
- seventhLvlId = res.data.split("|1:")[6].split(":2:")[0];
142
- seventhLvl = await getLevelByID(seventhLvlId);
143
- eighthLvlId = res.data.split("|1:")[7].split(":2:")[0];
144
- eighthLvl = await getLevelByID(eighthLvlId);
145
- ninthLvlId = res.data.split("|1:")[8].split(":2:")[0];
146
- ninthLvl = await getLevelByID(ninthLvlId);
147
- result = [firstLvl,secondLvl,thirdLvl,fourthLvl,fifthLvl,sixthLvl,seventhLvl,eighthLvl,ninthLvl]
148
- }
149
21
 
150
- if(res.data.split("|1:").length - 1 == 9) {
151
- secondLvlId = res.data.split("|1:")[1].split(":2:")[0];
152
- secondLvl = await getLevelByID(secondLvlId);
153
- thirdLvlId = res.data.split("|1:")[2].split(":2:")[0];
154
- thirdLvl = await getLevelByID(thirdLvlId);
155
- fourthLvlId = res.data.split("|1:")[3].split(":2:")[0];
156
- fourthLvl = await getLevelByID(fourthLvlId);
157
- fifthLvlId = res.data.split("|1:")[4].split(":2:")[0];
158
- fifthLvl = await getLevelByID(fifthLvlId);
159
- sixthLvlId = res.data.split("|1:")[5].split(":2:")[0];
160
- sixthLvl = await getLevelByID(sixthLvlId);
161
- seventhLvlId = res.data.split("|1:")[6].split(":2:")[0];
162
- seventhLvl = await getLevelByID(seventhLvlId);
163
- eighthLvlId = res.data.split("|1:")[7].split(":2:")[0];
164
- eighthLvl = await getLevelByID(eighthLvlId);
165
- ninthLvlId = res.data.split("|1:")[8].split(":2:")[0];
166
- ninthLvl = await getLevelByID(ninthLvlId);
167
- tenthLvlId = res.data.split("|1:")[9].split(":2:")[0];
168
- tenthLvl = await getLevelByID(tenthLvlId);
169
- result = [firstLvl,secondLvl,thirdLvl,fourthLvl,fifthLvl,sixthLvl,seventhLvl,eighthLvl,ninthLvl,tenthLvl]
22
+ let levels = res.data.split("#")[0].split("|");
23
+ let result = [];
24
+ for(const lvl of levels) {
25
+ let id = lvl.split(":")[1];
26
+ result.push(await getLevelByID(id))
170
27
  }
171
28
 
172
29
  return result;
@@ -13,10 +13,11 @@ module.exports = {
13
13
  }, {
14
14
  headers: headers
15
15
  }).catch(e => {
16
- if(e.response.data == -1) throw new Error(`Couldn't find a "${username}" user.`)
17
16
  throw new Error(e.response.data)
18
17
  });
19
18
 
19
+ if(res.data == -1) throw new Error(`Couldn't find a "${str}" user.`)
20
+
20
21
  return decodeUserResult(res.data);
21
22
  }
22
23
  }
@@ -35,6 +35,6 @@ module.exports = {
35
35
  throw new Error(e.response.data);
36
36
  })
37
37
 
38
- return 1;
38
+ return res.data;
39
39
  }
40
40
  }
@@ -47,6 +47,8 @@ module.exports = {
47
47
  throw new Error(edata)
48
48
  })
49
49
 
50
- return 1;
50
+ if(res.data == -1) throw new Error("Whoops, the servers have rejected your request!");
51
+
52
+ return res.data;
51
53
  }
52
54
  }
@@ -34,6 +34,8 @@ module.exports = {
34
34
  throw new Error(e.response.data)
35
35
  });
36
36
 
37
+ if(res.data == -1) throw new Error(-1);
38
+
37
39
  return 1;
38
40
  }
39
41
  }
package/index.js CHANGED
@@ -30,7 +30,7 @@ const { dlMessage } = require("./functions/dlMessage.js");
30
30
  const { uploadMessage } = require("./functions/uploadMessage.js");
31
31
  const { searchUsers } = require("./functions/searchUsers.js");
32
32
 
33
- module.exports.dlLevel = dlLevel;
33
+ module.exports.dlLevel = dlLevel
34
34
  module.exports.getSongInfo = getSongInfo;
35
35
  module.exports.getOfficialSongInfo = getOfficialSongInfo;
36
36
  module.exports.getDailyLevel = getDailyLevel;
@@ -1,19 +1,24 @@
1
1
  module.exports = {
2
2
  decCommentFromHistory:
3
3
  function(comment) {
4
- const decB64 = require("./decB64.js");
5
-
6
- let levelID = comment.split("~1~")[1].split("~3~")[0];
7
- let commentContent = comment.split("2~")[1].split("~1~")[0];
8
- let playerID = comment.split("~3~")[1].split("~4~")[0];
9
- let likes = comment.split("~4~")[1].split("~10~")[0];
10
- let percent = comment.split("~10~")[1].split("~9~")[0];
11
- let age = comment.split("~9~")[1].split("~6~")[0];
12
- let messageID = comment.split("~6~")[1].split(":1~")[0];
13
- let username = comment.split(":1~")[1].split("~9~")[0];
4
+ const {decB64} = require("./decB64.js");
5
+
6
+ let spl = comment.split('~');
7
+ let cmnt = [];
8
+ for(let i =0;i<spl.length;i++) {
9
+ if(i%2!=0) {
10
+ cmnt.push(spl[i-1]+`~`+spl[i]);
11
+ }
12
+ }
14
13
 
15
- if(messageID.includes("~")) messageID = comment.split("~6~")[1].split("~11~")[0];
16
- if(playerID.includes("~")) playerID = comment.split("~3~")[1].split("~4~")[0].split("~")[0];
14
+ let levelID = cmnt[1].split("~")[1];
15
+ let commentContent = cmnt[0].split("~")[1];
16
+ let playerID = cmnt[2].split("~")[1];
17
+ let likes = cmnt[3].split("~")[1];
18
+ let percent = cmnt[4].split("~")[1];
19
+ let age = cmnt[5].split("~")[1];
20
+ let messageID = cmnt[6].split("~")[1].split(":")[0];
21
+ let username = cmnt[7].split("~")[0];
17
22
 
18
23
  const res = {
19
24
  username: username,
@@ -1,7 +1,7 @@
1
1
  module.exports = {
2
2
  decodeGJComment:
3
3
  function(comment) {
4
- const decB64 = require("./decB64.js");
4
+ const {decB64} = require("./decB64.js");
5
5
 
6
6
  let spl = comment.split("~");
7
7
  let cmnt = [];
@@ -1,20 +1,24 @@
1
1
  module.exports = {
2
2
  decodeGJGauntlet:
3
3
  function(gauntlet) {
4
- let gauntletID = gauntlet.split(":3:")[0].split("1:")[1]
5
- if(gauntletID == "") gauntletID = "1";
6
- let levelList = gauntlet.split(":3:")[1];
7
- if(levelList.includes("#")) levelList = gauntlet.split(":3:")[1].split("#")[0];
8
-
9
- if(levelList.includes(":")) levelList = gauntlet.split("3:")[2];
4
+ let spl = gauntlet.split(':');
5
+ let glInfo = [];
6
+ for(let i =0;i<spl.length;i++) {
7
+ if(i%2!=0) {
8
+ glInfo.push(spl[i-1]+`:`+spl[i]);
9
+ }
10
+ }
11
+
12
+ let id = glInfo[0].split(":")[1];
13
+ let levelList = glInfo[1].split(":")[1];
10
14
 
11
15
  let firstLvl = levelList.split(",")[0];
12
16
  let secondLvl = levelList.split(",")[1].split(",")[0];
13
17
  let thirdLvl = levelList.split(",")[2].split(",")[0];
14
18
  let fourthLvl = levelList.split(",")[3].split(",")[0];
15
- let fifthLvl = levelList.split(",")[4].split(",")[0];
19
+ let fifthLvl = levelList.split(",")[4].split("#")[0];
16
20
 
17
- const gauntletIDs = {
21
+ const glIDs = {
18
22
  "1": "Fire Gauntlet",
19
23
  "2": "Ice Gauntlet",
20
24
  "3": "Poison Gauntlet",
@@ -29,14 +33,13 @@ module.exports = {
29
33
  "12": "spike Gauntlet",
30
34
  "13": "Monster Gauntlet",
31
35
  "14": "Doom Gauntlet",
32
- "15": "Death Gauntlet",
33
- undefined: "Poison Gauntlet"
36
+ "15": "Death Gauntlet"
34
37
  }
35
38
 
36
39
  const list = [firstLvl,secondLvl,thirdLvl,fourthLvl,fifthLvl]
37
40
 
38
41
  const result = {
39
- "name": gauntletIDs[gauntletID],
42
+ "name": glIDs[id],
40
43
  "levels": list
41
44
  }
42
45
 
@@ -1,7 +1,7 @@
1
1
  module.exports = {
2
2
  decodeLevel:
3
3
  async function(level){
4
- const decB64 = require("./decB64.js");
4
+ const {decB64} = require("./decB64.js");
5
5
 
6
6
  let spl = level.split(':');
7
7
  let levelInfo = [];
@@ -41,6 +41,7 @@ module.exports = {
41
41
  let disliked = false;
42
42
  if(likes.includes("-")) disliked = true;
43
43
 
44
+ if(desc.includes("/")) desc = desc.split("/")[0];
44
45
  if(decB64(desc) == '') desc = "KE5vIGRlc2NyaXB0aW9uIHByb3ZpZGVkKQ=="
45
46
 
46
47
  if(verifiedCoins == "0") verifiedCoins = false;
@@ -160,6 +161,7 @@ module.exports = {
160
161
  stars_requested: Number(starsRequested),
161
162
  game_version: decodeGameVersion[gameVersion],
162
163
  copied: Number(copiedID),
164
+ large: Number(objs) > 40000 ? true : false,
163
165
  two_p: demonBoolDecoding[twoPlayer],
164
166
  coins: Number(coins),
165
167
  verified_coins: verifiedCoins,
@@ -186,6 +188,7 @@ module.exports = {
186
188
  stars_requested: Number(starsRequested),
187
189
  game_version: decodeGameVersion[gameVersion],
188
190
  copied: Number(copiedID),
191
+ large: Number(objs) > 40000 ? true : false,
189
192
  two_p: demonBoolDecoding[twoPlayer],
190
193
  coins: Number(coins),
191
194
  verified_coins: verifiedCoins,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gj-boomlings-api",
3
- "version": "1.3.1",
3
+ "version": "1.3.3",
4
4
  "description": "A light-weight Geometry Dash API wrapper",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -24,9 +24,13 @@
24
24
  "boomlings",
25
25
  "api",
26
26
  "gaming",
27
- "robtop"
27
+ "robtop",
28
+ "geometry dash"
28
29
  ],
29
30
  "dependencies": {
30
31
  "axios": "^1.2.1"
32
+ },
33
+ "devDependencies": {
34
+ "typescript": "^4.9.4"
31
35
  }
32
36
  }
package/tsconfig.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "compilerOptions": {
3
+ "allowJs": true,
4
+ "noEmit": true
5
+ }
6
+ }