UNPKG

lcinterface

Version:

An easy way to interact with the league client. This module is basically a middle layer between your app and the league client

38 lines (28 loc) 1.15 kB
// global imports const { LCIConnector, LCIClient } = require("lcinterface") // import all the lcinterface stuff // for getting the credentials const connector = new LCIConnector() // make sure we do not crash if we call an endpoint while not hooked LCIClient.allowUnsafeCalls(false) // listen for event connect connector.on("connect", async (credentials) => { // hook LCIClient LCIClient.hook(credentials) // if we are hooked if (LCIClient.isCorrectValue("hooked", true)) { // "virtually" call a league endpoint with get, post, put, delete const user_data = await LCIClient.virtualCall(LCIClient.endpoints.user.me, "get") // log the user data we got from the client console.log(user_data) // change our ingame status user_data.statusMessage = "hello from lcinterface" // update our status const result = await LCIClient.virtualCall(LCIClient.endpoints.user.me, "put", user_data) // log the result console.log(result) } // when you are done connector.disconnect() }) // start the client connector after setting everything up connector.connect()