gj-boomlings-api 1.2.2 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/functions/blockUser.js +5 -32
  2. package/functions/deleteAccountPost.js +3 -19
  3. package/functions/deleteComment.js +3 -22
  4. package/functions/dlLevel.js +12 -12
  5. package/functions/dlMessage.js +32 -0
  6. package/functions/getAccountPosts.js +9 -121
  7. package/functions/getCommentHistory.js +7 -121
  8. package/functions/getComments.js +5 -102
  9. package/functions/getCreatorScores.js +11 -203
  10. package/functions/getGauntlets.js +5 -33
  11. package/functions/getMapPacks.js +6 -20
  12. package/functions/getMessages.js +37 -0
  13. package/functions/getProfile.js +10 -22
  14. package/functions/getTop100.js +11 -203
  15. package/functions/getUserLevels.js +0 -16
  16. package/functions/searchUsers.js +22 -0
  17. package/functions/unblockUser.js +5 -32
  18. package/functions/updateLevelDesc.js +5 -19
  19. package/functions/uploadAccountPost.js +6 -20
  20. package/functions/uploadComment.js +7 -23
  21. package/functions/uploadMessage.js +39 -0
  22. package/index.js +9 -5
  23. package/misc/colors.json +44 -0
  24. package/misc/decB64.js +7 -0
  25. package/misc/decCommentFromHistory.js +2 -2
  26. package/misc/decMessage.js +34 -0
  27. package/misc/decMsg.js +30 -0
  28. package/misc/decScoresUser.js +45 -0
  29. package/misc/decodeAccountPost.js +2 -2
  30. package/misc/decodeGJComment.js +20 -13
  31. package/misc/decodeLevel.js +4 -4
  32. package/misc/decodeMapPack.js +1 -14
  33. package/misc/decodeUserResult.js +8 -9
  34. package/{functions/encURLSafeBase64.js → misc/encB64.js} +2 -3
  35. package/misc/rgbToHEX.js +16 -0
  36. package/package.json +2 -3
  37. package/docs/blockUser.md +0 -21
  38. package/docs/deleteAccountPost.md +0 -23
  39. package/docs/dlLevel.md +0 -52
  40. package/docs/getAccountPosts.md +0 -71
  41. package/docs/getCommentHistory.md +0 -123
  42. package/docs/getComments.md +0 -113
  43. package/docs/getCreatorScores.md +0 -60
  44. package/docs/getDailyLevel.md +0 -17
  45. package/docs/getGauntlets.md +0 -81
  46. package/docs/getLevelByID.md +0 -51
  47. package/docs/getMapPacks.md +0 -88
  48. package/docs/getOfficialSongInfo.md +0 -25
  49. package/docs/getProfile.md +0 -36
  50. package/docs/getSongInfo.md +0 -26
  51. package/docs/getTop100.md +0 -56
  52. package/docs/getUserLevels.md +0 -84
  53. package/docs/getWeeklyDemon.md +0 -17
  54. package/docs/objects/acc_comment.md +0 -19
  55. package/docs/objects/comment.md +0 -34
  56. package/docs/objects/level.md +0 -95
  57. package/docs/objects/song.md +0 -28
  58. package/docs/objects/user.md +0 -61
  59. package/docs/reportLevel.md +0 -19
  60. package/docs/searchLevels.md +0 -113
  61. package/docs/updateLevelDesc.md +0 -23
  62. package/docs/uploadAccountPost.md +0 -27
  63. package/docs/uploadComment.md +0 -28
  64. package/functions/decURLSafeBase64.js +0 -10
