hypixel-api-reborn 11.1.0 → 11.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.
- package/.prettierrc +3 -3
- package/README.md +5 -3
- package/package.json +20 -18
- package/src/API/getAchievements.js +6 -0
- package/src/API/getChallenges.js +6 -0
- package/src/API/getGuild.js +1 -1
- package/src/API/getGuildAchievements.js +6 -0
- package/src/API/getLeaderboards.js +3 -1
- package/src/API/getPlayer.js +1 -1
- package/src/API/getQuests.js +6 -0
- package/src/API/getRecentGames.js +1 -1
- package/src/API/getServerInfo.js +3 -1
- package/src/API/getStatus.js +1 -1
- package/src/API/index.js +28 -17
- package/src/API/skyblock/getAuction.js +19 -0
- package/src/API/skyblock/{getSkyblockAuctions.js → getAuctions.js} +6 -2
- package/src/API/skyblock/{getSkyblockAuctionsByPlayer.js → getAuctionsByPlayer.js} +1 -1
- package/src/API/skyblock/getBingo.js +8 -0
- package/src/API/skyblock/getBingoByPlayer.js +14 -0
- package/src/API/skyblock/getFireSales.js +7 -0
- package/src/API/skyblock/getGovernment.js +8 -0
- package/src/API/skyblock/{getSkyblockMember.js → getMember.js} +9 -3
- package/src/API/skyblock/getMuseum.js +14 -0
- package/src/API/skyblock/{getSkyblockProfiles.js → getProfiles.js} +13 -7
- package/src/Client.js +88 -14
- package/src/Errors.js +38 -17
- package/src/Private/rateLimit.js +10 -2
- package/src/Private/requests.js +19 -7
- package/src/Private/updater.js +9 -5
- package/src/Private/uuidCache.js +23 -29
- package/src/Private/validate.js +20 -9
- package/src/index.js +9 -0
- package/src/structures/APIIncident.js +3 -9
- package/src/structures/Boosters/Booster.js +5 -5
- package/src/structures/Color.js +93 -48
- package/src/structures/Game.js +3 -1
- package/src/structures/Guild/Guild.js +21 -17
- package/src/structures/Guild/GuildMember.js +6 -6
- package/src/structures/Guild/GuildRank.js +2 -2
- package/src/structures/MiniGames/Arcade.js +22 -17
- package/src/structures/MiniGames/BedWars.js +152 -24
- package/src/structures/MiniGames/Duels.js +84 -23
- package/src/structures/MiniGames/MegaWalls.js +3 -1
- package/src/structures/MiniGames/MurderMystery.js +2 -2
- package/src/structures/MiniGames/Pit.js +231 -2
- package/src/structures/MiniGames/PitInventoryItem.js +43 -0
- package/src/structures/MiniGames/SkyWars.js +19 -14
- package/src/structures/MiniGames/SmashHeroes.js +1 -1
- package/src/structures/MiniGames/TNTGames.js +1 -1
- package/src/structures/MiniGames/UHC.js +21 -3
- package/src/structures/Player.js +16 -20
- package/src/structures/PlayerCosmetics.js +64 -10
- package/src/structures/ServerInfo.js +1 -1
- package/src/structures/SkyBlock/Auctions/Auction.js +3 -1
- package/src/structures/SkyBlock/Auctions/AuctionInfo.js +1 -0
- package/src/structures/SkyBlock/Auctions/BaseAuction.js +1 -0
- package/src/structures/SkyBlock/Auctions/Bid.js +1 -0
- package/src/structures/SkyBlock/Auctions/PartialAuction.js +1 -0
- package/src/structures/SkyBlock/PlayerBingo.js +56 -0
- package/src/structures/SkyBlock/SkyblockInventoryItem.js +86 -18
- package/src/structures/SkyBlock/SkyblockMember.js +252 -144
- package/src/structures/SkyBlock/SkyblockMuseum.js +60 -0
- package/src/structures/SkyBlock/SkyblockMuseumItem.js +54 -0
- package/src/structures/SkyBlock/SkyblockPet.js +1 -0
- package/src/structures/SkyBlock/SkyblockProfile.js +37 -23
- package/src/structures/SkyBlock/Static/Bingo.js +102 -0
- package/src/structures/SkyBlock/Static/BingoData.js +45 -0
- package/src/structures/SkyBlock/Static/Candidate.js +40 -0
- package/src/structures/SkyBlock/Static/FireSale.js +55 -0
- package/src/structures/SkyBlock/Static/Government.js +74 -0
- package/src/structures/SkyBlock/Static/Perk.js +24 -0
- package/src/structures/Static/Achievement.js +86 -0
- package/src/structures/Static/AchievementTier.js +33 -0
- package/src/structures/Static/Achievements.js +30 -0
- package/src/structures/Static/Challenges.js +29 -0
- package/src/structures/Static/GameAchievements.js +36 -0
- package/src/structures/Static/GameChallenges.js +40 -0
- package/src/structures/Static/GameQuests.js +24 -0
- package/src/structures/Static/GuildAchievements.js +34 -0
- package/src/structures/Static/Quest.js +66 -0
- package/src/structures/Static/Quests.js +31 -0
- package/src/structures/Status.js +2 -2
- package/src/utils/Constants.js +382 -41
- package/src/utils/SkyblockUtils.js +12 -7
- package/src/utils/guildExp.js +4 -1
- package/src/utils/removeSnakeCase.js +9 -2
- package/src/utils/romanize.js +32 -1
- package/src/utils/toIGN.js +6 -2
- package/src/utils/toUuid.js +10 -5
- package/typings/index.d.ts +985 -295
- /package/src/API/skyblock/{getSkyblockBazaar.js → getBazaar.js} +0 -0
- /package/src/API/skyblock/{getEndedSkyblockAuctions.js → getEndedAuctions.js} +0 -0
- /package/src/API/skyblock/{getSkyblockNews.js → getNews.js} +0 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// eslint-disable-next-line require-jsdoc
|
|
2
|
-
const single = (obj) =>
|
|
2
|
+
const single = (obj) =>
|
|
3
|
+
Object.keys(obj).reduce((pV, cV) => ({ ...pV, [cV.replace(/_[a-z]/gi, (x) => x[1].toUpperCase())]: obj[cV] }), {});
|
|
3
4
|
// eslint-disable-next-line require-jsdoc
|
|
4
5
|
function validateJSON(obj) {
|
|
5
6
|
return typeof obj === 'object' && JSON.stringify(obj)[0] === '{';
|
|
@@ -7,7 +8,13 @@ function validateJSON(obj) {
|
|
|
7
8
|
// eslint-disable-next-line require-jsdoc
|
|
8
9
|
function recursive(obj, lowerCase = false) {
|
|
9
10
|
if (!validateJSON(obj)) return obj;
|
|
10
|
-
return Object.keys(obj).reduce(
|
|
11
|
+
return Object.keys(obj).reduce(
|
|
12
|
+
(pV, cV) => ({
|
|
13
|
+
...pV,
|
|
14
|
+
[(lowerCase ? cV : cV.toLowerCase()).replace(/_[a-z]/gi, (x) => x[1].toUpperCase())]: recursive(obj[cV])
|
|
15
|
+
}),
|
|
16
|
+
{}
|
|
17
|
+
);
|
|
11
18
|
}
|
|
12
19
|
// eslint-disable-next-line require-jsdoc
|
|
13
20
|
function removeSnakeCaseString(str) {
|
package/src/utils/romanize.js
CHANGED
|
@@ -1,7 +1,38 @@
|
|
|
1
1
|
module.exports = (num) => {
|
|
2
2
|
if (isNaN(num)) return NaN;
|
|
3
3
|
const digits = String(+num).split('');
|
|
4
|
-
const key = [
|
|
4
|
+
const key = [
|
|
5
|
+
'',
|
|
6
|
+
'C',
|
|
7
|
+
'CC',
|
|
8
|
+
'CCC',
|
|
9
|
+
'CD',
|
|
10
|
+
'D',
|
|
11
|
+
'DC',
|
|
12
|
+
'DCC',
|
|
13
|
+
'DCCC',
|
|
14
|
+
'CM',
|
|
15
|
+
'',
|
|
16
|
+
'X',
|
|
17
|
+
'XX',
|
|
18
|
+
'XXX',
|
|
19
|
+
'XL',
|
|
20
|
+
'L',
|
|
21
|
+
'LX',
|
|
22
|
+
'LXX',
|
|
23
|
+
'LXXX',
|
|
24
|
+
'XC',
|
|
25
|
+
'',
|
|
26
|
+
'I',
|
|
27
|
+
'II',
|
|
28
|
+
'III',
|
|
29
|
+
'IV',
|
|
30
|
+
'V',
|
|
31
|
+
'VI',
|
|
32
|
+
'VII',
|
|
33
|
+
'VIII',
|
|
34
|
+
'IX'
|
|
35
|
+
];
|
|
5
36
|
let roman = '';
|
|
6
37
|
let i = 3;
|
|
7
38
|
while (i--) {
|
package/src/utils/toIGN.js
CHANGED
|
@@ -2,19 +2,23 @@ const fetch = require('../Private/uuidCache.js');
|
|
|
2
2
|
const isUUID = require('./isUUID.js');
|
|
3
3
|
const Errors = require('../Errors');
|
|
4
4
|
|
|
5
|
-
module.exports = async (input) => {
|
|
5
|
+
module.exports = async (input, useThirdPartyAPI = '') => {
|
|
6
6
|
if (!input) throw new Error(Errors.NO_NICKNAME_UUID);
|
|
7
7
|
if (typeof input !== 'string') throw new Error(Errors.UUID_NICKNAME_MUST_BE_A_STRING);
|
|
8
8
|
if (isUUID(input)) input = input.replace(/-/g, '');
|
|
9
9
|
else throw new Error(Errors.MALFORMED_UUID);
|
|
10
10
|
try {
|
|
11
|
-
const
|
|
11
|
+
const customUrl = useThirdPartyAPI === true ? 'https://api.minetools.eu/uuid/' : useThirdPartyAPI;
|
|
12
|
+
const url = useThirdPartyAPI ? `${customUrl}${input}` : `https://mowojang.matdoes.dev/${input}`;
|
|
13
|
+
const res = await fetch(url, input);
|
|
12
14
|
const parsedRes = await res.json();
|
|
13
15
|
if (parsedRes.error) {
|
|
14
16
|
return Promise.reject(new Error(Errors.MALFORMED_UUID));
|
|
15
17
|
}
|
|
16
18
|
return parsedRes.name;
|
|
17
19
|
} catch {
|
|
20
|
+
// 2nd try
|
|
21
|
+
if (!useThirdPartyAPI) return module.exports(input, cacheTime, true);
|
|
18
22
|
throw new Error(Errors.PLAYER_DOES_NOT_EXIST);
|
|
19
23
|
}
|
|
20
24
|
};
|
package/src/utils/toUuid.js
CHANGED
|
@@ -1,19 +1,24 @@
|
|
|
1
|
-
const fetch = require('../Private/uuidCache');
|
|
1
|
+
const fetch = require('../Private/uuidCache.js');
|
|
2
2
|
const isUUID = require('./isUUID.js');
|
|
3
3
|
const Errors = require('../Errors');
|
|
4
4
|
|
|
5
|
-
module.exports = async (input) => {
|
|
5
|
+
module.exports = async (input, cacheTime = 600, useThirdPartyAPI = '') => {
|
|
6
6
|
if (!input) throw new Error(Errors.NO_NICKNAME_UUID);
|
|
7
7
|
if (typeof input !== 'string') throw new Error(Errors.UUID_NICKNAME_MUST_BE_A_STRING);
|
|
8
8
|
if (isUUID(input)) return input.replace(/-/g, '');
|
|
9
9
|
try {
|
|
10
|
-
const
|
|
11
|
-
const
|
|
10
|
+
const customUrl = useThirdPartyAPI === true ? 'https://api.minetools.eu/uuid/' : useThirdPartyAPI;
|
|
11
|
+
const url = useThirdPartyAPI ? `${customUrl}${input}` : `https://mowojang.matdoes.dev/${input}`;
|
|
12
|
+
const res = await fetch(url, input, cacheTime);
|
|
12
13
|
if (res.status === 404) {
|
|
13
14
|
return Promise.reject(new Error(Errors.PLAYER_DOES_NOT_EXIST));
|
|
15
|
+
} else if (res.status !== 200) {
|
|
16
|
+
throw new Error('Unknown Error whilst retrieving player information');
|
|
14
17
|
}
|
|
15
|
-
return
|
|
18
|
+
return res.id;
|
|
16
19
|
} catch {
|
|
20
|
+
// 2nd Try
|
|
21
|
+
if (!useThirdPartyAPI) return module.exports(input, cacheTime, true);
|
|
17
22
|
throw new Error(Errors.PLAYER_DOES_NOT_EXIST);
|
|
18
23
|
}
|
|
19
24
|
};
|