gj-boomlings-api 1.1.0 → 1.2.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.
@@ -128,35 +128,65 @@ module.exports = {
128
128
 
129
129
  const { getLevelByID } = require("./getLevelByID.js");
130
130
  let basicInfoAboutLevel = await getLevelByID(id);
131
-
132
- const result = {
133
- id: Number(id),
134
- name: name,
135
- description: description,
136
- creator: basicInfoAboutLevel.creator,
137
- level_version: Number(version),
138
- difficulty: difficultyDecoding[difficulty],
139
- stars: Number(stars),
140
- downloads: Number(downloads),
141
- likes: Number(likes),
142
- disliked: disliked,
143
- length: lengthDecoding[length],
144
- password: password.replace("1", ""),
145
- demon: demonBoolDecoding[demonBool],
146
- featured: featured,
147
- epic: demonBoolDecoding[epic],
148
- objects: Number(objects),
149
- uploaded: uploaded,
150
- updated: updated,
151
- stars_requested: Number(starsRequested),
152
- game_version: decodeGameVersion[gameVersion],
153
- ldm: demonBoolDecoding[ldm],
154
- copied: Number(copiedID),
155
- two_p: demonBoolDecoding[twoPlayer],
156
- coins: Number(coins),
157
- verified_coins: verifiedCoins,
158
- song: basicInfoAboutLevel.song,
159
- }
131
+ let result = {
132
+ id: Number(id),
133
+ name: name,
134
+ description: description,
135
+ creator: basicInfoAboutLevel.creator,
136
+ level_version: Number(version),
137
+ difficulty: difficultyDecoding[difficulty],
138
+ stars: Number(stars),
139
+ downloads: Number(downloads),
140
+ likes: Number(likes),
141
+ disliked: disliked,
142
+ length: lengthDecoding[length],
143
+ password: password.replace("1", ""),
144
+ demon: demonBoolDecoding[demonBool],
145
+ featured: featured,
146
+ epic: demonBoolDecoding[epic],
147
+ objects: Number(objects),
148
+ uploaded: uploaded,
149
+ updated: updated,
150
+ stars_requested: Number(starsRequested),
151
+ game_version: decodeGameVersion[gameVersion],
152
+ ldm: demonBoolDecoding[ldm],
153
+ copied: Number(copiedID),
154
+ two_p: demonBoolDecoding[twoPlayer],
155
+ coins: Number(coins),
156
+ verified_coins: verifiedCoins,
157
+ song: basicInfoAboutLevel.song,
158
+ }
159
+ if(basicInfoAboutLevel.pointercrate != undefined) {
160
+ result = {
161
+ id: Number(id),
162
+ name: name,
163
+ description: description,
164
+ creator: basicInfoAboutLevel.creator,
165
+ level_version: Number(version),
166
+ difficulty: difficultyDecoding[difficulty],
167
+ stars: Number(stars),
168
+ downloads: Number(downloads),
169
+ likes: Number(likes),
170
+ disliked: disliked,
171
+ length: lengthDecoding[length],
172
+ password: password.replace("1", ""),
173
+ demon: demonBoolDecoding[demonBool],
174
+ featured: featured,
175
+ epic: demonBoolDecoding[epic],
176
+ objects: Number(objects),
177
+ uploaded: uploaded,
178
+ updated: updated,
179
+ stars_requested: Number(starsRequested),
180
+ game_version: decodeGameVersion[gameVersion],
181
+ ldm: demonBoolDecoding[ldm],
182
+ copied: Number(copiedID),
183
+ two_p: demonBoolDecoding[twoPlayer],
184
+ coins: Number(coins),
185
+ verified_coins: verifiedCoins,
186
+ song: basicInfoAboutLevel.song,
187
+ pointercrate: basicInfoAboutLevel.pointercrate
188
+ }
189
+ }
160
190
 
161
191
  return result;
162
192
  }
@@ -24,6 +24,6 @@ module.exports = {
24
24
  throw new Error(e.response.data);
25
25
  })
26
26
 
27
- return decodeLevel(res.data);
27
+ return await decodeLevel(res.data);
28
28
  }
29
29
  }
