-
Notifications
You must be signed in to change notification settings - Fork 0
Getting started
dysolix edited this page May 5, 2024
·
2 revisions
import { HasagiClient } from "@hasagi/core";
const client = new HasagiClient();
await client.connect();
// If you want to automatically reconnect
client.on("disconnected", () => client.connect());
To find out more about the connect function go to Connection.
To find out more about the connect function go to Requests.
To find out more about the connect function go to Events.
To get general information about the local summoner (Riot ID, other ids, ...) you can use GET /lol-summoner/v1/current-summoner. This is similar to the Summoner-v4 response.
const summoner = await client.request("get", "/lol-summoner/v1/current-summoner");
/* {
"accountId": 229592706,
"displayName": "dysolix",
"gameName": "dysolix",
"internalName": "dysolix",
"nameChangeFlag": false,
"percentCompleteForNextLevel": 56,
"privacy": "PUBLIC",
"profileIconId": 4777,
"puuid": "b9e09f32-78a1-5a13-9f6b-5bbbca6e13ae",
"rerollPoints": {
"currentPoints": 500,
"maxRolls": 2,
"numberOfRolls": 2,
"pointsCostToRoll": 250,
"pointsToReroll": 0
},
"summonerId": 91258307,
"summonerLevel": 839,
"tagLine": "420",
"unnamed": false,
"xpSinceLastLevel": 1900,
"xpUntilNextLevel": 3360
} */
To get information about the local player's ranks you can use GET /lol-ranked/v1/current-ranked-stats.
const rankData = await client.request("get", "/lol-ranked/v1/current-ranked-stats");
console.log(rankData.queueMap["RANKED_SOLO_5x5"]); // Other keys are RANKED_FLEX_SR, RANKED_TFT, RANKED_TFT_DOUBLE_UP, RANKED_TFT_TURBO
/* {
"division": "I",
"highestDivision": "I",
"highestTier": "GOLD",
"isProvisional": true,
"leaguePoints": 85,
"losses": 0,
"miniSeriesProgress": "",
"previousSeasonEndDivision": "IV",
"previousSeasonEndTier": "PLATINUM",
"previousSeasonHighestDivision": "IV",
"previousSeasonHighestTier": "PLATINUM",
"provisionalGameThreshold": 5,
"provisionalGamesRemaining": 2,
"queueType": "RANKED_SOLO_5x5",
"ratedRating": 0,
"ratedTier": "NONE",
"tier": "GOLD",
"warnings": null,
"wins": 3
} */
TODO