gj-boomlings-api 2.0.2 → 2.1.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.
- package/LICENSE +1 -1
- package/README.md +4 -4
- package/functions/acceptFriendRequest.js +39 -0
- package/functions/blockUser.js +12 -13
- package/functions/deleteAccountPost.js +12 -11
- package/functions/deleteComment.js +11 -12
- package/functions/deleteFriendRequest.js +43 -0
- package/functions/deleteLevel.js +10 -13
- package/functions/deleteMessage.js +37 -0
- package/functions/{dlLevel.js → downloadLevel.js} +46 -38
- package/functions/{dlMessage.js → downloadMessage.js} +9 -8
- package/functions/getAccountPosts.js +3 -4
- package/functions/getBlockedList.js +31 -12
- package/functions/getCommentHistory.js +8 -6
- package/functions/getComments.js +11 -7
- package/functions/getCreatorScores.js +13 -4
- package/functions/getDailyLevel.js +3 -3
- package/functions/getFriendRequests.js +87 -0
- package/functions/getFriendsList.js +25 -11
- package/functions/getGauntlets.js +5 -3
- package/functions/getLevelByID.js +2 -2
- package/functions/getLevelScores.js +22 -21
- package/functions/getMapPacks.js +1 -1
- package/functions/getMessages.js +10 -10
- package/functions/getProfile.js +139 -41
- package/functions/getSongInfo.js +3 -3
- package/functions/getTab.js +2 -2
- package/functions/getTop100.js +1 -1
- package/functions/getTopLists.js +1 -1
- package/functions/getUserLevels.js +3 -3
- package/functions/getWeeklyDemon.js +3 -3
- package/functions/removeFriend.js +40 -0
- package/functions/reportLevel.js +2 -2
- package/functions/searchLevels.js +1 -1
- package/functions/searchLists.js +2 -2
- package/functions/unblockUser.js +13 -14
- package/functions/updateLevelDesc.js +9 -10
- package/functions/uploadAccountPost.js +10 -11
- package/functions/uploadComment.js +15 -15
- package/functions/uploadFriendRequest.js +42 -0
- package/functions/uploadMessage.js +15 -15
- package/index.js +29 -3
- package/misc/GJDecode.js +12 -9
- package/misc/gauntlets.json +13 -1
- package/misc/gjp2.js +5 -0
- package/package.json +1 -1
- /package/{gjReq.js → misc/gjReq.js} +0 -0
- /package/{xor.js → misc/xor.js} +0 -0
package/functions/getProfile.js
CHANGED
|
@@ -1,3 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {Object} completedClassicLevels
|
|
3
|
+
* @property {number} auto - The amount of classic levels rated auto (1*) the player has completed.
|
|
4
|
+
* @property {number} easy - The amount of classic levels rated easy (2*) the player has completed.
|
|
5
|
+
* @property {number} normal - The amount of classic levels rated normal (3*) the player has completed.
|
|
6
|
+
* @property {number} hard - The amount of classic levels rated hard (4-5*) the player has completed.
|
|
7
|
+
* @property {number} harder - The amount of classic levels rated harder (6-7*) the player has completed.
|
|
8
|
+
* @property {number} insane - The amount of classic levels rated insane (8-9*) the player has completed.
|
|
9
|
+
* @property {number} daily - The amount of daily levels the player has completed.
|
|
10
|
+
* @property {number} gauntlet - The amount of levels the player has completed in gauntlets.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @typedef {Object} completedPlatformers
|
|
15
|
+
* @property {number} auto - The amount of platformers rated auto (1 moon) the player has completed.
|
|
16
|
+
* @property {number} easy - The amount of platformers rated easy (2 moons) the player has completed.
|
|
17
|
+
* @property {number} normal - The amount of platformers rated normal (3 moons) the player has completed.
|
|
18
|
+
* @property {number} hard - The amount of platformers rated hard (4-5 moons) the player has completed.
|
|
19
|
+
* @property {number} harder - The amount of platformers rated harder (6-7 moons) the player has completed.
|
|
20
|
+
* @property {number} insane - The amount of platformers rated insane (8-9 moons) the player has completed.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @typedef {Object} completedClassicDemons
|
|
25
|
+
* @property {number} easy - The amount of classic easy demons the player has completed.
|
|
26
|
+
* @property {number} medium - The amount of classic medium demons the player has completed.
|
|
27
|
+
* @property {number} hard - The amount of classic hard demons the player has completed.
|
|
28
|
+
* @property {number} insane - The amount of classic insane demons the player has completed.
|
|
29
|
+
* @property {number} extreme - The amount of classic extreme demons the player has completed.
|
|
30
|
+
* @property {number} weekly - The amount of weekly demons the player has completed.
|
|
31
|
+
* @property {number} gauntlet - The amount of demons the player has completed in gauntlets.
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* @typedef {Object} completedPlatformerDemons
|
|
36
|
+
* @property {number} easy - The amount of platformer easy demons the player has completed.
|
|
37
|
+
* @property {number} medium - The amount of platformer medium demons the player has completed.
|
|
38
|
+
* @property {number} hard - The amount of platformer hard demons the player has completed.
|
|
39
|
+
* @property {number} insane - The amount of platformer insane demons the player has completed.
|
|
40
|
+
* @property {number} extreme - The amount of platformer extreme demons the player has completed.
|
|
41
|
+
*/
|
|
42
|
+
|
|
1
43
|
/**
|
|
2
44
|
* @typedef {Object} Player
|
|
3
45
|
* @property {string} username - The player's username.
|
|
@@ -22,63 +64,80 @@
|
|
|
22
64
|
* @property {number} spiderID - The ID of the currently selected spider icon.
|
|
23
65
|
* @property {number} swingID - The ID of the currently selected swing icon.
|
|
24
66
|
* @property {number} jetpackID - The ID of the currently selected jetpack icon.
|
|
67
|
+
* @property {number} trailID - The ID of the currently selected trail.
|
|
25
68
|
* @property {number} explosionID - The ID of the currently selected explosion animation.
|
|
26
69
|
* @property {boolean} glow - Whether the player's icon has the "glow" feature enabled.
|
|
27
70
|
* @property {string} messages - The current state of messaging the player. Returns "all" if anyone can message the person, "friends" if it's limited to friends, and "none" if no one can.
|
|
28
71
|
* @property {boolean} friendRequests - Whether the player has allowed to receive friend requests.
|
|
29
72
|
* @property {string} commentHistory - The current state of viewing the player's comment history. Returns "all" if anyone can do it, "friends" if it's limited to friends, and "none" if only the player can.
|
|
30
73
|
* @property {string|null} mod - Whether the player is a moderator. Returns `null` if not, "mod" if the user is a regular moderator and "elder" if the user is an elder moderator.
|
|
31
|
-
* @property {string} youtube - The player's YouTube channel ID, used in this template: `https://youtube.com/channel/((youtube))
|
|
74
|
+
* @property {string} youtube - The player's YouTube channel ID/handle, used in this template: `https://youtube.com/@((youtube))` or `https://youtube.com/channel/((youtube))` (only if the provided value starts with UC).
|
|
32
75
|
* @property {string} twitter - The player's X (formerly Twitter) username, used in this template: `https://x.com/((twitter))`.
|
|
33
76
|
* @property {string} twitch - The player's Twitch username, used in this template: `https://twitch.tv/((twitch))`.
|
|
77
|
+
* @property {string} instagram - The player's Instagram username, used in this template: `https://instagram.com/@((instagram))`.
|
|
78
|
+
* @property {string} tiktok - The player's Twitch username, used in this template: `https://tiktok.com/@((tiktok))`.
|
|
79
|
+
* @property {string} discord - The player's Discord username.
|
|
80
|
+
* @property {string} custom - The custom string provided by the player.
|
|
81
|
+
* @property {completedClassicLevels} completedClassicLevels - An object breaking down what classic levels the player has completed by difficulties, as well as daily levels and gauntlet levels.
|
|
82
|
+
* @property {completedPlatformers} completedPlatformers - An object breaking down what platformer levels (non-demons) the player has completed by difficulties.
|
|
83
|
+
* @property {completedClassicDemons} completedClassicDemons - An object breaking down what classic demons the player has completed by difficulties, as well as weekly demons and gauntlet demons.
|
|
84
|
+
* @property {completedPlatformerDemons} completedPlatformerDemons - An object breaking down what platformer demons the player has completed by difficulties.
|
|
34
85
|
*/
|
|
35
86
|
|
|
36
87
|
module.exports = {
|
|
37
88
|
/**
|
|
38
89
|
* Fetches the profile of a specified user.
|
|
39
|
-
* @param {string} name - The search query (
|
|
40
|
-
* @param {("name"|"accountid"|"playerid")} mode - The search mode, defaults to "auto". If "auto" is selected, the search is first attempted by
|
|
90
|
+
* @param {string} name - The search query (username, account ID or player ID).
|
|
91
|
+
* @param {("name"|"accountid"|"playerid"|"auto")} mode - The search mode, defaults to "auto". If "auto" is selected, the search is first attempted by looking up the username, then account ID and then player ID.
|
|
41
92
|
* @returns {Player}
|
|
42
93
|
*/
|
|
43
94
|
getProfile: async function (name, mode = "auto") {
|
|
44
|
-
const { gjReq } = require("../gjReq");
|
|
95
|
+
const { gjReq } = require("../misc/gjReq");
|
|
45
96
|
const { rgbToHEX } = require("../misc/rgbToHEX");
|
|
46
97
|
const colors = require("../misc/colors.json");
|
|
47
|
-
if (!name) throw new Error("Please provide
|
|
48
|
-
if (!["name", "accountid", "playerid", "auto"].includes(mode)) throw new Error("Please provide a valid search mode! It's either \"name\", \"accountid\", \"playerid\", or \"auto\"")
|
|
98
|
+
if (!name) throw new Error("Please provide the account name, player ID or account ID!")
|
|
99
|
+
if (!["name", "accountid", "playerid", "auto"].includes(mode)) throw new Error("Please provide a valid search mode! It's either \"name\", \"accountid\", \"playerid\", or \"auto\".")
|
|
49
100
|
|
|
50
101
|
function decodeUser(array) {
|
|
51
|
-
let accName = array[1];
|
|
52
|
-
let playerID = Number(array[3]);
|
|
53
|
-
let secretCoins = Number(array[5]);
|
|
54
|
-
let userCoins = Number(array[7]);
|
|
55
|
-
let c1 = array[9];
|
|
56
|
-
let c2 = array[11];
|
|
57
|
-
let stars = Number(array[15]);
|
|
58
|
-
let moons = Number(array[17]);
|
|
59
|
-
let diamonds = Number(array[19]);
|
|
60
|
-
let demons = Number(array[21]);
|
|
61
|
-
let cp = Number(array[23]);
|
|
62
|
-
let msg = array[25];
|
|
63
|
-
let friendReqs = array[27];
|
|
64
|
-
let commentHistory = array[29];
|
|
65
|
-
let yt = array[31];
|
|
66
|
-
let cube = Number(array[33]);
|
|
67
|
-
let ship = Number(array[35]);
|
|
68
|
-
let ball = Number(array[37]);
|
|
69
|
-
let ufo = Number(array[39]);
|
|
70
|
-
let wave = Number(array[41]);
|
|
71
|
-
let robot = Number(array[43]);
|
|
72
|
-
let spider = Number(array[47]);
|
|
73
|
-
let swing = Number(array[51]);
|
|
74
|
-
let jetpack = Number(array[53]);
|
|
75
|
-
let
|
|
76
|
-
let
|
|
77
|
-
let
|
|
78
|
-
let
|
|
79
|
-
let
|
|
80
|
-
let
|
|
81
|
-
let
|
|
102
|
+
let accName = array[1]; // 1:
|
|
103
|
+
let playerID = Number(array[3]); // 2:
|
|
104
|
+
let secretCoins = Number(array[5]); // 13:
|
|
105
|
+
let userCoins = Number(array[7]); // 17:
|
|
106
|
+
let c1 = array[9]; // 10:
|
|
107
|
+
let c2 = array[11]; // 11:
|
|
108
|
+
let stars = Number(array[15]); // 3:
|
|
109
|
+
let moons = Number(array[17]); // 52:
|
|
110
|
+
let diamonds = Number(array[19]); // 46:
|
|
111
|
+
let demons = Number(array[21]); // 4:
|
|
112
|
+
let cp = Number(array[23]); // 8:
|
|
113
|
+
let msg = array[25]; // 18:
|
|
114
|
+
let friendReqs = array[27]; // 19:
|
|
115
|
+
let commentHistory = array[29]; // 50:
|
|
116
|
+
let yt = array[31]; // 20:
|
|
117
|
+
let cube = Number(array[33]); // 21:
|
|
118
|
+
let ship = Number(array[35]); // 22:
|
|
119
|
+
let ball = Number(array[37]); // 23:
|
|
120
|
+
let ufo = Number(array[39]); // 24:
|
|
121
|
+
let wave = Number(array[41]); // 25:
|
|
122
|
+
let robot = Number(array[43]); // 26:
|
|
123
|
+
let spider = Number(array[47]); // 43:
|
|
124
|
+
let swing = Number(array[51]); // 53:
|
|
125
|
+
let jetpack = Number(array[53]); // 54:
|
|
126
|
+
let trail = Number(array[13]); // 51:
|
|
127
|
+
let glow = Boolean(Number(array[45])); // 28:
|
|
128
|
+
let explosion = Number(array[49]); // 48:
|
|
129
|
+
let rank = Number(array[81]); // 30:
|
|
130
|
+
let accID = Number(array[55]); // 16:
|
|
131
|
+
let twitter = array[59]; // 44:
|
|
132
|
+
let twitch = array[61]; // 45:
|
|
133
|
+
let instagram = array[63]; // 59:
|
|
134
|
+
let tiktok = array[65]; // 60:
|
|
135
|
+
let discord = array[67]; // 58:
|
|
136
|
+
let custom = array[69]; // 61:
|
|
137
|
+
let mod = array[71]; // 49:
|
|
138
|
+
let completedDemons = array[73].split(","); // 55:
|
|
139
|
+
let completedClassicLevels = array[75].split(","); // 56:
|
|
140
|
+
let completedPlatformers = array[77].split(","); // 57:
|
|
82
141
|
|
|
83
142
|
let msgObj = {
|
|
84
143
|
0: "all",
|
|
@@ -120,6 +179,7 @@ module.exports = {
|
|
|
120
179
|
spiderID: spider,
|
|
121
180
|
swingID: swing,
|
|
122
181
|
jetpackID: jetpack,
|
|
182
|
+
trailID: trail,
|
|
123
183
|
explosionID: explosion,
|
|
124
184
|
glow: glow,
|
|
125
185
|
messages: msgObj[msg],
|
|
@@ -128,7 +188,45 @@ module.exports = {
|
|
|
128
188
|
mod: modObj[mod],
|
|
129
189
|
youtube: yt,
|
|
130
190
|
twitter: twitter,
|
|
131
|
-
twitch: twitch
|
|
191
|
+
twitch: twitch,
|
|
192
|
+
instagram: instagram,
|
|
193
|
+
tiktok: tiktok,
|
|
194
|
+
discord: discord,
|
|
195
|
+
custom: custom,
|
|
196
|
+
completedClassicLevels: {
|
|
197
|
+
auto: Number(completedClassicLevels[0]),
|
|
198
|
+
easy: Number(completedClassicLevels[1]),
|
|
199
|
+
normal: Number(completedClassicLevels[2]),
|
|
200
|
+
hard: Number(completedClassicLevels[3]),
|
|
201
|
+
harder: Number(completedClassicLevels[4]),
|
|
202
|
+
insane: Number(completedClassicLevels[5]),
|
|
203
|
+
daily: Number(completedClassicLevels[6]),
|
|
204
|
+
gauntlet: Number(completedClassicLevels[7])
|
|
205
|
+
},
|
|
206
|
+
completedPlatformers: {
|
|
207
|
+
auto: Number(completedPlatformers[0]),
|
|
208
|
+
easy: Number(completedPlatformers[1]),
|
|
209
|
+
normal: Number(completedPlatformers[2]),
|
|
210
|
+
hard: Number(completedPlatformers[3]),
|
|
211
|
+
harder: Number(completedPlatformers[4]),
|
|
212
|
+
insane: Number(completedPlatformers[5])
|
|
213
|
+
},
|
|
214
|
+
completedClassicDemons: {
|
|
215
|
+
easy: Number(completedDemons[0]),
|
|
216
|
+
medium: Number(completedDemons[1]),
|
|
217
|
+
hard: Number(completedDemons[2]),
|
|
218
|
+
insane: Number(completedDemons[3]),
|
|
219
|
+
extreme: Number(completedDemons[4]),
|
|
220
|
+
weekly: Number(completedDemons[10]),
|
|
221
|
+
gauntlet: Number(completedDemons[11])
|
|
222
|
+
},
|
|
223
|
+
completedPlatformerDemons: {
|
|
224
|
+
easy: Number(completedDemons[5]),
|
|
225
|
+
medium: Number(completedDemons[6]),
|
|
226
|
+
hard: Number(completedDemons[7]),
|
|
227
|
+
insane: Number(completedDemons[8]),
|
|
228
|
+
extreme: Number(completedDemons[9])
|
|
229
|
+
}
|
|
132
230
|
}
|
|
133
231
|
}
|
|
134
232
|
|
|
@@ -137,7 +235,7 @@ module.exports = {
|
|
|
137
235
|
targetAccountID: name,
|
|
138
236
|
secret: "Wmfd2893gb7"
|
|
139
237
|
});
|
|
140
|
-
if (res.data == -1)
|
|
238
|
+
if (res.data == -1) throw new Error(`-1: Player not found`);
|
|
141
239
|
let accArray = res.data.split(":");
|
|
142
240
|
|
|
143
241
|
return decodeUser(accArray);
|
|
@@ -148,8 +246,8 @@ module.exports = {
|
|
|
148
246
|
str: name,
|
|
149
247
|
secret: "Wmfd2893gb7"
|
|
150
248
|
});
|
|
151
|
-
if (search.data == -1)
|
|
152
|
-
let targetAccID = search.data.split(":")[
|
|
249
|
+
if (search.data == -1) throw new Error(`-1: Player not found`);
|
|
250
|
+
let targetAccID = search.data.split(":")[23];
|
|
153
251
|
|
|
154
252
|
let res = await gjReq("getGJUserInfo20", {
|
|
155
253
|
targetAccountID: targetAccID,
|
package/functions/getSongInfo.js
CHANGED
|
@@ -12,11 +12,11 @@ module.exports = {
|
|
|
12
12
|
/**
|
|
13
13
|
* Searches for a song on Newgrounds or in the internal Geometry Dash song library.
|
|
14
14
|
* @param {number} song - The song ID.
|
|
15
|
-
* @returns {Song}
|
|
15
|
+
* @returns {Song} Returns the song object, or an empty object containing only the song ID if the song hasn't been found.
|
|
16
16
|
*/
|
|
17
17
|
getSongInfo: async function (song) {
|
|
18
18
|
if (isNaN(song)) throw new Error("Please provide a valid song ID.");
|
|
19
|
-
const { gjReq } = require("../gjReq");
|
|
19
|
+
const { gjReq } = require("../misc/gjReq");
|
|
20
20
|
|
|
21
21
|
const data = {
|
|
22
22
|
songID: song,
|
|
@@ -24,7 +24,7 @@ module.exports = {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
let res = await gjReq('getGJSongInfo', data);
|
|
27
|
-
if (res.data == -2
|
|
27
|
+
if (res.data == -2 || res.data == -1) return { id: Number(song) };
|
|
28
28
|
let rawSong = res.data.split("~|~");
|
|
29
29
|
|
|
30
30
|
let link = decodeURIComponent(rawSong[13]);
|
package/functions/getTab.js
CHANGED
|
@@ -9,7 +9,7 @@ module.exports = {
|
|
|
9
9
|
let tabs = { trending: 3, recent: 4, featured: 6, magic: 7, awarded: 11, sent: 27 }
|
|
10
10
|
if (!tabs[tab.toLowerCase()]) throw new Error('Please provide a valid tab! Possible tabs: "trending", "recent", "featured", "magic", "awarded", "sent".');
|
|
11
11
|
|
|
12
|
-
const { gjReq } = require("../gjReq");
|
|
12
|
+
const { gjReq } = require("../misc/gjReq");
|
|
13
13
|
let GJDecode = require("../misc/GJDecode");
|
|
14
14
|
const { decodeSearchResults } = new GJDecode;
|
|
15
15
|
const res = await gjReq("getGJLevels21", {
|
|
@@ -18,7 +18,7 @@ module.exports = {
|
|
|
18
18
|
secret: "Wmfd2893gb7"
|
|
19
19
|
});
|
|
20
20
|
if (res.data == -1) return [];
|
|
21
|
-
|
|
21
|
+
|
|
22
22
|
return decodeSearchResults(res.data);
|
|
23
23
|
}
|
|
24
24
|
}
|
package/functions/getTop100.js
CHANGED
|
@@ -6,7 +6,7 @@ module.exports = {
|
|
|
6
6
|
getTop100: async function () {
|
|
7
7
|
let GJDecode = require("../misc/GJDecode");
|
|
8
8
|
const { decodeScoresUser } = new GJDecode;
|
|
9
|
-
const { gjReq } = require("../gjReq");
|
|
9
|
+
const { gjReq } = require("../misc/gjReq");
|
|
10
10
|
|
|
11
11
|
const data = {
|
|
12
12
|
secret: "Wmfd2893gb7",
|
package/functions/getTopLists.js
CHANGED
|
@@ -5,7 +5,7 @@ module.exports = {
|
|
|
5
5
|
* @returns {import("./searchLists").List[]}
|
|
6
6
|
*/
|
|
7
7
|
getTopLists: async function (page = 1) {
|
|
8
|
-
const { gjReq } = require("../gjReq");
|
|
8
|
+
const { gjReq } = require("../misc/gjReq");
|
|
9
9
|
const GJDecode = require("../misc/GJDecode");
|
|
10
10
|
const { decodeLists } = new GJDecode;
|
|
11
11
|
const res = await gjReq("getGJLevelLists", {
|
|
@@ -8,16 +8,16 @@ module.exports = {
|
|
|
8
8
|
getUserLevels: async function (username, page = 1) {
|
|
9
9
|
if (!username) throw new Error("Please provide a username or player ID!");
|
|
10
10
|
|
|
11
|
-
const { gjReq } = require("../gjReq
|
|
11
|
+
const { gjReq } = require("../misc/gjReq");
|
|
12
12
|
let GJDecode = require("../misc/GJDecode.js");
|
|
13
13
|
const { decodeSearchResults } = new GJDecode;
|
|
14
|
-
let playerID=username;
|
|
14
|
+
let playerID = username;
|
|
15
15
|
if (isNaN(username)) {
|
|
16
16
|
let search = await gjReq("getGJUsers20", {
|
|
17
17
|
str: username,
|
|
18
18
|
secret: "Wmfd2893gb7"
|
|
19
19
|
});
|
|
20
|
-
if (search.data == -1)
|
|
20
|
+
if (search.data == -1) throw new Error(`-1: Player "${username}" not found`);
|
|
21
21
|
playerID = search.data.split(":")[3];
|
|
22
22
|
}
|
|
23
23
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
module.exports = {
|
|
2
2
|
/**
|
|
3
3
|
* Gets the current weekly demon.
|
|
4
|
-
* @returns {import("./
|
|
4
|
+
* @returns {import("./downloadLevel").Level}
|
|
5
5
|
*/
|
|
6
6
|
getWeeklyDemon: async function () {
|
|
7
|
-
const {
|
|
8
|
-
let res = await
|
|
7
|
+
const { downloadLevel } = require("./downloadLevel");
|
|
8
|
+
let res = await downloadLevel(-2);
|
|
9
9
|
return res;
|
|
10
10
|
}
|
|
11
11
|
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
/**
|
|
3
|
+
* Removes a friend.
|
|
4
|
+
* @param {string} target - The friend to be removed.
|
|
5
|
+
* @param {string} username - The removing person's username or player ID.
|
|
6
|
+
* @param {string} password - The removing person's password.
|
|
7
|
+
* @returns {number} Returns 1 if everything's OK, or -1 if something went wrong.
|
|
8
|
+
*/
|
|
9
|
+
removeFriend: async function (target, username, password) {
|
|
10
|
+
if (!target) throw new Error("Please provide the target's player ID or username!");
|
|
11
|
+
if (!username) throw new Error("Please provide the player ID or username!");
|
|
12
|
+
if (!password) throw new Error("Please provide the password!");
|
|
13
|
+
|
|
14
|
+
const { gjReq } = require("../misc/gjReq");
|
|
15
|
+
const { gjp2 } = require("../misc/gjp2");
|
|
16
|
+
|
|
17
|
+
let userSearch = await gjReq("getGJUsers20", {
|
|
18
|
+
str: username,
|
|
19
|
+
secret: "Wmfd2893gb7"
|
|
20
|
+
});
|
|
21
|
+
if (userSearch.data == -1) throw new Error(`-1: Player with the ID or player username "${username}" not found`);
|
|
22
|
+
let userAccID = userSearch.data.split(":")[23];
|
|
23
|
+
|
|
24
|
+
let recSearch = await gjReq("getGJUsers20", {
|
|
25
|
+
str: target,
|
|
26
|
+
secret: "Wmfd2893gb7"
|
|
27
|
+
});
|
|
28
|
+
if (recSearch.data == -1) throw new Error(`-1: Player with the ID or player username "${target}" not found`);
|
|
29
|
+
let targetAccID = recSearch.data.split(":")[23];
|
|
30
|
+
|
|
31
|
+
let res = await gjReq("removeGJFriend20", {
|
|
32
|
+
secret: "Wmfd2893gb7",
|
|
33
|
+
targetAccountID: targetAccID,
|
|
34
|
+
accountID: userAccID,
|
|
35
|
+
gjp2: gjp2(password)
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
return Number(res.data);
|
|
39
|
+
}
|
|
40
|
+
}
|
package/functions/reportLevel.js
CHANGED
|
@@ -2,11 +2,11 @@ module.exports = {
|
|
|
2
2
|
/**
|
|
3
3
|
* Reports a level.
|
|
4
4
|
* @param {number} level - The level ID.
|
|
5
|
-
* @returns {1}
|
|
5
|
+
* @returns {1} Always returns 1, regardless of whether the level was reported or not.
|
|
6
6
|
*/
|
|
7
7
|
reportLevel: async function (level) {
|
|
8
8
|
if (isNaN(level)) throw new Error("Please provide a valid level ID.");
|
|
9
|
-
const { gjReq } = require("../gjReq");
|
|
9
|
+
const { gjReq } = require("../misc/gjReq");
|
|
10
10
|
|
|
11
11
|
let res = await gjReq("reportGJLevel", {
|
|
12
12
|
levelID: level,
|
|
@@ -6,7 +6,7 @@ module.exports = {
|
|
|
6
6
|
* @returns {import("./getLevelByID").Level[]}
|
|
7
7
|
*/
|
|
8
8
|
searchLevels: async function (query, page = 1) {
|
|
9
|
-
const { gjReq } = require("../gjReq");
|
|
9
|
+
const { gjReq } = require("../misc/gjReq");
|
|
10
10
|
let GJDecode = require("../misc/GJDecode");
|
|
11
11
|
const { decodeSearchResults } = new GJDecode;
|
|
12
12
|
|
package/functions/searchLists.js
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* @property {boolean} disliked - Whether the list is disliked (i.e. if the likes count is less than 0).
|
|
14
14
|
* @property {Array<Number>} levels - The array of level IDs in the list.
|
|
15
15
|
* @property {number} required - The amount of completed levels required to get the reward.
|
|
16
|
-
* @property {number} uploadedUnix - The
|
|
16
|
+
* @property {number} uploadedUnix - The Unix timestamp of the list's upload date (GMT timezone).
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
module.exports = {
|
|
@@ -24,7 +24,7 @@ module.exports = {
|
|
|
24
24
|
* @returns {List[]}
|
|
25
25
|
*/
|
|
26
26
|
searchLists: async function (query, page = 1) {
|
|
27
|
-
const { gjReq } = require("../gjReq");
|
|
27
|
+
const { gjReq } = require("../misc/gjReq");
|
|
28
28
|
const GJDecode = require("../misc/GJDecode");
|
|
29
29
|
const { decodeLists } = new GJDecode;
|
|
30
30
|
const res = await gjReq("getGJLevelLists", {
|
package/functions/unblockUser.js
CHANGED
|
@@ -1,43 +1,42 @@
|
|
|
1
1
|
module.exports = {
|
|
2
2
|
/**
|
|
3
3
|
* Unblocks a specified user.
|
|
4
|
-
* @param {string} target - The player
|
|
4
|
+
* @param {string} target - The player to be unblocked.
|
|
5
5
|
* @param {string} username - The unblocking person's username or player ID.
|
|
6
6
|
* @param {string} password - The unblocking person's password.
|
|
7
|
-
* @returns {number} Returns 1 if everything's OK,
|
|
7
|
+
* @returns {number} Returns 1 if everything's OK, or -1 if something went wrong.
|
|
8
8
|
*/
|
|
9
9
|
unblockUser: async function (target, username, password) {
|
|
10
|
-
if (!target) throw new Error("Please provide
|
|
11
|
-
if (!username) throw new Error("Please provide
|
|
12
|
-
if (!password) throw new Error("Please provide
|
|
10
|
+
if (!target) throw new Error("Please provide the target's player ID or username!");
|
|
11
|
+
if (!username) throw new Error("Please provide the player ID or username!");
|
|
12
|
+
if (!password) throw new Error("Please provide the password!");
|
|
13
13
|
|
|
14
|
-
const { gjReq } = require("../gjReq");
|
|
15
|
-
const
|
|
16
|
-
const xor = new XOR;
|
|
14
|
+
const { gjReq } = require("../misc/gjReq");
|
|
15
|
+
const { gjp2 } = require("../misc/gjp2");
|
|
17
16
|
|
|
18
17
|
let userSearch = await gjReq("getGJUsers20", {
|
|
19
18
|
str: username,
|
|
20
19
|
secret: "Wmfd2893gb7"
|
|
21
20
|
});
|
|
22
|
-
if (userSearch.data == -1) throw new Error(
|
|
23
|
-
let userAccID = userSearch.data.split(":")[
|
|
21
|
+
if (userSearch.data == -1) throw new Error(`-1: Player with the ID or player username "${username}" not found`);
|
|
22
|
+
let userAccID = userSearch.data.split(":")[23];
|
|
24
23
|
|
|
25
24
|
let recSearch = await gjReq("getGJUsers20", {
|
|
26
25
|
str: target,
|
|
27
26
|
secret: "Wmfd2893gb7"
|
|
28
27
|
});
|
|
29
|
-
if (recSearch.data == -1) throw new Error(
|
|
30
|
-
let targetAccID = recSearch.data.split(":")[
|
|
28
|
+
if (recSearch.data == -1) throw new Error(`-1: Player with the ID or player username "${target}" not found`);
|
|
29
|
+
let targetAccID = recSearch.data.split(":")[23];
|
|
31
30
|
|
|
32
31
|
const data = {
|
|
33
32
|
secret: "Wmfd2893gb7",
|
|
34
33
|
targetAccountID: targetAccID,
|
|
35
34
|
accountID: userAccID,
|
|
36
|
-
|
|
35
|
+
gjp2: gjp2(password)
|
|
37
36
|
}
|
|
38
37
|
|
|
39
38
|
let res = await gjReq("unblockGJUser20", data);
|
|
40
39
|
|
|
41
|
-
return res.data;
|
|
40
|
+
return Number(res.data);
|
|
42
41
|
}
|
|
43
42
|
}
|
|
@@ -2,30 +2,29 @@ module.exports = {
|
|
|
2
2
|
/**
|
|
3
3
|
* Updates the description on a level.
|
|
4
4
|
* @param {number} level - The level ID.
|
|
5
|
-
* @param {string} desc - The new description.
|
|
5
|
+
* @param {string} desc - The new description. Leave empty to reset to "(No description provided)".
|
|
6
6
|
* @param {string} username - The level uploader's username or player ID.
|
|
7
7
|
* @param {string} password - The level uploader's password.
|
|
8
|
-
* @returns {number} Returns 1 if everything's OK,
|
|
8
|
+
* @returns {number} Returns 1 if everything's OK, or -1 if something went wrong.
|
|
9
9
|
*/
|
|
10
10
|
updateLevelDesc: async function (level, desc, username, password) {
|
|
11
11
|
if (isNaN(level)) throw new Error("Please provide a valid level ID!");
|
|
12
|
-
if (!username) throw new Error("Please provide
|
|
13
|
-
if (!password) throw new Error("Please provide
|
|
12
|
+
if (!username) throw new Error("Please provide the player ID or username!");
|
|
13
|
+
if (!password) throw new Error("Please provide the password!");
|
|
14
14
|
|
|
15
|
-
const { gjReq } = require("../gjReq");
|
|
16
|
-
const
|
|
17
|
-
const xor = new XOR;
|
|
15
|
+
const { gjReq } = require("../misc/gjReq");
|
|
16
|
+
const { gjp2 } = require("../misc/gjp2");
|
|
18
17
|
|
|
19
18
|
let search = await gjReq("getGJUsers20", {
|
|
20
19
|
str: username,
|
|
21
20
|
secret: "Wmfd2893gb7"
|
|
22
21
|
});
|
|
23
|
-
if (search.data == -1) throw new Error(
|
|
24
|
-
let accID = search.data.split(":")[
|
|
22
|
+
if (search.data == -1) throw new Error(`-1: Player with the ID or player username "${username}" not found`);
|
|
23
|
+
let accID = search.data.split(":")[23];
|
|
25
24
|
|
|
26
25
|
let res = await gjReq("updateGJDesc20", {
|
|
27
26
|
accountID: accID,
|
|
28
|
-
|
|
27
|
+
gjp2: gjp2(password),
|
|
29
28
|
levelID: level,
|
|
30
29
|
levelDesc: Buffer.from(desc).toString("base64"),
|
|
31
30
|
secret: "Wmfd2893gb7"
|
|
@@ -4,33 +4,32 @@ module.exports = {
|
|
|
4
4
|
* @param {string} content - The account post content.
|
|
5
5
|
* @param {string} username - The poster's username or player ID.
|
|
6
6
|
* @param {string} password - The poster's password.
|
|
7
|
-
* @returns {number} Returns
|
|
7
|
+
* @returns {number} Returns the published post's ID, or -1 if something went wrong.
|
|
8
8
|
*/
|
|
9
9
|
uploadAccountPost: async function (content, username, password) {
|
|
10
|
-
if (!content) throw new Error("Please provide
|
|
11
|
-
if (!username) throw new Error("Please provide
|
|
12
|
-
if (!password) throw new Error("Please provide
|
|
10
|
+
if (!content) throw new Error("Please provide the account post content!");
|
|
11
|
+
if (!username) throw new Error("Please provide the username or the player ID!");
|
|
12
|
+
if (!password) throw new Error("Please provide the password!");
|
|
13
13
|
|
|
14
|
-
const { gjReq } = require("../gjReq");
|
|
15
|
-
const
|
|
16
|
-
const xor = new XOR;
|
|
14
|
+
const { gjReq } = require("../misc/gjReq");
|
|
15
|
+
const { gjp2 } = require("../misc/gjp2");
|
|
17
16
|
|
|
18
17
|
let search = await gjReq("getGJUsers20", {
|
|
19
18
|
str: username,
|
|
20
19
|
secret: "Wmfd2893gb7"
|
|
21
20
|
});
|
|
22
|
-
if (search.data == -1) throw new Error(
|
|
23
|
-
let accID = search.data.split(":")[
|
|
21
|
+
if (search.data == -1) throw new Error(`-1: Player with the ID or player username "${username}" not found`);
|
|
22
|
+
let accID = search.data.split(":")[23];
|
|
24
23
|
|
|
25
24
|
let res = await gjReq("uploadGJAccComment20", {
|
|
26
25
|
accountID: accID,
|
|
27
26
|
secret: "Wmfd2893gb7",
|
|
28
|
-
|
|
27
|
+
gjp2: gjp2(password),
|
|
29
28
|
comment: Buffer.from(content).toString("base64"),
|
|
30
29
|
cType: 1
|
|
31
30
|
});
|
|
32
31
|
if (res.status == 500) throw new Error("500 Error: couldn't post!");
|
|
33
32
|
|
|
34
|
-
return res.data;
|
|
33
|
+
return Number(res.data);
|
|
35
34
|
}
|
|
36
35
|
}
|
|
@@ -6,16 +6,16 @@ module.exports = {
|
|
|
6
6
|
* @param {string} username - The commenter's username or player ID.
|
|
7
7
|
* @param {string} password - The commenter's password.
|
|
8
8
|
* @param {number} percent - The achieved level percentage to be displayed on the comment.
|
|
9
|
-
* @returns {number} Returns 1 if everything's OK,
|
|
9
|
+
* @returns {number} Returns 1 if everything's OK, or -1 if something went wrong.
|
|
10
10
|
*/
|
|
11
11
|
uploadComment: async function (comment, level, username, password, percent = 0) {
|
|
12
|
-
if (!comment) throw new Error("Please provide
|
|
13
|
-
if (!level) throw new Error("Please provide
|
|
14
|
-
if (!username) throw new Error("Please provide
|
|
15
|
-
if (!password) throw new Error("Please provide
|
|
12
|
+
if (!comment) throw new Error("Please provide the comment!");
|
|
13
|
+
if (!level) throw new Error("Please provide the level ID!");
|
|
14
|
+
if (!username) throw new Error("Please provide the username or the player ID!");
|
|
15
|
+
if (!password) throw new Error("Please provide the password!");
|
|
16
16
|
if (Number(percent) > 100) throw new Error("The percentage cannot be more than 100!");
|
|
17
17
|
|
|
18
|
-
const { gjReq } = require("../gjReq
|
|
18
|
+
const { gjReq } = require("../misc/gjReq");
|
|
19
19
|
const crypto = require('crypto')
|
|
20
20
|
|
|
21
21
|
function sha1(data) { return crypto.createHash("sha1").update(data, "binary").digest("hex"); }
|
|
@@ -24,20 +24,21 @@ module.exports = {
|
|
|
24
24
|
str: username,
|
|
25
25
|
secret: "Wmfd2893gb7"
|
|
26
26
|
});
|
|
27
|
-
if (search.data == -1) throw new Error(
|
|
28
|
-
let
|
|
29
|
-
let accID = search.data.split(":")[
|
|
27
|
+
if (search.data == -1) throw new Error(`-1: Player with the ID or player username "${username}" not found`);
|
|
28
|
+
let name = search.data.split(":")[1];
|
|
29
|
+
let accID = search.data.split(":")[23];
|
|
30
30
|
|
|
31
|
-
const XOR = require("../xor
|
|
31
|
+
const XOR = require("../misc/xor");
|
|
32
32
|
const xor = new XOR;
|
|
33
|
+
const { gjp2 } = require("../misc/gjp2");
|
|
33
34
|
|
|
34
|
-
let chkStr =
|
|
35
|
+
let chkStr = name.toLowerCase() + Buffer.from(comment).toString("base64") + level + percent + "0xPT6iUrtws0J";
|
|
35
36
|
let chk = xor.encrypt(sha1(chkStr), 29481);
|
|
36
37
|
|
|
37
38
|
let res = await gjReq("uploadGJComment21", {
|
|
38
39
|
accountID: accID,
|
|
39
|
-
|
|
40
|
-
userName:
|
|
40
|
+
gjp2: gjp2(password),
|
|
41
|
+
userName: name.toLowerCase(),
|
|
41
42
|
comment: Buffer.from(comment).toString("base64"),
|
|
42
43
|
levelID: level,
|
|
43
44
|
percent: percent,
|
|
@@ -45,10 +46,9 @@ module.exports = {
|
|
|
45
46
|
secret: "Wmfd2893gb7"
|
|
46
47
|
});
|
|
47
48
|
|
|
48
|
-
if (res.data == -1) throw new Error("Whoops, the servers have rejected your request!");
|
|
49
49
|
if (res.data == -10) throw new Error("You're permanently banned from commenting!");
|
|
50
50
|
if (res.data.startsWith("temp_")) throw new Error(`You're temporarily banned from commenting!\nBan duration: ${res.data.split("_")[1]} seconds\nReason: ${res.data.split("_")[2]}`);
|
|
51
51
|
|
|
52
|
-
return res.data;
|
|
52
|
+
return Number(res.data);
|
|
53
53
|
}
|
|
54
54
|
}
|