hypixel-api-reborn 10.0.0 → 11.0.1
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 +13 -0
- package/README.md +28 -16
- package/package.json +60 -58
- package/src/API/getAPIStatus.js +8 -8
- package/src/API/getBoosters.js +6 -6
- package/src/API/getGameCounts.js +6 -6
- package/src/API/getGuild.js +18 -18
- package/src/API/getLeaderboards.js +13 -13
- package/src/API/getPlayer.js +22 -27
- package/src/API/getRecentGames.js +18 -18
- package/src/API/getServerInfo.js +66 -77
- package/src/API/getStatus.js +8 -8
- package/src/API/getWatchdogStats.js +6 -6
- package/src/API/index.js +19 -23
- package/src/API/skyblock/getEndedSkyblockAuctions.js +10 -10
- package/src/API/skyblock/getSkyblockAuctions.js +64 -64
- package/src/API/skyblock/getSkyblockAuctionsByPlayer.js +11 -11
- package/src/API/skyblock/getSkyblockBazaar.js +10 -10
- package/src/API/skyblock/getSkyblockMember.js +28 -25
- package/src/API/skyblock/getSkyblockNews.js +6 -6
- package/src/API/skyblock/getSkyblockProfiles.js +44 -41
- package/src/Client.js +406 -450
- package/src/Errors.js +44 -39
- package/src/Private/defaultCache.js +77 -78
- package/src/Private/rateLimit.js +79 -98
- package/src/Private/requests.js +65 -54
- package/src/Private/updater.js +45 -45
- package/src/Private/uuidCache.js +37 -33
- package/src/Private/validate.js +97 -97
- package/src/index.js +82 -83
- package/src/structures/APIIncident.js +78 -78
- package/src/structures/APIStatus.js +47 -47
- package/src/structures/Boosters/Booster.js +83 -87
- package/src/structures/Color.js +129 -129
- package/src/structures/Game.js +164 -160
- package/src/structures/GameCounts.js +151 -151
- package/src/structures/Guild/Guild.js +204 -218
- package/src/structures/Guild/GuildMember.js +66 -66
- package/src/structures/Guild/GuildRank.js +48 -48
- package/src/structures/ItemBytes.js +33 -36
- package/src/structures/Leaderboard.js +31 -31
- package/src/structures/MiniGames/Arcade.js +567 -569
- package/src/structures/MiniGames/ArenaBrawl.js +52 -56
- package/src/structures/MiniGames/BedWars.js +423 -351
- package/src/structures/MiniGames/BlitzSurvivalGames.js +172 -148
- package/src/structures/MiniGames/BuildBattle.js +53 -53
- package/src/structures/MiniGames/CopsAndCrims.js +90 -90
- package/src/structures/MiniGames/Duels.js +694 -630
- package/src/structures/MiniGames/MegaWalls.js +137 -137
- package/src/structures/MiniGames/MurderMystery.js +93 -93
- package/src/structures/MiniGames/Paintball.js +67 -67
- package/src/structures/MiniGames/Pit.js +19 -19
- package/src/structures/MiniGames/Quakecraft.js +101 -101
- package/src/structures/MiniGames/SkyWars.js +508 -559
- package/src/structures/MiniGames/SmashHeroes.js +144 -151
- package/src/structures/MiniGames/SpeedUHC.js +115 -57
- package/src/structures/MiniGames/TNTGames.js +116 -116
- package/src/structures/MiniGames/TurboKartRacers.js +201 -176
- package/src/structures/MiniGames/UHC.js +164 -143
- package/src/structures/MiniGames/VampireZ.js +60 -60
- package/src/structures/MiniGames/Walls.js +52 -52
- package/src/structures/MiniGames/Warlords.js +62 -62
- package/src/structures/MiniGames/WoolWars.js +123 -0
- package/src/structures/Pet.js +96 -97
- package/src/structures/Pets.js +64 -64
- package/src/structures/Player.js +433 -449
- package/src/structures/PlayerCosmetics.js +100 -95
- package/src/structures/RecentGame.js +57 -57
- package/src/structures/ServerInfo.js +78 -78
- package/src/structures/SkyBlock/Auctions/Auction.js +104 -104
- package/src/structures/SkyBlock/Auctions/AuctionInfo.js +54 -54
- package/src/structures/SkyBlock/Auctions/BaseAuction.js +45 -45
- package/src/structures/SkyBlock/Auctions/Bid.js +48 -48
- package/src/structures/SkyBlock/Auctions/PartialAuction.js +25 -25
- package/src/structures/SkyBlock/Bazzar/Order.js +38 -38
- package/src/structures/SkyBlock/Bazzar/Product.js +53 -53
- package/src/structures/SkyBlock/News/SkyblockNews.js +60 -68
- package/src/structures/SkyBlock/SkyblockInventoryItem.js +124 -130
- package/src/structures/SkyBlock/SkyblockMember.js +820 -687
- package/src/structures/SkyBlock/SkyblockPet.js +71 -71
- package/src/structures/SkyBlock/SkyblockProfile.js +60 -60
- package/src/structures/Status.js +41 -41
- package/src/structures/Watchdog/Stats.js +36 -36
- package/src/utils/Constants.js +2789 -809
- package/src/utils/SkyblockUtils.js +208 -164
- package/src/utils/arrayTools.js +4 -4
- package/src/utils/divide.js +5 -5
- package/src/utils/guildExp.js +57 -67
- package/src/utils/index.js +13 -13
- package/src/utils/isGuildID.js +3 -3
- package/src/utils/isUUID.js +5 -5
- package/src/utils/oscillation.js +15 -23
- package/src/utils/removeSnakeCase.js +22 -35
- package/src/utils/rgbToHexColor.js +8 -8
- package/src/utils/romanize.js +11 -13
- package/src/utils/toIGN.js +20 -20
- package/src/utils/toUuid.js +19 -19
- package/src/utils/varInt.js +17 -21
- package/typings/index.d.ts +3532 -2644
- package/src/API/getFriends.js +0 -14
- package/src/API/getKeyInfo.js +0 -10
- package/src/API/getRankedSkyWars.js +0 -11
- package/src/structures/Friend.js +0 -38
- package/src/structures/KeyInfo.js +0 -42
- package/src/structures/MiniGames/SkyWarsRanked.js +0 -45
package/src/Private/uuidCache.js
CHANGED
|
@@ -1,33 +1,37 @@
|
|
|
1
|
-
/* eslint-disable require-jsdoc */
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
if (
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
1
|
+
/* eslint-disable require-jsdoc */
|
|
2
|
+
const requireFetch = !globalThis.fetch;
|
|
3
|
+
const externalFetch = require('node-fetch');
|
|
4
|
+
const fetch = requireFetch ? externalFetch : globalThis.fetch;
|
|
5
|
+
const cachedUuids = new Map();
|
|
6
|
+
|
|
7
|
+
// TODO - use this for all cache models
|
|
8
|
+
|
|
9
|
+
async function putCache(response) {
|
|
10
|
+
try {
|
|
11
|
+
response = await response.json();
|
|
12
|
+
cachedUuids.set(response.id, response.name);
|
|
13
|
+
setTimeout(deleteCache, 1000 * 60 * 10, response.id);
|
|
14
|
+
} catch (e) {
|
|
15
|
+
// F
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
function deleteCache(id) {
|
|
19
|
+
return cachedUuids.delete(id);
|
|
20
|
+
}
|
|
21
|
+
function response(obj) {
|
|
22
|
+
return new fetch.Response(JSON.stringify(obj));
|
|
23
|
+
}
|
|
24
|
+
function checkHit(query) {
|
|
25
|
+
if (cachedUuids.has(query)) return response({ id: query, name: cachedUuids.get(query) });
|
|
26
|
+
const reverseSearch = Array.from(cachedUuids.entries()).find((pair) => pair[1].toLowerCase() === query.toLowerCase());
|
|
27
|
+
if (reverseSearch) return response({ id: reverseSearch[0], name: query });
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
module.exports = async (url, query) => {
|
|
31
|
+
if (checkHit(query || url)) return checkHit(query || url);
|
|
32
|
+
const res = await fetch(url);
|
|
33
|
+
const response = await res.clone().json();
|
|
34
|
+
// Don't cache 5xx
|
|
35
|
+
if (response.error !== 'Internal Server Error' && response.status < 500) setTimeout(putCache, 0, res.clone());
|
|
36
|
+
return res;
|
|
37
|
+
};
|
package/src/Private/validate.js
CHANGED
|
@@ -1,97 +1,97 @@
|
|
|
1
|
-
/* eslint-disable require-jsdoc */
|
|
2
|
-
const Errors = require('../Errors');
|
|
3
|
-
const { isStrArray, strToArray } = require('../utils/arrayTools');
|
|
4
|
-
/**
|
|
5
|
-
* Validation Class, used internally to validate provided arguments
|
|
6
|
-
*/
|
|
7
|
-
class Validation {
|
|
8
|
-
/**
|
|
9
|
-
* Check if cache options are valid
|
|
10
|
-
* @param {Object} options Global Cache Options to be validated
|
|
11
|
-
* @returns {void} Void
|
|
12
|
-
* @private
|
|
13
|
-
*/
|
|
14
|
-
validateOptions
|
|
15
|
-
if (typeof options.cacheTime !== 'number') throw new Error(Errors.CACHE_TIME_MUST_BE_A_NUMBER);
|
|
16
|
-
if (typeof options.cacheSize !== 'number') throw new Error(Errors.CACHE_LIMIT_MUST_BE_A_NUMBER);
|
|
17
|
-
if (typeof options.rateLimit !== 'string' || !['AUTO', 'HARD', 'NONE'].includes(options.rateLimit)) throw new Error(Errors.INVALID_RATE_LIMIT_OPTION);
|
|
18
|
-
if (typeof options.keyLimit !== 'number') throw new Error(Errors.INVALID_KEY_LIMIT_OPTION);
|
|
19
|
-
if (typeof options.syncWithHeaders !== 'boolean') throw new Error(Errors.INVALID_HEADER_SYNC_OPTION);
|
|
20
|
-
if (typeof options.headers !== 'object') throw new Error(Errors.INVALID_HEADERS);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Parses cache options
|
|
25
|
-
* @param {Object} options Options to be parsed
|
|
26
|
-
* @returns {Object} Parsed cache options
|
|
27
|
-
* @private
|
|
28
|
-
*/
|
|
29
|
-
parseOptions
|
|
30
|
-
if (typeof options !== 'object' || options === null) throw new Error(Errors.OPTIONS_MUST_BE_AN_OBJECT);
|
|
31
|
-
return {
|
|
32
|
-
cache: options.cache || false,
|
|
33
|
-
cacheTime: options.cacheTime || 60,
|
|
34
|
-
cacheSize: (options.cacheSize === -1 ? Infinity : options.cacheSize) || Infinity,
|
|
35
|
-
cacheFilter: typeof options.cacheFilter === 'function' ? options.cacheFilter : this._handleFilter(options.cacheFilter),
|
|
36
|
-
rateLimit: options.rateLimit || 'AUTO',
|
|
37
|
-
keyLimit: options.keyLimit || 120,
|
|
38
|
-
syncWithHeaders: !!options.syncWithHeaders,
|
|
39
|
-
headers: options.headers || {},
|
|
40
|
-
silent: !!options.silent,
|
|
41
|
-
checkForUpdates: options.checkForUpdates || false
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Checks if Key is provided in a correct format
|
|
47
|
-
* @param {string} key API Key
|
|
48
|
-
* @returns {string} Key
|
|
49
|
-
* @private
|
|
50
|
-
*/
|
|
51
|
-
validateKey
|
|
52
|
-
if (!key) throw new Error(Errors.NO_API_KEY);
|
|
53
|
-
if (typeof key !== 'string') throw new Error(Errors.KEY_MUST_BE_A_STRING);
|
|
54
|
-
return key;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Check if suboptions are valid
|
|
59
|
-
* @param {Object} input Cache options
|
|
60
|
-
* @returns {boolean} Whether options are valid
|
|
61
|
-
* @private
|
|
62
|
-
*/
|
|
63
|
-
cacheSuboptions
|
|
64
|
-
if (typeof input !== 'object' || input === null) return false;
|
|
65
|
-
if (!input.noCacheCheck && !input.noCaching && !input.raw) return false;
|
|
66
|
-
return true;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Handles & parses the filter
|
|
71
|
-
* @param {*} filter FilterResolvable to be parsed
|
|
72
|
-
* @returns {Function} Filter function
|
|
73
|
-
* @private
|
|
74
|
-
*/
|
|
75
|
-
_handleFilter
|
|
76
|
-
if (!filter) return () => true;
|
|
77
|
-
if (typeof filter === 'object' && !Array.isArray(filter)) {
|
|
78
|
-
if (filter.whitelist && isStrArray(filter.whitelist)) return (x) => strToArray(filter.whitelist).includes(x);
|
|
79
|
-
if (filter.blacklist && isStrArray(filter.blacklist)) return (x) => !strToArray(filter.blacklist).includes(x);
|
|
80
|
-
throw new Error(Errors.CACHE_FILTER_INVALID);
|
|
81
|
-
}
|
|
82
|
-
if (!isStrArray(filter)) throw new Error(Errors.CACHE_FILTER_INVALID);
|
|
83
|
-
// blacklist by default
|
|
84
|
-
return (x) => !strToArray(filter).includes(x);
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Checks user's node version
|
|
88
|
-
* -12 will return an error; -14 will result in a warning
|
|
89
|
-
* @returns {void}
|
|
90
|
-
* @private
|
|
91
|
-
*/
|
|
92
|
-
validateNodeVersion
|
|
93
|
-
const nodeVersion = parseInt(process.version.match(/v(\d{2})\.\d{1,}\.\d+/)[1], 10);
|
|
94
|
-
if (nodeVersion < 12) throw new Error(Errors.NODE_VERSION_ERR);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
module.exports = Validation;
|
|
1
|
+
/* eslint-disable require-jsdoc */
|
|
2
|
+
const Errors = require('../Errors');
|
|
3
|
+
const { isStrArray, strToArray } = require('../utils/arrayTools');
|
|
4
|
+
/**
|
|
5
|
+
* Validation Class, used internally to validate provided arguments
|
|
6
|
+
*/
|
|
7
|
+
class Validation {
|
|
8
|
+
/**
|
|
9
|
+
* Check if cache options are valid
|
|
10
|
+
* @param {Object} options Global Cache Options to be validated
|
|
11
|
+
* @returns {void} Void
|
|
12
|
+
* @private
|
|
13
|
+
*/
|
|
14
|
+
validateOptions(options) {
|
|
15
|
+
if (typeof options.cacheTime !== 'number') throw new Error(Errors.CACHE_TIME_MUST_BE_A_NUMBER);
|
|
16
|
+
if (typeof options.cacheSize !== 'number') throw new Error(Errors.CACHE_LIMIT_MUST_BE_A_NUMBER);
|
|
17
|
+
if (typeof options.rateLimit !== 'string' || !['AUTO', 'HARD', 'NONE'].includes(options.rateLimit)) throw new Error(Errors.INVALID_RATE_LIMIT_OPTION);
|
|
18
|
+
if (typeof options.keyLimit !== 'number') throw new Error(Errors.INVALID_KEY_LIMIT_OPTION);
|
|
19
|
+
if (typeof options.syncWithHeaders !== 'boolean') throw new Error(Errors.INVALID_HEADER_SYNC_OPTION);
|
|
20
|
+
if (typeof options.headers !== 'object') throw new Error(Errors.INVALID_HEADERS);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Parses cache options
|
|
25
|
+
* @param {Object} options Options to be parsed
|
|
26
|
+
* @returns {Object} Parsed cache options
|
|
27
|
+
* @private
|
|
28
|
+
*/
|
|
29
|
+
parseOptions(options) {
|
|
30
|
+
if (typeof options !== 'object' || options === null) throw new Error(Errors.OPTIONS_MUST_BE_AN_OBJECT);
|
|
31
|
+
return {
|
|
32
|
+
cache: options.cache || false,
|
|
33
|
+
cacheTime: options.cacheTime || 60,
|
|
34
|
+
cacheSize: (options.cacheSize === -1 ? Infinity : options.cacheSize) || Infinity,
|
|
35
|
+
cacheFilter: typeof options.cacheFilter === 'function' ? options.cacheFilter : this._handleFilter(options.cacheFilter),
|
|
36
|
+
rateLimit: options.rateLimit || 'AUTO',
|
|
37
|
+
keyLimit: options.keyLimit || 120,
|
|
38
|
+
syncWithHeaders: !!options.syncWithHeaders,
|
|
39
|
+
headers: options.headers || {},
|
|
40
|
+
silent: !!options.silent,
|
|
41
|
+
checkForUpdates: options.checkForUpdates || false
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Checks if Key is provided in a correct format
|
|
47
|
+
* @param {string} key API Key
|
|
48
|
+
* @returns {string} Key
|
|
49
|
+
* @private
|
|
50
|
+
*/
|
|
51
|
+
validateKey(key) {
|
|
52
|
+
if (!key) throw new Error(Errors.NO_API_KEY);
|
|
53
|
+
if (typeof key !== 'string') throw new Error(Errors.KEY_MUST_BE_A_STRING);
|
|
54
|
+
return key;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Check if suboptions are valid
|
|
59
|
+
* @param {Object} input Cache options
|
|
60
|
+
* @returns {boolean} Whether options are valid
|
|
61
|
+
* @private
|
|
62
|
+
*/
|
|
63
|
+
cacheSuboptions(input) {
|
|
64
|
+
if (typeof input !== 'object' || input === null) return false;
|
|
65
|
+
if (!input.noCacheCheck && !input.noCaching && !input.raw) return false;
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Handles & parses the filter
|
|
71
|
+
* @param {*} filter FilterResolvable to be parsed
|
|
72
|
+
* @returns {Function} Filter function
|
|
73
|
+
* @private
|
|
74
|
+
*/
|
|
75
|
+
_handleFilter(filter) {
|
|
76
|
+
if (!filter) return () => true;
|
|
77
|
+
if (typeof filter === 'object' && !Array.isArray(filter)) {
|
|
78
|
+
if (filter.whitelist && isStrArray(filter.whitelist)) return (x) => strToArray(filter.whitelist).includes(x);
|
|
79
|
+
if (filter.blacklist && isStrArray(filter.blacklist)) return (x) => !strToArray(filter.blacklist).includes(x);
|
|
80
|
+
throw new Error(Errors.CACHE_FILTER_INVALID);
|
|
81
|
+
}
|
|
82
|
+
if (!isStrArray(filter)) throw new Error(Errors.CACHE_FILTER_INVALID);
|
|
83
|
+
// blacklist by default
|
|
84
|
+
return (x) => !strToArray(filter).includes(x);
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Checks user's node version
|
|
88
|
+
* -12 will return an error; -14 will result in a warning
|
|
89
|
+
* @returns {void}
|
|
90
|
+
* @private
|
|
91
|
+
*/
|
|
92
|
+
validateNodeVersion() {
|
|
93
|
+
const nodeVersion = parseInt(process.version.match(/v(\d{2})\.\d{1,}\.\d+/)[1], 10);
|
|
94
|
+
if (nodeVersion < 12) throw new Error(Errors.NODE_VERSION_ERR);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
module.exports = Validation;
|
package/src/index.js
CHANGED
|
@@ -1,83 +1,82 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
Client: require('./Client.js'),
|
|
3
|
-
version: require('../package.json').version,
|
|
4
|
-
|
|
5
|
-
/* API Status */
|
|
6
|
-
APIStatus: require('./structures/APIStatus.js'),
|
|
7
|
-
APIIncident: require('./structures/APIIncident.js'),
|
|
8
|
-
|
|
9
|
-
Player: require('./structures/Player.js'),
|
|
10
|
-
Game: require('./structures/Game.js'),
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
};
|
|
1
|
+
module.exports = {
|
|
2
|
+
Client: require('./Client.js'),
|
|
3
|
+
version: require('../package.json').version,
|
|
4
|
+
|
|
5
|
+
/* API Status */
|
|
6
|
+
APIStatus: require('./structures/APIStatus.js'),
|
|
7
|
+
APIIncident: require('./structures/APIIncident.js'),
|
|
8
|
+
|
|
9
|
+
Player: require('./structures/Player.js'),
|
|
10
|
+
Game: require('./structures/Game.js'),
|
|
11
|
+
Status: require('./structures/Status.js'),
|
|
12
|
+
Color: require('./structures/Color.js'),
|
|
13
|
+
Pet: require('./structures/Pet'),
|
|
14
|
+
Pets: require('./structures/Pets'),
|
|
15
|
+
PlayerCosmetics: require('./structures/PlayerCosmetics'),
|
|
16
|
+
|
|
17
|
+
/* Watchdog */
|
|
18
|
+
WatchdogStats: require('./structures/Watchdog/Stats.js'),
|
|
19
|
+
|
|
20
|
+
/* Guild */
|
|
21
|
+
Guild: require('./structures/Guild/Guild.js'),
|
|
22
|
+
GuildMember: require('./structures/Guild/GuildMember.js'),
|
|
23
|
+
GuildRank: require('./structures/Guild/GuildRank.js'),
|
|
24
|
+
|
|
25
|
+
/* SkyBlock */
|
|
26
|
+
SkyblockProfile: require('./structures/SkyBlock/SkyblockProfile.js'),
|
|
27
|
+
SkyblockMember: require('./structures/SkyBlock/SkyblockMember.js'),
|
|
28
|
+
SkyblockInventoryItem: require('./structures/SkyBlock/SkyblockInventoryItem.js'),
|
|
29
|
+
SkyblockPet: require('./structures/SkyBlock/SkyblockPet'),
|
|
30
|
+
|
|
31
|
+
/* Skyblock Auctions */
|
|
32
|
+
BaseAuction: require('./structures/SkyBlock/Auctions/BaseAuction.js'),
|
|
33
|
+
PartialAuction: require('./structures/SkyBlock/Auctions/PartialAuction.js'),
|
|
34
|
+
Auction: require('./structures/SkyBlock/Auctions/Auction.js'),
|
|
35
|
+
AuctionInfo: require('./structures/SkyBlock/Auctions/AuctionInfo.js'),
|
|
36
|
+
Bid: require('./structures/SkyBlock/Auctions/Bid.js'),
|
|
37
|
+
|
|
38
|
+
/* Skyblock Bazaar */
|
|
39
|
+
Product: require('./structures/SkyBlock/Bazzar/Product.js'),
|
|
40
|
+
Order: require('./structures/SkyBlock/Bazzar/Order.js'),
|
|
41
|
+
|
|
42
|
+
/* Skyblock News */
|
|
43
|
+
SkyblockNews: require('./structures/SkyBlock/News/SkyblockNews'),
|
|
44
|
+
|
|
45
|
+
/* Booster */
|
|
46
|
+
Booster: require('./structures/Boosters/Booster.js'),
|
|
47
|
+
|
|
48
|
+
/* MiniGames */
|
|
49
|
+
Arcade: require('./structures/MiniGames/Arcade.js'),
|
|
50
|
+
ArenaBrawl: require('./structures/MiniGames/ArenaBrawl.js'),
|
|
51
|
+
BedWars: require('./structures/MiniGames/BedWars.js'),
|
|
52
|
+
BlitzSurvivalGames: require('./structures/MiniGames/BlitzSurvivalGames.js'),
|
|
53
|
+
BuildBattle: require('./structures/MiniGames/BuildBattle.js'),
|
|
54
|
+
CopsAndCrims: require('./structures/MiniGames/CopsAndCrims.js'),
|
|
55
|
+
Duels: require('./structures/MiniGames/Duels.js'),
|
|
56
|
+
MegaWalls: require('./structures/MiniGames/MegaWalls.js'),
|
|
57
|
+
MurderMystery: require('./structures/MiniGames/MurderMystery.js'),
|
|
58
|
+
Paintball: require('./structures/MiniGames/Paintball.js'),
|
|
59
|
+
Quakecraft: require('./structures/MiniGames/Quakecraft.js'),
|
|
60
|
+
SkyWars: require('./structures/MiniGames/SkyWars.js'),
|
|
61
|
+
SmashHeroes: require('./structures/MiniGames/SmashHeroes.js'),
|
|
62
|
+
SpeedUHC: require('./structures/MiniGames/SpeedUHC.js'),
|
|
63
|
+
TNTGames: require('./structures/MiniGames/TNTGames.js'),
|
|
64
|
+
TurboKartRacers: require('./structures/MiniGames/TurboKartRacers.js'),
|
|
65
|
+
UHC: require('./structures/MiniGames/UHC.js'),
|
|
66
|
+
VampireZ: require('./structures/MiniGames/VampireZ.js'),
|
|
67
|
+
Walls: require('./structures/MiniGames/Walls.js'),
|
|
68
|
+
Warlords: require('./structures/MiniGames/Warlords.js'),
|
|
69
|
+
WoolWars: require('./structures/MiniGames/WoolWars.js'),
|
|
70
|
+
|
|
71
|
+
/* Leaderboards */
|
|
72
|
+
Leaderboard: require('./structures/Leaderboard.js'),
|
|
73
|
+
|
|
74
|
+
/* Server Info */
|
|
75
|
+
ServerInfo: require('./structures/ServerInfo.js'),
|
|
76
|
+
|
|
77
|
+
/* Errors */
|
|
78
|
+
Errors: require('./Errors.js'),
|
|
79
|
+
|
|
80
|
+
/* Utils */
|
|
81
|
+
Utils: require('./utils')
|
|
82
|
+
};
|
|
@@ -1,78 +1,78 @@
|
|
|
1
|
-
const regex = /https:\/\/status.hypixel.net\/incidents\/([a-z0-9]+)/;
|
|
2
|
-
/**
|
|
3
|
-
* API incident class
|
|
4
|
-
*/
|
|
5
|
-
class APIIncident {
|
|
6
|
-
/**
|
|
7
|
-
* @param {object} data API incident data
|
|
8
|
-
*/
|
|
9
|
-
constructor
|
|
10
|
-
/**
|
|
11
|
-
* Link to incident
|
|
12
|
-
* @type {string|null}
|
|
13
|
-
*/
|
|
14
|
-
this.link = data.link || null;
|
|
15
|
-
/**
|
|
16
|
-
* Timestamp when investigation was started as Date object
|
|
17
|
-
* @type {object|null}
|
|
18
|
-
*/
|
|
19
|
-
this.start = new Date(data.pubDate) || null;
|
|
20
|
-
/**
|
|
21
|
-
* Formatted timestamp when investigation was started
|
|
22
|
-
* @type {string|null}
|
|
23
|
-
*/
|
|
24
|
-
this.startFormatted = data.pubDate || null;
|
|
25
|
-
/**
|
|
26
|
-
* Timestamp when investigation was started as Date
|
|
27
|
-
* @type {Date|null}
|
|
28
|
-
*/
|
|
29
|
-
this.startTimestamp = new Date(data.pubDate).getTime() || null;
|
|
30
|
-
/**
|
|
31
|
-
* Incident author
|
|
32
|
-
* @type {string|null}
|
|
33
|
-
*/
|
|
34
|
-
this.author = data.creator || null;
|
|
35
|
-
/**
|
|
36
|
-
* Content as HTML
|
|
37
|
-
* @type {string|null}
|
|
38
|
-
*/
|
|
39
|
-
this.HTMLContent = data.content || null;
|
|
40
|
-
/**
|
|
41
|
-
* Content snippet
|
|
42
|
-
* @type {string|null}
|
|
43
|
-
*/
|
|
44
|
-
this.snippet = data.contentSnippet || null;
|
|
45
|
-
/**
|
|
46
|
-
* Content as plain text
|
|
47
|
-
* The parsing might be faulty!
|
|
48
|
-
* @type {string|null}
|
|
49
|
-
*/
|
|
50
|
-
this.TextContent = (data.content || '').replace(/<[^>]+>/g, '') || null;
|
|
51
|
-
/**
|
|
52
|
-
* GUID
|
|
53
|
-
* @type {string|null}
|
|
54
|
-
*/
|
|
55
|
-
this.guid = data.guid ? regex.exec(data.guid)[1] : null;
|
|
56
|
-
/**
|
|
57
|
-
* Incident categories
|
|
58
|
-
* @type {string[]}
|
|
59
|
-
*/
|
|
60
|
-
this.categories = data.categories || [];
|
|
61
|
-
/**
|
|
62
|
-
* Whether the incident is resolved/completed or not
|
|
63
|
-
* @author linearaccelerator
|
|
64
|
-
* @type {boolean}
|
|
65
|
-
* @version >6.0.1
|
|
66
|
-
*/
|
|
67
|
-
this.isResolved = this.TextContent.includes('Resolved -') || this.TextContent.includes('Completed -');
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Text Content
|
|
71
|
-
* @return {string}
|
|
72
|
-
*/
|
|
73
|
-
toString() {
|
|
74
|
-
return this.TextContent;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
module.exports = APIIncident;
|
|
1
|
+
const regex = /https:\/\/status.hypixel.net\/incidents\/([a-z0-9]+)/;
|
|
2
|
+
/**
|
|
3
|
+
* API incident class
|
|
4
|
+
*/
|
|
5
|
+
class APIIncident {
|
|
6
|
+
/**
|
|
7
|
+
* @param {object} data API incident data
|
|
8
|
+
*/
|
|
9
|
+
constructor(data) {
|
|
10
|
+
/**
|
|
11
|
+
* Link to incident
|
|
12
|
+
* @type {string|null}
|
|
13
|
+
*/
|
|
14
|
+
this.link = data.link || null;
|
|
15
|
+
/**
|
|
16
|
+
* Timestamp when investigation was started as Date object
|
|
17
|
+
* @type {object|null}
|
|
18
|
+
*/
|
|
19
|
+
this.start = new Date(data.pubDate) || null;
|
|
20
|
+
/**
|
|
21
|
+
* Formatted timestamp when investigation was started
|
|
22
|
+
* @type {string|null}
|
|
23
|
+
*/
|
|
24
|
+
this.startFormatted = data.pubDate || null;
|
|
25
|
+
/**
|
|
26
|
+
* Timestamp when investigation was started as Date
|
|
27
|
+
* @type {Date|null}
|
|
28
|
+
*/
|
|
29
|
+
this.startTimestamp = new Date(data.pubDate).getTime() || null;
|
|
30
|
+
/**
|
|
31
|
+
* Incident author
|
|
32
|
+
* @type {string|null}
|
|
33
|
+
*/
|
|
34
|
+
this.author = data.creator || null;
|
|
35
|
+
/**
|
|
36
|
+
* Content as HTML
|
|
37
|
+
* @type {string|null}
|
|
38
|
+
*/
|
|
39
|
+
this.HTMLContent = data.content || null;
|
|
40
|
+
/**
|
|
41
|
+
* Content snippet
|
|
42
|
+
* @type {string|null}
|
|
43
|
+
*/
|
|
44
|
+
this.snippet = data.contentSnippet || null;
|
|
45
|
+
/**
|
|
46
|
+
* Content as plain text
|
|
47
|
+
* The parsing might be faulty!
|
|
48
|
+
* @type {string|null}
|
|
49
|
+
*/
|
|
50
|
+
this.TextContent = (data.content || '').replace(/<[^>]+>/g, '') || null;
|
|
51
|
+
/**
|
|
52
|
+
* GUID
|
|
53
|
+
* @type {string|null}
|
|
54
|
+
*/
|
|
55
|
+
this.guid = data.guid ? regex.exec(data.guid)[1] : null;
|
|
56
|
+
/**
|
|
57
|
+
* Incident categories
|
|
58
|
+
* @type {string[]}
|
|
59
|
+
*/
|
|
60
|
+
this.categories = data.categories || [];
|
|
61
|
+
/**
|
|
62
|
+
* Whether the incident is resolved/completed or not
|
|
63
|
+
* @author linearaccelerator
|
|
64
|
+
* @type {boolean}
|
|
65
|
+
* @version >6.0.1
|
|
66
|
+
*/
|
|
67
|
+
this.isResolved = this.TextContent.includes('Resolved -') || this.TextContent.includes('Completed -');
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Text Content
|
|
71
|
+
* @return {string}
|
|
72
|
+
*/
|
|
73
|
+
toString() {
|
|
74
|
+
return this.TextContent;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
module.exports = APIIncident;
|