@@ -1,6 +1,6 @@
1
1
  module.exports = {
2
2
  decodeLevel:
3
- function(level){
3
+ async function(level){
4
4
  const bs = require("js-base64");
5
5
 
6
6
  let spl = level.split(':');
@@ -134,30 +134,62 @@ module.exports = {
134
134
  song = songinfo;
135
135
  }
136
136
 
137
- const result = {
138
- id: Number(id),
139
- name: name,
140
- description: bs.decode(desc), //.replace(/-/g, "+").replace(/_/g, "/")
141
- creator: author,
142
- level_version: Number(version),
143
- difficulty: difficultyDecoding[difficulty],
144
- stars: Number(stars),
145
- downloads: Number(downloads),
146
- likes: Number(likes),
147
- disliked: disliked,
148
- length: lengthDecoding[length],
149
- demon: demonBoolDecoding[demonBool],
150
- featured: featured,
151
- epic: demonBoolDecoding[epic],
152
- objects: Number(objs),
153
- stars_requested: Number(starsRequested),
154
- game_version: decodeGameVersion[gameVersion],
155
- copied: Number(copiedID),
156
- two_p: demonBoolDecoding[twoPlayer],
157
- coins: Number(coins),
158
- verified_coins: verifiedCoins,
159
- song: song,
137
+ let result;
138
+ const { demonlist } = require("./demonlist.js");
139
+ let dlist = await demonlist(name);
140
+
141
+ if(dlist != null) {
142
+ result = {
143
+ id: Number(id),
144
+ name: name,
145
+ description: bs.decode(desc),
146
+ creator: author,
147
+ level_version: Number(version),
148
+ difficulty: difficultyDecoding[difficulty],
149
+ stars: Number(stars),
150
+ downloads: Number(downloads),
151
+ likes: Number(likes),
152
+ disliked: disliked,
153
+ length: lengthDecoding[length],
154
+ demon: demonBoolDecoding[demonBool],
155
+ featured: featured,
156
+ epic: demonBoolDecoding[epic],
157
+ objects: Number(objs),
158
+ stars_requested: Number(starsRequested),
159
+ game_version: decodeGameVersion[gameVersion],
160
+ copied: Number(copiedID),
161
+ two_p: demonBoolDecoding[twoPlayer],
162
+ coins: Number(coins),
163
+ verified_coins: verifiedCoins,
164
+ song: song,
165
+ pointercrate: dlist
166
+ }
167
+ } else {
168
+ result = {
169
+ id: Number(id),
170
+ name: name,
171
+ description: bs.decode(desc),
172
+ creator: author,
173
+ level_version: Number(version),
174
+ difficulty: difficultyDecoding[difficulty],
175
+ stars: Number(stars),
176
+ downloads: Number(downloads),
177
+ likes: Number(likes),
178
+ disliked: disliked,
179
+ length: lengthDecoding[length],
180
+ demon: demonBoolDecoding[demonBool],
181
+ featured: featured,
182
+ epic: demonBoolDecoding[epic],
183
+ objects: Number(objs),
184
+ stars_requested: Number(starsRequested),
185
+ game_version: decodeGameVersion[gameVersion],
186
+ copied: Number(copiedID),
187
+ two_p: demonBoolDecoding[twoPlayer],
188
+ coins: Number(coins),
189
+ verified_coins: verifiedCoins,
190
+ song: song
160
191
  }
192
+ }
161
193
 
162
194
  return result;
163
195
  }
@@ -0,0 +1,16 @@
1
+ module.exports = {
2
+ demonlist:
3
+ async function(name) {
4
+ const axios = require("axios");
5
+ let r = await axios.get(`https://pointercrate.com/api/v2/demons/?name=${name}`);
6
+ if(r.data == "[]") return null;
7
+
8
+ const res = {
9
+ "position": r.data[0].position,
10
+ "publisher": r.data[0].publisher.name,
11
+ "verifier": r.data[0].verifier.name,
12
+ }
13
+
14
+ return res;
15
+ }
16
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gj-boomlings-api",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "A Node.js module that allows you to fetch boomlings.com easily",
5
5
  "main": "index.js",
6
6
  "scripts": {