Compare commits

..

2 Commits

Author SHA1 Message Date
5ce68086b8 updated to es2020 2022-01-31 15:53:23 -06:00
5ee97cfd08 fixed special character bug 2022-01-31 15:50:25 -06:00
6 changed files with 258 additions and 155 deletions

111
dist/api.js vendored
View File

@@ -18,15 +18,6 @@ var __importStar = (this && this.__importStar) || function (mod) {
__setModuleDefault(result, mod); __setModuleDefault(result, mod);
return result; return result;
}; };
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importDefault = (this && this.__importDefault) || function (mod) { var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod }; return (mod && mod.__esModule) ? mod : { "default": mod };
}; };
@@ -38,11 +29,15 @@ const https_1 = __importDefault(require("https"));
//while names cant have spaces, the name slot in ogtitle could be shown as "No Player Name" which has spaces //while names cant have spaces, the name slot in ogtitle could be shown as "No Player Name" which has spaces
const uniteApiRegex = { const uniteApiRegex = {
//$1 = name, $2 = id //$1 = name, $2 = id
ogtitle: /unite api - ([\w\d ]+) \((.*)\)/i, ogtitle: /unite api - (.+) \((.*)\)/i,
//$1 = level, $2 = rank, $3 = elo, $4 = battles, $5 = wins, $6 = win rate //$1 = level, $2 = rank, $3 = elo/class (rest is found by splitting each line)
ogdescription: /pokémon unite : lv\.(\d+) (\w+) \((\d+)\)\n battles : (\d+)\n Wins : (\d+)\n win rate : (\d+)%/i, ogdescription: [
//for non-masters (no elo) //line 1
//ogdescription: /pokémon unite : lv\.(\d+) (\w+): class (\d+) *\n battles : (\d+) *\n wins : (\d+) *\n win rate : (\d+)%/i, [
/lv\.(\d+) (\w+) \((\d+)\)/i,
/lv\.(\d+) (\w+): class (\d+)/i //other
],
]
}; };
/* /*
og:title og:title
@@ -60,7 +55,7 @@ Pokémon Unite : Lv.40 Master (1741)
* @returns the html of the page through a promise (rejects if the page status is not 200) * @returns the html of the page through a promise (rejects if the page status is not 200)
*/ */
function getHTML(name) { function getHTML(name) {
name = name.replace(/[^\w\d]/g, ''); //name = name.replace(/[^\w\d]/g, '');
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const init = { const init = {
host: 'uniteapi.dev', host: 'uniteapi.dev',
@@ -96,13 +91,14 @@ function readHTML(html) {
id: "", id: "",
level: "", level: "",
rank: "", rank: "",
elo: "", elo: null,
class: null,
battles: "", battles: "",
wins: "", wins: "",
winrate: "" winrate: ""
}; };
//filter down to just ones named "og:..." //filter down to just ones named "og:..."
metaElems = metaElems.filter(el => { var _a; return (_a = el.attribs.property) === null || _a === void 0 ? void 0 : _a.startsWith('og:'); }); metaElems = metaElems.filter(el => el.attribs.property?.startsWith('og:'));
metaElems.forEach(el => { metaElems.forEach(el => {
let attr = el.attribs; let attr = el.attribs;
if (attr.property === 'og:title') { if (attr.property === 'og:title') {
@@ -113,7 +109,62 @@ function readHTML(html) {
} }
} }
else if (attr.property === 'og:description') { else if (attr.property === 'og:description') {
let data = uniteApiRegex.ogdescription.exec(attr.content); //all lines
let lines = attr.content.split('\n').map(l => l.trim()), extraLines = [];
//ensure first line is correct
while (lines.length && !/pok.mon unite/i.test(lines[0])) {
let line = lines.shift();
if (line)
extraLines.push(line);
}
if (!lines.length)
throw 'Unable to read data, please try again';
//bring the first lines removed back into the data
lines = [
...lines,
...extraLines.filter(d => d)
];
//line 1
//Pokémon Unite : Lv.40 Veteran: Class 3
//Pokémon Unite : Lv.40 Master (1741)
{
//will be only text after "pokemon unite:"
let line = lines[0].split(':').slice(1).join(':').trim();
let regex = uniteApiRegex.ogdescription[0];
if (regex[0].test(line)) { //is master/has elo
let regexData = line.match(regex[0]);
if (!regexData || regexData.length < 4)
throw 'Unable to read data, please try again';
foundData.level = regexData[1];
foundData.rank = regexData[2];
foundData.elo = regexData[3];
}
else { //is not master/has a class
let regexData = line.match(regex[1]);
if (!regexData || regexData.length < 4)
throw 'Unable to read data, please try again';
foundData.level = regexData[1];
foundData.rank = regexData[2];
foundData.class = regexData[3];
}
}
lines.shift();
//rest of lines
lines.forEach(line => {
let split = line.split(':').map(l => l.trim()), key = split[0].toLowerCase().replace(/[^\w]/g, ''), value = split[1];
switch (key) {
case 'battles':
foundData.battles = value;
break;
case 'wins':
foundData.wins = value;
break;
case 'winrate':
foundData.winrate = value;
break;
}
});
/*let data = uniteApiRegex.ogdescription.exec(attr.content);
if (data !== null && data.length >= 7) { if (data !== null && data.length >= 7) {
foundData.level = data[1]; foundData.level = data[1];
foundData.rank = data[2]; foundData.rank = data[2];
@@ -121,7 +172,7 @@ function readHTML(html) {
foundData.battles = data[4]; foundData.battles = data[4];
foundData.wins = data[5]; foundData.wins = data[5];
foundData.winrate = data[6]; foundData.winrate = data[6];
} }*/
} }
}); });
return foundData; return foundData;
@@ -141,26 +192,26 @@ function verifyData(data) {
* @param name name of player * @param name name of player
* @returns player data * @returns player data
*/ */
function getPlayer(name) { async function getPlayer(name) {
return __awaiter(this, void 0, void 0, function* () { let html = await getHTML(name);
let html = yield getHTML(name);
let data = readHTML(html); let data = readHTML(html);
if (verifyData(data)) if (verifyData(data))
return data; return data;
return null; return null;
});
} }
exports.getPlayer = getPlayer; exports.getPlayer = getPlayer;
function getPlayerInteraction(interaction) { /**
return __awaiter(this, void 0, void 0, function* () { * calls getPlayer() with the name from the interaction
* @param interaction discord interaction
*/
async function getPlayerInteraction(interaction) {
let username = interaction.options.getString('username', true); let username = interaction.options.getString('username', true);
yield interaction.deferReply(); await interaction.deferReply();
let data = yield getPlayer(username); let data = await getPlayer(username);
if (data === null) if (data === null)
yield interaction.editReply('Unable to find user'); await interaction.editReply('Unable to find user');
else else
yield interaction.editReply('```\n' + JSON.stringify(data, null, 2) + '\n```'); await interaction.editReply('```\n' + JSON.stringify(data, null, 2) + '\n```');
});
} }
exports.getPlayerInteraction = getPlayerInteraction; exports.getPlayerInteraction = getPlayerInteraction;
//await getPlayer('IanWhysp') //await getPlayer('IanWhysp')

16
dist/discord.js vendored
View File

@@ -1,17 +1,9 @@
"use strict"; "use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.registerCommands = void 0; exports.registerCommands = void 0;
const rest_1 = require("@discordjs/rest"); const rest_1 = require("@discordjs/rest");
const v9_1 = require("discord-api-types/v9"); const v9_1 = require("discord-api-types/v9");
// list of commands to register with discord
const commands = [ const commands = [
{ {
name: 'queue', name: 'queue',
@@ -60,20 +52,18 @@ const commands = [
* @param clientId discord bot client id * @param clientId discord bot client id
* @param guildIds discord guild id(s) * @param guildIds discord guild id(s)
*/ */
function registerCommands(token, clientId, guildIds) { async function registerCommands(token, clientId, guildIds) {
return __awaiter(this, void 0, void 0, function* () {
const rest = new rest_1.REST({ version: '9' }).setToken(token); const rest = new rest_1.REST({ version: '9' }).setToken(token);
if (typeof guildIds === 'string') if (typeof guildIds === 'string')
guildIds = [guildIds]; guildIds = [guildIds];
for (let i = 0; i < guildIds.length; i++) { for (let i = 0; i < guildIds.length; i++) {
try { try {
yield rest.put(v9_1.Routes.applicationGuildCommands(clientId, guildIds[i]), { body: commands }); await rest.put(v9_1.Routes.applicationGuildCommands(clientId, guildIds[i]), { body: commands });
console.log(`[${guildIds[i]}] registered command`); console.log(`[${guildIds[i]}] registered command`);
} }
catch (error) { catch (error) {
console.error(error); console.error(error);
} }
} }
});
} }
exports.registerCommands = registerCommands; exports.registerCommands = registerCommands;

28
dist/index.js vendored
View File

@@ -18,15 +18,6 @@ var __importStar = (this && this.__importStar) || function (mod) {
__setModuleDefault(result, mod); __setModuleDefault(result, mod);
return result; return result;
}; };
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
const discord_js_1 = require("discord.js"); const discord_js_1 = require("discord.js");
const fs = __importStar(require("fs")); const fs = __importStar(require("fs"));
@@ -34,33 +25,36 @@ const api_1 = require("./api");
const discord_1 = require("./discord"); const discord_1 = require("./discord");
const queue_1 = require("./queue"); const queue_1 = require("./queue");
const CLIENT = new discord_js_1.Client({ intents: [discord_js_1.Intents.FLAGS.GUILDS] }); const CLIENT = new discord_js_1.Client({ intents: [discord_js_1.Intents.FLAGS.GUILDS] });
//init logs with a timestamp
console.log(new Date().toISOString() + '\n\n'); console.log(new Date().toISOString() + '\n\n');
//get token
if (!fs.existsSync('./token')) { if (!fs.existsSync('./token')) {
fs.writeFileSync('./token', ''); fs.writeFileSync('./token', '');
console.error('Missing Discord Token, please enter the bot token into the token file'); console.error('Missing Discord Token, please enter the bot token into the token file');
process.exit(1); process.exit(1);
} }
const TOKEN = fs.readFileSync('./token').toString(); const TOKEN = fs.readFileSync('./token').toString();
//discord connections
CLIENT.on('ready', client => { CLIENT.on('ready', client => {
console.log(`Logged in as ${client.user.tag}`); console.log(`Logged in as ${client.user.tag}`);
client.guilds.fetch().then(guilds => (0, discord_1.registerCommands)(TOKEN, client.user.id, guilds.map(g => g.id))); client.guilds.fetch().then(guilds => (0, discord_1.registerCommands)(TOKEN, client.user.id, guilds.map(g => g.id)));
}); });
CLIENT.on('interactionCreate', (interaction) => __awaiter(void 0, void 0, void 0, function* () { CLIENT.on('interactionCreate', async (interaction) => {
if (!interaction.isCommand()) if (!interaction.isCommand())
return; return;
try { try {
if (interaction.commandName === 'queue') if (interaction.commandName === 'queue')
yield (0, queue_1.createQueue)(interaction); await (0, queue_1.createQueue)(interaction);
else if (interaction.commandName === 'join') else if (interaction.commandName === 'join')
yield (0, queue_1.joinQueue)(interaction); await (0, queue_1.joinQueue)(interaction);
else if (interaction.commandName === 'leave') else if (interaction.commandName === 'leave')
yield (0, queue_1.leaveQueue)(interaction); await (0, queue_1.leaveQueue)(interaction);
else if (interaction.commandName === 'ready') else if (interaction.commandName === 'ready')
yield (0, queue_1.readyQueue)(interaction); await (0, queue_1.readyQueue)(interaction);
else if (interaction.commandName === 'queueinfo') else if (interaction.commandName === 'queueinfo')
yield (0, queue_1.queueInfo)(interaction); await (0, queue_1.queueInfo)(interaction);
else if (interaction.commandName === 'elo') else if (interaction.commandName === 'elo')
yield (0, api_1.getPlayerInteraction)(interaction); await (0, api_1.getPlayerInteraction)(interaction);
} }
catch (e) { catch (e) {
if (typeof e === 'string') { if (typeof e === 'string') {
@@ -72,5 +66,5 @@ CLIENT.on('interactionCreate', (interaction) => __awaiter(void 0, void 0, void 0
else else
console.error(e); console.error(e);
} }
})); });
CLIENT.login(TOKEN); CLIENT.login(TOKEN);

39
dist/queue.js vendored
View File

@@ -1,13 +1,4 @@
"use strict"; "use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.queueInfo = exports.readyQueue = exports.leaveQueue = exports.joinQueue = exports.createQueue = void 0; exports.queueInfo = exports.readyQueue = exports.leaveQueue = exports.joinQueue = exports.createQueue = void 0;
const discord_js_1 = require("discord.js"); const discord_js_1 = require("discord.js");
@@ -43,8 +34,7 @@ function getInfo(interaction) {
* @param interaction * @param interaction
* @throws string message if it cannot be created * @throws string message if it cannot be created
*/ */
function createQueue(interaction) { async function createQueue(interaction) {
return __awaiter(this, void 0, void 0, function* () {
let { channelId } = interaction, member = getMember(interaction), teamsize = interaction.options.getInteger('teamsize', true); let { channelId } = interaction, member = getMember(interaction), teamsize = interaction.options.getInteger('teamsize', true);
if (QUEUE.has(channelId)) if (QUEUE.has(channelId))
throw 'There is already an active queue in this channel, type `/join` to join'; //and you are already in it throw 'There is already an active queue in this channel, type `/join` to join'; //and you are already in it
@@ -55,8 +45,7 @@ function createQueue(interaction) {
initiator: member, initiator: member,
teamsize: teamsize teamsize: teamsize
}); });
yield interaction.reply(`Queue for teams of ${teamsize} has been created, and you have joined`); await interaction.reply(`Queue for teams of ${teamsize} has been created, and you have joined`);
});
} }
exports.createQueue = createQueue; exports.createQueue = createQueue;
/** /**
@@ -64,15 +53,13 @@ exports.createQueue = createQueue;
* @param interaction * @param interaction
* @throws string message if it cannot be joined * @throws string message if it cannot be joined
*/ */
function joinQueue(interaction) { async function joinQueue(interaction) {
return __awaiter(this, void 0, void 0, function* () {
let member = getMember(interaction), info = getInfo(interaction); let member = getMember(interaction), info = getInfo(interaction);
if (info.players.map(m => m.id).includes(member.id)) if (info.players.map(m => m.id).includes(member.id))
throw 'You are already in the active queue'; throw 'You are already in the active queue';
info.players.push(member); info.players.push(member);
QUEUE.set(interaction.channelId, info); QUEUE.set(interaction.channelId, info);
yield interaction.reply('Joined the queue'); await interaction.reply('Joined the queue');
});
} }
exports.joinQueue = joinQueue; exports.joinQueue = joinQueue;
/** /**
@@ -80,15 +67,13 @@ exports.joinQueue = joinQueue;
* @param interaction * @param interaction
* @throws string message if it cannot be left * @throws string message if it cannot be left
*/ */
function leaveQueue(interaction) { async function leaveQueue(interaction) {
return __awaiter(this, void 0, void 0, function* () {
let member = getMember(interaction), info = getInfo(interaction); let member = getMember(interaction), info = getInfo(interaction);
if (!info.players.map(m => m.id).includes(member.id)) if (!info.players.map(m => m.id).includes(member.id))
throw 'You aren\'t in the active queue'; throw 'You aren\'t in the active queue';
info.players.splice(info.players.indexOf(member), 1); info.players.splice(info.players.indexOf(member), 1);
QUEUE.set(interaction.channelId, info); QUEUE.set(interaction.channelId, info);
yield interaction.reply('Left the queue'); await interaction.reply('Left the queue');
});
} }
exports.leaveQueue = leaveQueue; exports.leaveQueue = leaveQueue;
/** /**
@@ -96,8 +81,7 @@ exports.leaveQueue = leaveQueue;
* @param interaction * @param interaction
* @throws string message if it cannot be readied * @throws string message if it cannot be readied
*/ */
function readyQueue(interaction) { async function readyQueue(interaction) {
return __awaiter(this, void 0, void 0, function* () {
let member = getMember(interaction), info = getInfo(interaction), { initiator } = info; let member = getMember(interaction), info = getInfo(interaction), { initiator } = info;
if (member.id !== initiator.id) if (member.id !== initiator.id)
throw 'Only the queue initiator can ready the queue'; throw 'Only the queue initiator can ready the queue';
@@ -117,8 +101,7 @@ function readyQueue(interaction) {
team.forEach(m => str.push(` ${m.user.tag}`)); team.forEach(m => str.push(` ${m.user.tag}`));
teamsStr.push(str.join('\n')); teamsStr.push(str.join('\n'));
}); });
yield interaction.reply('```\n' + teamsStr.join('\n\n') + '\n```'); await interaction.reply('```\n' + teamsStr.join('\n\n') + '\n```');
});
} }
exports.readyQueue = readyQueue; exports.readyQueue = readyQueue;
/** /**
@@ -126,14 +109,12 @@ exports.readyQueue = readyQueue;
* @param interaction * @param interaction
* @throws string message if it cannot be read * @throws string message if it cannot be read
*/ */
function queueInfo(interaction) { async function queueInfo(interaction) {
return __awaiter(this, void 0, void 0, function* () {
let info = getInfo(interaction); let info = getInfo(interaction);
yield interaction.reply('```' + ` await interaction.reply('```' + `
players: ${info.players.map(p => p.user.tag).join('\n ')} players: ${info.players.map(p => p.user.tag).join('\n ')}
initiator: ${info.initiator.user.tag} initiator: ${info.initiator.user.tag}
teamsize: ${info.teamsize} teamsize: ${info.teamsize}
` + '```'); ` + '```');
});
} }
exports.queueInfo = queueInfo; exports.queueInfo = queueInfo;

View File

@@ -7,11 +7,16 @@ import http from 'https';
//while names cant have spaces, the name slot in ogtitle could be shown as "No Player Name" which has spaces //while names cant have spaces, the name slot in ogtitle could be shown as "No Player Name" which has spaces
const uniteApiRegex = { const uniteApiRegex = {
//$1 = name, $2 = id //$1 = name, $2 = id
ogtitle: /unite api - ([\w\d ]+) \((.*)\)/i, ogtitle: /unite api - (.+) \((.*)\)/i,
//$1 = level, $2 = rank, $3 = elo, $4 = battles, $5 = wins, $6 = win rate //$1 = level, $2 = rank, $3 = elo/class (rest is found by splitting each line)
ogdescription: /pokémon unite : lv\.(\d+) (\w+) \((\d+)\)\n battles : (\d+)\n Wins : (\d+)\n win rate : (\d+)%/i, ogdescription: [
//for non-masters (no elo) //line 1
//ogdescription: /pokémon unite : lv\.(\d+) (\w+): class (\d+) *\n battles : (\d+) *\n wins : (\d+) *\n win rate : (\d+)%/i, [
/lv\.(\d+) (\w+) \((\d+)\)/i, //master
/lv\.(\d+) (\w+): class (\d+)/i //other
],
]
} }
type uniteApiData = { type uniteApiData = {
@@ -20,7 +25,8 @@ type uniteApiData = {
level: string, level: string,
rank: string, rank: string,
elo: string, class: string|null,
elo: string|null,
battles: string, battles: string,
wins: string, wins: string,
winrate: string winrate: string
@@ -43,7 +49,7 @@ Pokémon Unite : Lv.40 Master (1741)
*/ */
function getHTML(name: string): Promise<string> { function getHTML(name: string): Promise<string> {
name = name.replace(/[^\w\d]/g, ''); //name = name.replace(/[^\w\d]/g, '');
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
@@ -91,7 +97,8 @@ function readHTML(html: string): uniteApiData {
level: "", level: "",
rank: "", rank: "",
elo: "", elo: null,
class: null,
battles: "", battles: "",
wins: "", wins: "",
winrate: "" winrate: ""
@@ -110,7 +117,86 @@ function readHTML(html: string): uniteApiData {
foundData.id = data[2]; foundData.id = data[2];
} }
} else if (attr.property === 'og:description') { } else if (attr.property === 'og:description') {
let data = uniteApiRegex.ogdescription.exec(attr.content);
//all lines
let lines = attr.content.split('\n').map(l => l.trim()),
extraLines: string[] = [];
//ensure first line is correct
while (lines.length && !/pok.mon unite/i.test(lines[0])) {
let line = lines.shift();
if (line)
extraLines.push(line);
}
if (!lines.length)
throw 'Unable to read data, please try again';
//bring the first lines removed back into the data
lines = [
...lines,
...extraLines.filter(d => d)
];
//line 1
//Pokémon Unite : Lv.40 Veteran: Class 3
//Pokémon Unite : Lv.40 Master (1741)
{
//will be only text after "pokemon unite:"
let line = lines[0].split(':').slice(1).join(':').trim();
let regex = uniteApiRegex.ogdescription[0];
if (regex[0].test(line)) { //is master/has elo
let regexData = line.match(regex[0]);
if (!regexData || regexData.length < 4)
throw 'Unable to read data, please try again';
foundData.level = regexData[1];
foundData.rank = regexData[2];
foundData.elo = regexData[3];
} else { //is not master/has a class
let regexData = line.match(regex[1]);
if (!regexData || regexData.length < 4)
throw 'Unable to read data, please try again';
foundData.level = regexData[1];
foundData.rank = regexData[2];
foundData.class = regexData[3];
}
}
lines.shift();
//rest of lines
lines.forEach(line => {
let split = line.split(':').map(l => l.trim()),
key = split[0].toLowerCase().replace(/[^\w]/g, ''),
value = split[1];
switch(key) {
case 'battles':
foundData.battles = value;
break;
case 'wins':
foundData.wins = value;
break;
case 'winrate':
foundData.winrate = value;
break;
}
});
/*let data = uniteApiRegex.ogdescription.exec(attr.content);
if (data !== null && data.length >= 7) { if (data !== null && data.length >= 7) {
foundData.level = data[1]; foundData.level = data[1];
foundData.rank = data[2]; foundData.rank = data[2];
@@ -118,7 +204,8 @@ function readHTML(html: string): uniteApiData {
foundData.battles = data[4]; foundData.battles = data[4];
foundData.wins = data[5]; foundData.wins = data[5];
foundData.winrate = data[6]; foundData.winrate = data[6];
} }*/
} }
}) })

View File

@@ -1,6 +1,6 @@
{ {
"compilerOptions": { "compilerOptions": {
"target": "es2016", "target": "es2020",
"module": "commonjs", "module": "commonjs",
"rootDir": "./src", "rootDir": "./src",
"outDir": "./dist", "outDir": "./dist",