separated type definitions and util functions
This commit is contained in:
10
dist/api.js
vendored
10
dist/api.js
vendored
@@ -26,7 +26,7 @@ exports.getPlayerInteraction = exports.getPlayer = void 0;
|
||||
/*eslint prefer-const: "error"*/
|
||||
const cheerio = __importStar(require("cheerio"));
|
||||
const https_1 = __importDefault(require("https"));
|
||||
const util_1 = require("./util");
|
||||
const main_1 = require("./util/main");
|
||||
const Lang = __importStar(require("./lang"));
|
||||
const uniteApiRegex = {
|
||||
//$1 = name, $2 = id
|
||||
@@ -109,7 +109,7 @@ function readHTML(html) {
|
||||
extraLines.push(line);
|
||||
}
|
||||
if (lines.length === 0)
|
||||
throw (0, util_1.emsg)('Unable to read data, please try again');
|
||||
throw (0, main_1.emsg)('Unable to read data, please try again');
|
||||
//bring the first lines removed back into the data
|
||||
lines = [
|
||||
...lines,
|
||||
@@ -122,7 +122,7 @@ function readHTML(html) {
|
||||
if (regex[0].test(line)) { //is master/has elo
|
||||
const regexData = line.match(regex[0]);
|
||||
if (!regexData || regexData.length < 4)
|
||||
throw (0, util_1.emsg)('Unable to read data, please try again');
|
||||
throw (0, main_1.emsg)('Unable to read data, please try again');
|
||||
foundData.level = regexData[1];
|
||||
foundData.rank = regexData[2];
|
||||
foundData.elo = regexData[3];
|
||||
@@ -130,7 +130,7 @@ function readHTML(html) {
|
||||
else { //is not master/has a class
|
||||
const regexData = line.match(regex[1]);
|
||||
if (!regexData || regexData.length < 4)
|
||||
throw (0, util_1.emsg)('Unable to read data, please try again');
|
||||
throw (0, main_1.emsg)('Unable to read data, please try again');
|
||||
foundData.level = regexData[1];
|
||||
foundData.rank = regexData[2];
|
||||
foundData.class = regexData[3];
|
||||
@@ -210,7 +210,7 @@ async function getPlayerInteraction(interaction) {
|
||||
await interaction.deferReply();
|
||||
const data = await getPlayer(username);
|
||||
if (data === null)
|
||||
throw (0, util_1.emsg)('api.noUser');
|
||||
throw (0, main_1.emsg)('api.noUser');
|
||||
else
|
||||
sendPlayerEmbed(interaction, data);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user