diff options
Diffstat (limited to 'build/cleaners/rank.js')
-rw-r--r-- | build/cleaners/rank.js | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/build/cleaners/rank.js b/build/cleaners/rank.js index 19e4938..1d80d2c 100644 --- a/build/cleaners/rank.js +++ b/build/cleaners/rank.js @@ -1,7 +1,4 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.cleanRank = void 0; -const util_1 = require("../util"); +import { colorCodeFromName, minecraftColorCodes } from '../util.js'; const rankColors = { 'NONE': '7', 'VIP': 'a', @@ -16,15 +13,14 @@ const rankColors = { 'ADMIN': 'c' }; /** Response cleaning (reformatting to be nicer) */ -function cleanRank({ packageRank, newPackageRank, monthlyPackageRank, rankPlusColor, rank, prefix }) { - var _a; +export function cleanRank({ packageRank, newPackageRank, monthlyPackageRank, rankPlusColor, rank, prefix }) { let name; let color; let colored; let bracketColor; if (prefix) { // derive values from prefix colored = prefix; - color = util_1.minecraftColorCodes[colored.match(/§./)[0][1]]; + color = minecraftColorCodes[colored.match(/§./)[0][1]]; name = colored.replace(/§./g, '').replace(/[\[\]]/g, ''); } else { @@ -33,7 +29,8 @@ function cleanRank({ packageRank, newPackageRank, monthlyPackageRank, rankPlusCo else if (rank && rank !== 'NORMAL') name = rank; else - name = (_a = newPackageRank === null || newPackageRank === void 0 ? void 0 : newPackageRank.replace('_PLUS', '+')) !== null && _a !== void 0 ? _a : packageRank === null || packageRank === void 0 ? void 0 : packageRank.replace('_PLUS', '+'); + name = newPackageRank?.replace('_PLUS', '+') + ?? packageRank?.replace('_PLUS', '+'); switch (name) { // MVP++ is called Superstar for some reason case 'SUPERSTAR': @@ -54,8 +51,8 @@ function cleanRank({ packageRank, newPackageRank, monthlyPackageRank, rankPlusCo name = 'NONE'; break; } - const plusColor = rankPlusColor ? util_1.colorCodeFromName(rankPlusColor) : null; - color = util_1.minecraftColorCodes[rankColors[name]]; + const plusColor = rankPlusColor ? colorCodeFromName(rankPlusColor) : null; + color = minecraftColorCodes[rankColors[name]]; let rankColorPrefix = rankColors[name] ? '§' + rankColors[name] : ''; // the text is white, but only in the prefix if (name === 'YOUTUBE') @@ -82,4 +79,3 @@ function cleanRank({ packageRank, newPackageRank, monthlyPackageRank, rankPlusCo colored }; } -exports.cleanRank = cleanRank; |