This package can obtain a player's information from Genshin Impact, such as their stats, characters earned, character level and more. Also, thanks to the Genshin Db package, the package has more options to obtain information about Genshin impact characters, weapons, artifacts, etc. with a solid and updated database.
npm
npm i genshin-stats
yarn
yarn add genshin-stats
The available methods are listed below:
getCharacter
getTalents
getConstellations
getWeapons
getWeaponMaterialTypes
getTalentMaterialTypes
getArtifacts
getFoods
getElements
Example
import { GameInfo } from 'genshin-stats';
const data = new GameInfo();
await data.getCharacter('amber');
The client to obtain the user information of a Genshin Impact player takes 2 parameters in its configuration. The parameters required in the configuration are listed below.
account_id
- This parameter is the user uid linked to the access token that is generated when a user logs in to Hoyolab. It is necessary to enter the correct one because the token will work only if the correct uid is entered.token
- The token gives access to get the Genshin Impact API information, this token is generated when a user logs into Hoyolab and can be obtained from theCookies
section, also theaccount_id
parameter can be found there.
To obtain these parameters it is necessary to follow the instructions listed below:
1. Login to Hoyolab
3. Go to the category Storage
, open the option Cookies
and open the option called https://www.hoyolab.com/
.
The ltoken
field is the token mentioned above.
Once this data is obtained, it will be introduced in the client's options to obtain the user's statistics.
Example
import { UserStats } from 'genshin-stats';
const data = new UserStats({ account_id: 'account_id', token: 'ltoken' });
This data may expire, so be sure to update it when necessary.