package/misc/decMsg.js ADDED
@@ -0,0 +1,30 @@
1
+ module.exports = {
2
+ decMsg:
3
+ function(msg) {
4
+ const {decB64} = require("./decB64.js");
5
+
6
+ let spl = msg.split("#")[0].split(":");
7
+ let msgInfo = [];
8
+ for(let i =0;i<spl.length;i++) {
9
+ if(i%2!=0) {
10
+ msgInfo.push(spl[i-1]+`:`+spl[i]);
11
+ }
12
+ }
13
+
14
+ let username = msgInfo[0].split("6:")[1];
15
+ let playerID = msgInfo[1].split("3:")[1];
16
+ let accID = msgInfo[2].split("2:")[1];
17
+ let msgID = msgInfo[3].split("1:")[1];
18
+ let title = msgInfo[4].split("4:")[1];
19
+ let age = msgInfo[7].split("7:")[1];
20
+
21
+ return {
22
+ username: username,
23
+ title: decB64(title),
24
+ playerID: Number(playerID),
25
+ accountID: Number(accID),
26
+ messageID: Number(msgID),
27
+ age: age
28
+ };
29
+ }
30
+ }
@@ -0,0 +1,45 @@
1
+ module.exports = {
2
+ decScoresUser:
3
+ function(user) {
4
+ let spl = user.split(':');
5
+ let userInfo = [];
6
+ for(let i =0;i<spl.length;i++) {
7
+ if(i%2!=0) {
8
+ userInfo.push(spl[i-1]+`:`+spl[i]);
9
+ }
10
+ }
11
+
12
+ let name = userInfo[0].split("1:")[1];
13
+ let playerID = userInfo[1].split("2:")[1];
14
+ let coins = userInfo[2].split("13:")[1];
15
+ let userCoins = userInfo[3].split("17:")[1];
16
+ let p1col = userInfo[6].split("10:")[1];
17
+ let p2col = userInfo[7].split("11:")[1];
18
+ let rank = userInfo[4].split("6:")[1];
19
+ let accID = userInfo[10].split("16:")[1];
20
+ let stars = userInfo[11].split("3:")[1];
21
+ let cp = userInfo[12].split("8:")[1];
22
+ let diamonds = userInfo[13].split("46:")[1];
23
+ let demons = userInfo[14].split("4:")[1];
24
+
25
+ let colors = require("./colors.json");
26
+ const { rgbToHEX } = require("./rgbToHEX.js");
27
+
28
+ const result = {
29
+ username: name.trim(),
30
+ playerID: playerID,
31
+ accountID: accID,
32
+ rank: rank,
33
+ color1: rgbToHEX(colors[p1col]),
34
+ color2: rgbToHEX(colors[p2col]),
35
+ stars: stars,
36
+ diamonds: diamonds,
37
+ secretCoins: coins,
38
+ userCoins: userCoins,
39
+ demons: demons,
40
+ creatorPoints: cp
41
+ }
42
+
43
+ return result;
44
+ }
45
+ }
@@ -1,7 +1,7 @@
1
1
  module.exports = {
2
2
  decodeAccountPost:
3
3
  function(post) {
4
- const bs = require("js-base64");
4
+ const {decB64} = require("./decB64.js");
5
5
 
6
6
  let postContent = post.split("2~")[1].split("~4~")[0];
7
7
  let likes = post.split("~4~")[1].split("~9~")[0];
@@ -12,7 +12,7 @@ module.exports = {
12
12
  if(id.includes("#")) id = id.split("#")[0];
13
13
 
14
14
  const result = {
15
- content: bs.decode(postContent.replace(/_/g, '/').replace(/-/g, '+')).trim(),
15
+ content: decB64(postContent).trim(),
16
16
  likes: Number(likes),
17
17
  age: age,
18
18
  id: Number(id)
@@ -1,26 +1,33 @@
1
1
  module.exports = {
2
2
  decodeGJComment:
3
3
  function(comment) {
4
- const bs = require("js-base64");
5
-
6
- let commentContent = comment.split("2~")[1].split("~3~")[0];
7
- let playerID = comment.split("~3~")[1].split("~4~")[0];
8
- let likes = comment.split("~4~")[1].split("~7~")[0];
9
- let percent = comment.split("~10~")[1].split("~9~")[0];
10
- let age = comment.split("~9~")[1].split("~6~")[0];
11
- let messageID = comment.split("~6~")[1].split(":1~")[0];
12
- 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
+ }
13
13
 
14
- if(messageID.includes("~")) messageID = comment.split("~6~")[1].split("~11~")[0];
15
- if(playerID.includes("~")) playerID = comment.split("~3~")[1].split("~4~")[0].split("~")[0];
14
+ let commentContent = cmnt[0].split("2~")[1];
15
+ let playerID = cmnt[1].split("3~")[1];
16
+ let likes = cmnt[2].split("4~")[1];
17
+ let percent = cmnt[4].split("10~")[1];
18
+ let age = cmnt[5].split("9~")[1];
19
+ let msgID = cmnt[6].split("6~")[1];
20
+ let username = comment.split(":1~")[1].split("~9")[0];
16
21
 
22
+ if(msgID.includes(":")) msgID = msgID.split(":")[0];
23
+
17
24
  const res = {
18
25
  username: username,
19
- content: bs.decode(commentContent.replace(/_/g, '/').replace(/-/g, '+')),
26
+ content: decB64(commentContent),
20
27
  playerID: Number(playerID),
21
28
  likes: Number(likes),
22
29
  percent: Number(percent),
23
- id: Number(messageID),
30
+ id: Number(msgID),
24
31
  age: age
25
32
  }
26
33
 
@@ -1,7 +1,7 @@
1
1
  module.exports = {
2
2
  decodeLevel:
3
3
  async function(level){
4
- const bs = require("js-base64");
4
+ const decB64 = require("./decB64.js");
5
5
 
6
6
  let spl = level.split(':');
7
7
  let levelInfo = [];
@@ -41,7 +41,7 @@ module.exports = {
41
41
  let disliked = false;
42
42
  if(likes.includes("-")) disliked = true;
43
43
 
44
- if(bs.decode(desc) == '') desc = "KE5vIGRlc2NyaXB0aW9uIHByb3ZpZGVkKQ=="
44
+ if(decB64(desc) == '') desc = "KE5vIGRlc2NyaXB0aW9uIHByb3ZpZGVkKQ=="
45
45
 
46
46
  if(verifiedCoins == "0") verifiedCoins = false;
47
47
  if(verifiedCoins == "1") verifiedCoins = true;
@@ -144,7 +144,7 @@ module.exports = {
144
144
  result = {
145
145
  id: Number(id),
146
146
  name: name,
147
- description: bs.decode(desc),
147
+ description: decB64(desc),
148
148
  creator: author,
149
149
  level_version: Number(version),
150
150
  difficulty: difficultyDecoding[difficulty],
@@ -170,7 +170,7 @@ module.exports = {
170
170
  result = {
171
171
  id: Number(id),
172
172
  name: name,
173
- description: bs.decode(desc),
173
+ description: decB64(desc),
174
174
  creator: author,
175
175
  level_version: Number(version),
176
176
  difficulty: difficultyDecoding[difficulty],
@@ -1,7 +1,6 @@
1
1
  module.exports = {
2
2
  decodeMapPack:
3
3
  function(mp) {
4
-
5
4
  let spl = mp.split(':');
6
5
  let mpInfo = [];
7
6
  for(let i =0;i<spl.length;i++) {
@@ -37,19 +36,7 @@ module.exports = {
37
36
  "10": "Extreme Demon",
38
37
  }
39
38
 
40
- function rgbToHEX(color) {
41
- let r = color.split(",")[0];
42
- let g = color.split(",")[1].split(",")[0];
43
- let b = color.split(",")[2];
44
-
45
- if(b.includes("#")) b = b.split("#")[0]
46
-
47
- let rHex = Number(r).toString(16);
48
- let gHex = Number(g).toString(16);
49
- let bHex = Number(b).toString(16);
50
-
51
- return `#${rHex.length == 1 ? "0" + rHex : rHex}${gHex.length == 1 ? "0" + gHex : gHex}${bHex.length == 1 ? "0" + bHex : bHex}`.toUpperCase();
52
- }
39
+ const { rgbToHEX } = require("./rgbToHEX.js");
53
40
 
54
41
  const result = {
55
42
  name: name,
@@ -1,36 +1,35 @@
1
1
  module.exports = {
2
2
  decodeUserResult:
3
3
  function(user) {
4
- let spl = user.split(':');
4
+ let spl = user.split(':');
5
5
  let userInfo = [];
6
6
  for(let i =0;i<spl.length;i++) {
7
7
  if(i%2!=0) {
8
8
  userInfo.push(spl[i-1]+`:`+spl[i]);
9
9
  }
10
10
  }
11
-
11
+
12
12
  let name = userInfo[0].split("1:")[1];
13
13
  let playerID = userInfo[1].split("2:")[1];
14
14
  let coins = userInfo[2].split("13:")[1];
15
15
  let userCoins = userInfo[3].split("17:")[1];
16
16
  let p1col = userInfo[6].split("10:")[1];
17
17
  let p2col = userInfo[7].split("11:")[1];
18
- let rank = userInfo[4].split("6:")[1];
19
18
  let accID = userInfo[10].split("16:")[1];
20
19
  let stars = userInfo[11].split("3:")[1];
21
20
  let cp = userInfo[12].split("8:")[1];
22
- let diamonds = userInfo[13].split("46:")[1];
23
- let demons = userInfo[14].split("4:")[1];
21
+ let demons = userInfo[13].split("4:")[1].split("#")[0];
22
+
23
+ let colors = require("./colors.json");
24
+ const { rgbToHEX } = require("./rgbToHEX.js");
24
25
 
25
26
  const result = {
26
27
  username: name.trim(),
27
28
  playerID: Number(playerID),
28
29
  accountID: Number(accID),
29
- rank: Number(rank),
30
- color1: Number(p1col),
31
- color2: Number(p2col),
30
+ color1: rgbToHEX(colors[p1col]),
31
+ color2: rgbToHEX(colors[p2col]),
32
32
  stars: Number(stars),
33
- diamonds: Number(diamonds),
34
33
  secretCoins: Number(coins),
35
34
  userCoins: Number(userCoins),
36
35
  demons: Number(demons),
@@ -1,9 +1,8 @@
1
1
  module.exports = {
2
- encURLSafeBase64:
2
+ encB64:
3
3
  function(string) {
4
- const bs = require("js-base64");
5
4
  if(!string || string == "") throw new Error("No string provided!")
6
- let str = bs.encode(string).replace(/\//g, '_').replace(/\+/g, '-');
5
+ let str = btoa(unescape(encodeURIComponent(string))).replace(/\//g, '_').replace(/\+/g, '-');
7
6
  return str;
8
7
  }
9
8
  }
@@ -0,0 +1,16 @@
1
+ module.exports = {
2
+ rgbToHEX:
3
+ function(color) {
4
+ let r = color.split(",")[0];
5
+ let g = color.split(",")[1].split(",")[0];
6
+ let b = color.split(",")[2];
7
+
8
+ if(b.includes("#")) b = b.split("#")[0];
9
+
10
+ let rHex = Number(r).toString(16);
11
+ let gHex = Number(g).toString(16);
12
+ let bHex = Number(b).toString(16);
13
+
14
+ return `#${rHex.length == 1 ? "0" + rHex : rHex}${gHex.length == 1 ? "0" + gHex : gHex}${bHex.length == 1 ? "0" + bHex : bHex}`.toUpperCase();
15
+ }
16
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gj-boomlings-api",
3
- "version": "1.2.2",
3
+ "version": "1.3.0",
4
4
  "description": "A light-weight Geometry Dash API wrapper",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -27,7 +27,6 @@
27
27
  "robtop"
28
28
  ],
29
29
  "dependencies": {
30
- "axios": "^1.2.1",
31
- "js-base64": "^3.7.3"
30
+ "axios": "^1.2.1"
32
31
  }
33
32
  }
package/docs/blockUser.md DELETED
@@ -1,21 +0,0 @@
1
- # blockUser()
2
-
3
- Blocks the user.
4
-
5
- ## Parameters
6
- `target` - the user that is being blocked.
7
-
8
- `user` - the player ID or the username of the user that blocks.
9
-
10
- `gjp` - the password of the user that blocks.
11
-
12
- ## Example
13
- ```js
14
- const gd = require("gj-boomlings-api");
15
- gd.blockUser("colon", "gmdshxdow", "*********").then(console.log);
16
- ```
17
-
18
- ## Response
19
- ```js
20
- 1
21
- ```
@@ -1,23 +0,0 @@
1
- # deleteAccountPost()
2
-
3
- Posts a comment to a profile.
4
-
5
- ## Parameters
6
- `id` - the account post ID. Returned by `getAccountPosts()`.
7
-
8
- `user` - the username or player ID.
9
-
10
- `gjp` - the user's password.
11
-
12
- ## Example
13
- ```js
14
- const gd = require("gj-boomlings-api");
15
- gd.deleteAccountPost("18183557", "gmdshxdow", "*********").then(console.log);
16
- ```
17
-
18
- ## Response
19
- ```js
20
- 1
21
- ```
22
-
23
- Returns `1` if the comment was successfully deleted.
package/docs/dlLevel.md DELETED
@@ -1,52 +0,0 @@
1
- # dlLevel()
2
-
3
- Downloads a level and decodes it.
4
-
5
- ## Parameters
6
- `level` - the level ID.
7
-
8
- ## Example
9
- ```js
10
- const gd = require("gj-boomlings-api");
11
- gd.dlLevel(58825144).then(console.log);
12
- ```
13
-
14
- ## Response
15
- ```
16
- {
17
- id: 58825144,
18
- name: 'xo',
19
- description: 'stream vertigo',
20
- creator: 'KrmaL',
21
- level_version: 2,
22
- difficulty: 'Extreme Demon',
23
- stars: 10,
24
- downloads: 2640560,
25
- likes: 107918,
26
- disliked: false,
27
- length: 'XL',
28
- password: '000007',
29
- demon: true,
30
- featured: false,
31
- epic: false,
32
- objects: 37838,
33
- uploaded: '3 years',
34
- updated: '3 years',
35
- stars_requested: 10,
36
- game_version: '2.1',
37
- ldm: false,
38
- copied: 0,
39
- two_p: false,
40
- coins: 0,
41
- verified_coins: false,
42
- song: {
43
- name: 'XO (Eden Cover & Remake)',
44
- id: 766165,
45
- artist: 'aaronmusslewhite',
46
- artistId: 2130,
47
- fileSize: '6.1 MB',
48
- link: 'http://audio.ngfiles.com/766000/766165_XO-Eden-Cover-amp-Remake.mp3'
49
- }
50
- }
51
- ```
52
- Returns a [level object](./objects/level.md).
@@ -1,71 +0,0 @@
1
- # getAccountPosts()
2
-
3
- Gets the account comments from someone's profile.
4
-
5
- ## Parameters
6
- `user` - the username or player ID.
7
-
8
- `page` (optional) - the page of the posts. Defaults to 1.
9
-
10
- ## Example
11
- ```js
12
- const gd = require("gj-boomlings-api");
13
- gd.getAccountPosts("robtop").then(console.log);
14
- ```
15
-
16
- ## Response
17
- ```js
18
- [
19
- {
20
- content: "Thank you everyone for the birthday wishes. You're the best! :)",
21
- likes: 97911,
22
- age: '10 months'
23
- },
24
- {
25
- content: 'Happy New Year everyone! :D',
26
- likes: 60720,
27
- age: '11 months'
28
- },
29
- {
30
- content: 'Thank you all for the birthday wishes :)',
31
- likes: 144296,
32
- age: '1 year'
33
- },
34
- {
35
- content: 'Happy New Year everyone!... Still should post more often xD',
36
- likes: 86611,
37
- age: '1 year'
38
- },
39
- {
40
- content: 'Happy New Year everyone!... I should really post more often than this xD',
41
- likes: 133553,
42
- age: '2 years'
43
- },
44
- {
45
- content: 'Happy New Year everyone! :D',
46
- likes: 272323,
47
- age: '3 years'
48
- },
49
- {
50
- content: 'Its amazing how talented level creators are these days :)',
51
- likes: 259426,
52
- age: '5 years'
53
- },
54
- {
55
- content: 'El pollo ardiente...',
56
- likes: 240085,
57
- age: '5 years'
58
- },
59
- {
60
- content: 'I am eating an apple.',
61
- likes: 222661,
62
- age: '5 years'
63
- },
64
- {
65
- content: 'RubRubRubRubRubRubRubRubRubRubRubRubRubRubRubRubRubRub',
66
- likes: 241988,
67
- age: '5 years'
68
- }
69
- ]
70
- ```
71
- Returns an array of [account comments](./objects/acc_comment.md).
@@ -1,123 +0,0 @@
1
- # getCommentHistory()
2
-
3
- Gets a comment history from a specified player.
4
-
5
- ## Parameters
6
- `user` - the player's username or a player ID.
7
-
8
- `page` (optional) - the page of the comment history. Defaults to 1.
9
-
10
- `mode` (optional) - the mode of fetching the comment history. `1` is the most liked and `0` is the most recent. Defaults to 1.
11
-
12
- ## Example
13
- ```js
14
- const gd = require("gj-boomlings-api");
15
- gd.getCommentHistory("robtop").then(console.log);
16
- ```
17
-
18
- ## Response
19
- ```
20
- [
21
- {
22
- username: 'RobTop',
23
- content: 'Like or dislike this comment, it will add 10 likes either way. Check. Mate.',
24
- levelID: 66715392,
25
- playerID: 16,
26
- likes: 733980,
27
- percent: 0,
28
- id: 11005139,
29
- age: '1 year'
30
- },
31
- {
32
- username: 'RobTop',
33
- content: 'Can you handle the Kappa?',
34
- levelID: 7485599,
35
- playerID: 16,
36
- likes: 115556,
37
- percent: 0,
38
- id: 42602304,
39
- age: '5 years'
40
- },
41
- {
42
- username: 'RobTop',
43
- content: 'All demons default to hard when first rated, they get the real rating from votes later :)',
44
- levelID: 42584142,
45
- playerID: 16,
46
- likes: 72069,
47
- percent: 0,
48
- id: 12967791,
49
- age: '4 years'
50
- },
51
- {
52
- username: 'RobTop',
53
- content: ':)',
54
- levelID: 10565740,
55
- playerID: 16,
56
- likes: 57919,
57
- percent: 0,
58
- id: 53363972,
59
- age: '5 years'
60
- },
61
- {
62
- username: 'RobTop',
63
- content: 'Love it :)',
64
- levelID: 29424929,
65
- playerID: 16,
66
- likes: 55456,
67
- percent: 0,
68
- id: 42731804,
69
- age: '5 years'
70
- },
71
- {
72
- username: 'RobTop',
73
- content: 'Good enough for me Kappa',
74
- levelID: 26681070,
75
- playerID: 16,
76
- likes: 51795,
77
- percent: 1,
78
- id: 53375227,
79
- age: '5 years'
80
- },
81
- {
82
- username: 'RobTop',
83
- content: 'Getting 7 stars doesnt exclude it from the gauntlet competition dont worry :)',
84
- levelID: 43908596,
85
- playerID: 16,
86
- likes: 43546,
87
- percent: 0,
88
- id: 15614671,
89
- age: '4 years'
90
- },
91
- {
92
- username: 'RobTop',
93
- content: 'I like this level, you guys prefer newer ones? Almost felt like putting Nine Circles :D',
94
- levelID: 17235008,
95
- playerID: 16,
96
- likes: 38313,
97
- percent: 0,
98
- id: 61915039,
99
- age: '4 years'
100
- },
101
- {
102
- username: 'RobTop',
103
- content: 'Kappa',
104
- levelID: 19759411,
105
- playerID: 16,
106
- likes: 37952,
107
- percent: 0,
108
- id: 22802511,
109
- age: '6 years'
110
- },
111
- {
112
- username: 'RobTop',
113
- content: 'You know you are getting old when you can only get 2% on an easy demon',
114
- levelID: 27690100,
115
- playerID: 16,
116
- likes: 37144,
117
- percent: 2,
118
- id: 87255259,
119
- age: '1 year'
120
- }
121
- ]
122
- ```
123
- Returns an array of [comment objects](./objects/comment.md).