diff options
author | mat-1 <github@matdoes.dev> | 2021-05-25 00:39:18 +0000 |
---|---|---|
committer | mat-1 <github@matdoes.dev> | 2021-05-25 00:39:18 +0000 |
commit | 8c132c8eb308ce3e02cf1d1f79d58820dc1e65e8 (patch) | |
tree | 521cdadc1b8f9f2e9f8c1c2fe6440b8dd0d2f886 /build/database.js | |
parent | 17d2c47ec62f0bdea043cc6d0e09ac3c39a58ea1 (diff) | |
download | skyblock-api-8c132c8eb308ce3e02cf1d1f79d58820dc1e65e8.tar.gz skyblock-api-8c132c8eb308ce3e02cf1d1f79d58820dc1e65e8.tar.bz2 skyblock-api-8c132c8eb308ce3e02cf1d1f79d58820dc1e65e8.zip |
Compiled TS into JS
Diffstat (limited to 'build/database.js')
-rw-r--r-- | build/database.js | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/build/database.js b/build/database.js index aa8765c..55867ce 100644 --- a/build/database.js +++ b/build/database.js @@ -25,7 +25,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.queueUpdateDatabaseProfile = exports.queueUpdateDatabaseMember = exports.updateDatabaseProfile = exports.updateDatabaseMember = exports.fetchMemberLeaderboardSpots = exports.fetchLeaderboard = exports.fetchProfileLeaderboard = exports.fetchMemberLeaderboard = exports.fetchAllMemberLeaderboardAttributes = exports.fetchSlayerLeaderboards = exports.fetchAllLeaderboardsCategorized = void 0; +exports.queueUpdateDatabaseProfile = exports.queueUpdateDatabaseMember = exports.updateDatabaseProfile = exports.updateDatabaseMember = exports.fetchMemberLeaderboardSpots = exports.fetchLeaderboard = exports.fetchProfileLeaderboard = exports.fetchMemberLeaderboard = exports.fetchAllMemberLeaderboardAttributes = exports.fetchSlayerLeaderboards = exports.fetchAllLeaderboardsCategorized = exports.cachedRawLeaderboards = void 0; const stats_1 = require("./cleaners/skyblock/stats"); const mongodb_1 = require("mongodb"); const cached = __importStar(require("./hypixelCached")); @@ -41,7 +41,7 @@ const recentlyUpdated = new node_cache_1.default({ checkperiod: 60, useClones: false, }); -const cachedRawLeaderboards = new Map(); +exports.cachedRawLeaderboards = new Map(); const leaderboardMax = 100; const reversedLeaderboards = [ 'first_join', @@ -188,8 +188,8 @@ function isLeaderboardReversed(name) { async function fetchMemberLeaderboardRaw(name) { if (!client) throw Error('Client isn\'t initialized yet'); - if (cachedRawLeaderboards.has(name)) - return cachedRawLeaderboards.get(name); + if (exports.cachedRawLeaderboards.has(name)) + return exports.cachedRawLeaderboards.get(name); // typescript forces us to make a new variable and set it this way because it gives an error otherwise const query = {}; query[`stats.${name}`] = { '$exists': true, '$ne': NaN }; @@ -200,12 +200,12 @@ async function fetchMemberLeaderboardRaw(name) { .sort(sortQuery) .limit(leaderboardMax) .toArray(); - cachedRawLeaderboards.set(name, leaderboardRaw); + exports.cachedRawLeaderboards.set(name, leaderboardRaw); return leaderboardRaw; } async function fetchProfileLeaderboardRaw(name) { - if (cachedRawLeaderboards.has(name)) - return cachedRawLeaderboards.get(name); + if (exports.cachedRawLeaderboards.has(name)) + return exports.cachedRawLeaderboards.get(name); // typescript forces us to make a new variable and set it this way because it gives an error otherwise const query = {}; query[`stats.${name}`] = { '$exists': true, '$ne': NaN }; @@ -216,7 +216,7 @@ async function fetchProfileLeaderboardRaw(name) { .sort(sortQuery) .limit(leaderboardMax) .toArray(); - cachedRawLeaderboards.set(name, leaderboardRaw); + exports.cachedRawLeaderboards.set(name, leaderboardRaw); return leaderboardRaw; } /** Fetch a leaderboard that ranks members, as opposed to profiles */ @@ -399,7 +399,7 @@ async function updateDatabaseMember(member, profile) { }]) .sort((a, b) => leaderboardReverse ? a.stats[attributeName] - b.stats[attributeName] : b.stats[attributeName] - a.stats[attributeName]) .slice(0, 100); - cachedRawLeaderboards.set(attributeName, newRawLeaderboard); + exports.cachedRawLeaderboards.set(attributeName, newRawLeaderboard); } if (_1.debug) console.debug('added member to leaderboards', member.username, leaderboardAttributes); @@ -448,7 +448,7 @@ async function updateDatabaseProfile(profile) { }]) .sort((a, b) => leaderboardReverse ? a.stats[attributeName] - b.stats[attributeName] : b.stats[attributeName] - a.stats[attributeName]) .slice(0, 100); - cachedRawLeaderboards.set(attributeName, newRawLeaderboard); + exports.cachedRawLeaderboards.set(attributeName, newRawLeaderboard); } if (_1.debug) console.debug('added profile to leaderboards', profile.name, leaderboardAttributes); |