import { Hoyolab, LanguageEnum } from 'node-hoyolab'
const hoyolab = new Hoyolab({
: {
cookie: 'your token',
ltokenV2: parseInt('12345677')
ltuidV2,
}: LanguageEnum.ENGLISH,
lang })
import { GamesEnum, Hoyolab, LanguageEnum } from 'node-hoyolab'
async function main() {
const hoyolab = new Hoyolab({
: {
cookie: 'your token',
ltokenV2: parseInt('12345677')
ltuidV2,
}: LanguageEnum.ENGLISH,
lang
})
// Fetch all user game accounts from all servers
const games = hoyolab.gamesList()
console.log(games)
// Fetch one game account that has the highest level from all servers
const genshinAccount = hoyolab.gamesList(GamesEnum.GENSHIN_IMPACT)
console.log(genshinAccount)
}
main()
Find out more reference in Hoyolab API Refence
There are several methods to instantiate an object from the GenshinImpact class.
The following method will instantiate an object with the provided data.
import { GenshinImpact, LanguageEnum } from 'node-hoyolab'
const genshin = new GenshinImpact({
cookie: {
ltokenV2: 'your token',
ltuidV2: parseInt('12345677')
, // Required. Cookie can be string or object, see the api refeence below
}lang: LanguageEnum.ENGLISH, // optional
uid: 837_678_687, // Several modules will require UID, which if not filled in will throw an error.
})
, the method below will instantiate an object with some automatically filled data like UID, and will return a Promise.
Meanwhile
import { GenshinImpact, LanguageEnum } from 'node-hoyolab'
const genshin = GenshinImpact.create({
cookie: {
ltokenV2: 'your token',
ltuidV2: parseInt('12345677')
, // Required. Cookie can be string or object, see the api refeence below
}lang: LanguageEnum.ENGLISH, // optional
})
import { GenshinImpact, LanguageEnum } from 'node-hoyolab'
async function main() {
const genshin = new GenshinImpact({
cookie: {
ltokenV2: 'your token',
ltuidV2: parseInt('12345677')
,
}lang: LanguageEnum.ENGLISH,
})
// Retrieves information about the player's performance in the Spiral Abyss.
const spiralAbyss = await genshin.record.spiralAbyss()
console.log(spiralAbyss)
// Retrieves the Genshin characters of the user.
const characters = await genshin.record.characters()
console.log(characters)
// Get user's Genshin Impact game record
const gameRecord = await genshin.record.records()
console.log(gameRecord)
const dailyNote = await genshin.record.dailyNote()
console.log(dailyNote)
}
main()
import { GenshinImpact, LanguageEnum } from 'node-hoyolab'
async function main() {
const genshin = new GenshinImpact({
cookie: {
ltokenV2: 'your token',
ltuidV2: parseInt('12345677')
,
}lang: LanguageEnum.ENGLISH,
})
// Claim the daily rewards.
const claim = await genshin.daily.claim()
console.log(claim)
// Retrieves daily information.
const dailyInfo = await genshin.daily.info()
console.log(dailyInfo)
// Retrieve daily rewards information.
const rewards = await genshin.daily.rewards()
console.log(rewards)
// Get the daily reward for a specific day or the current day
const reward = await genshin.daily.reward()
console.log(reward)
}
main()
import { GenshinImpact, LanguageEnum } from 'node-hoyolab'
async function main() {
const genshin = new GenshinImpact({
cookie: {
ltokenV2: 'your token',
ltuidV2: parseInt('12345677')
,
}lang: LanguageEnum.ENGLISH,
})
const redeem = genshin.redeem.claim('GENSHINGIFT')
console.log(redeem)
}
main()
There are several methods to instantiate an object from the HonkaiStarRail class.
The following method will instantiate an object with the provided data.
import { HonkaiStarRail, LanguageEnum } from 'node-hoyolab'
const hsr = new HonkaiStarRail({
: {
cookie: 'your token',
ltokenV2: parseInt('12345677')
ltuidV2, // Required. Cookie can be string or object, see the api refeence below
}: LanguageEnum.ENGLISH, // optional
lang: 837_678_687, // Several modules will require UID, which if not filled in will throw an error.
uid })
Meanwhile, the method below will instantiate an object with some automatically filled data like UID, and will return a Promise.
import { HonkaiStarRail, LanguageEnum } from 'node-hoyolab'
const hsr = HonkaiStarRail.create({
: {
cookie: 'your token',
ltokenV2: parseInt('12345677')
ltuidV2, // Required. Cookie can be string or object, see the api refeence below
}: LanguageEnum.ENGLISH, // optional
lang })
Find out more reference in Honkai Star Rail API Refence
There are several methods to instantiate an object from the HonkaiImpact class.
The following method will instantiate an object with the provided data.
import { HonkaiImpact, LanguageEnum } from 'node-hoyolab'
const hi = new HonkaiImpact({
: {
cookie: 'your token',
ltokenV2: parseInt('12345677')
ltuidV2, // Required. Cookie can be string or object, see the api refeence below
}: LanguageEnum.ENGLISH, // optional
lang: 837_678_687, // Several modules will require UID, which if not filled in will throw an error.
uid })
Meanwhile, the method below will instantiate an object with some automatically filled data like UID, and will return a Promise.
import { HonkaiImpact, LanguageEnum } from 'node-hoyolab'
const hi = HonkaiImpact.create({
: {
cookie: 'your token',
ltokenV2: parseInt('12345677')
ltuidV2, // Required. Cookie can be string or object, see the api refeence below
}: LanguageEnum.ENGLISH, // optional
lang })
Find out more reference in Honkai Impact API Refence
There are several methods to instantiate an object from the ZenlessZoneZero class.
The following method will instantiate an object with the provided data.
import { ZenlessZoneZero, LanguageEnum } from 'node-hoyolab'
const zzz = new ZenlessZoneZero({
: {
cookie: 'your token',
ltokenV2: parseInt('12345677')
ltuidV2, // Required. Cookie can be string or object, see the api refeence below
}: LanguageEnum.ENGLISH, // optional
lang: 837_678_687, // Several modules will require UID, which if not filled in will throw an error.
uid })
Meanwhile, the method below will instantiate an object with some automatically filled data like UID, and will return a Promise.
import { ZenlessZoneZero, LanguageEnum } from 'node-hoyolab'
const zzz = ZenlessZoneZero.create({
: {
cookie: 'your token',
ltokenV2: parseInt('12345677')
ltuidV2, // Required. Cookie can be string or object, see the api refeence below
}: LanguageEnum.ENGLISH, // optional
lang })
Find out more reference in Zenless Zone Zero API Refence