Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ((
- /** @type {string} */ urlEncodedGetMmrHistoryResponseJson,
- ) => {
- const getMmrHistoryResponseJson = decodeURIComponent(urlEncodedGetMmrHistoryResponseJson);
- if (/^Error Connecting To Remote Server\b/i.test(getMmrHistoryResponseJson)) {
- return getMmrHistoryResponseJson;
- }
- try {
- /** @type {{
- readonly data: ReadonlyArray<{
- readonly mmr_change_to_last_game: number;
- }>;
- }} */
- const getMmrHistoryResponse = JSON.parse(getMmrHistoryResponseJson);
- let text = "";
- let i=0;
- for (const {mmr_change_to_last_game: mmrChange} of getMmrHistoryResponse.data) {
- if (i < 5){
- text += "[" + mmrChange + "] ";
- }
- i++;
- }
- return `Pandii's last 5 Valo Elo changes :: ${text}`;
- } catch (e) {
- return `Failed to parse MMR history: ${e.message}: ${getMmrHistoryResponseJson}`.slice(0, 400);
- }
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement