Skip to main content

Class: GenshinImpact

The Genshin class provides an interface to interact with Genshin Impact-related features on the Mihoyo website. It contains references to various modules such as DailyModule, RedeemModule, GenshinRecordModule, and GenshinDiaryModule which allow you to perform various operations related to these features.

Constructors

constructor

new GenshinImpact(options)

Constructs a new Genshin object.

Parameters

NameTypeDescription
optionsIGenshinOptionsThe options object used to configure the object.

Defined in

src/client/gi/gi.ts:89

Properties

_account

Private _account: null | IGame = null

HoyYolab account object

Defined in

src/client/gi/gi.ts:57


Readonly cookie: ICookie

The cookie object to be used in requests.

Defined in

src/client/gi/gi.ts:62


daily

Readonly daily: DailyModule

The DailyModule object provides an interface to interact with the daily check-in feature in Genshin Impact.

Defined in

src/client/gi/gi.ts:27


diary

Readonly diary: GenshinDiaryModule

The GenshinDiaryModule object provides an interface to interact with the user diary feature in Genshin Impact.

Defined in

src/client/gi/gi.ts:45


lang

Private lang: LanguageEnum

The language to be used in requests.

Defined in

src/client/gi/gi.ts:82


record

Readonly record: GenshinRecordModule

The GenshinRecordModule object provides an interface to interact with the user record feature in Genshin Impact.

Defined in

src/client/gi/gi.ts:39


redeem

Readonly redeem: RedeemModule

The RedeemModule object provides an interface to interact with the code redemption feature in Genshin Impact.

Defined in

src/client/gi/gi.ts:33


region

Readonly region: null | string

The region of the user, if available.

Defined in

src/client/gi/gi.ts:77


request

Private request: HTTPRequest

The Request object used to make requests.

Defined in

src/client/gi/gi.ts:67


tcg

Readonly tcg: GenshinTCGModule

The GenshinTCGModule object provides an interface to interact with the user diary feature in Genshin Impact.

Defined in

src/client/gi/gi.ts:51


uid

Readonly uid: null | number

The UID of the user, if available.

Defined in

src/client/gi/gi.ts:72

Accessors

account

get account(): null | IGame

Getter for the account property.

Returns

null | IGame

The current value of the account property.

Defined in

src/client/gi/gi.ts:197

set account(game): void

Setter for the account property. Prevents from changing the value once set

Parameters

NameTypeDescription
gamenull | IGameThe game object to set as the account.

Returns

void

Defined in

src/client/gi/gi.ts:187

Methods

characters

characters(): Promise<IGenshinCharacters>

Retrieves the Genshin characters of the user.

Alias

Genshin.record.characters()

Deprecated

Use through Genshin.record.characters() instead

Returns

Promise<IGenshinCharacters>

Defined in

src/client/gi/gi.ts:217


charactersSummary

charactersSummary(characterIds): Promise<IGenshinCharacterSummary>

Returns the summary information of Genshin Impact game characters

Alias

Genshin.record.charactersSummary()

Deprecated

Use through Genshin.record.charactersSummary() instead

Parameters

NameTypeDescription
characterIdsnumber[]number[] Characters ID

Returns

Promise<IGenshinCharacterSummary>

Defined in

src/client/gi/gi.ts:228


dailyClaim

dailyClaim(): Promise<IDailyClaim>

Claim current reward

Alias

Genshin.daily.claim()

Deprecated

Use through Genshin.daily.claim() instead

Returns

Promise<IDailyClaim>

Defined in

src/client/gi/gi.ts:318


dailyInfo

dailyInfo(): Promise<IDailyInfo>

Retrieves daily information.

Alias

Genshin.daily.info()

Deprecated

Use through Genshin.daily.info() instead

Returns

Promise<IDailyInfo>

Defined in

src/client/gi/gi.ts:287


dailyNote

dailyNote(): Promise<IGenshinDailyNote>

Retrieve the daily note information for a Genshin Impact user.

Alias

Genshin.record.dailyNote()

Deprecated

Use through Genshin.record.dailyNote() instead

Returns

Promise<IGenshinDailyNote>

Defined in

src/client/gi/gi.ts:251


dailyReward

dailyReward(day?): Promise<IDailyReward>

Get the daily reward for a specific day or the current day

Alias

Genshin.daily.reward()

Deprecated

Use through Genshin.daily.reward() instead

Parameters

NameTypeDefault valueDescription
daynull | numbernullnumber | null

Returns

Promise<IDailyReward>

Defined in

src/client/gi/gi.ts:308


dailyRewards

dailyRewards(): Promise<IDailyRewards>

Retrieve daily rewards information.

Alias

Genshin.daily.rewards()

Deprecated

Use through Genshin.daily.rewards() instead

Returns

Promise<IDailyRewards>

Defined in

src/client/gi/gi.ts:297


diaryDetail

diaryDetail(type, month?): Promise<IGenshinDiaryDetail>

Returns the diary details of a given type and month for a user

Alias

Genshin.diary.detail()

Deprecated

Use through Genshin.diary.detail() instead

Parameters

NameTypeDefault valueDescription
typeDiaryEnumundefinedDiaryEnum
monthDiaryMonthEnumDiaryMonthEnum.CURRENTDiaryMonthEnum

Returns

Promise<IGenshinDiaryDetail>

Defined in

src/client/gi/gi.ts:274


diaryList

diaryList(month?): Promise<IGenshinDiaryInfo>

Returns the diary information of a given month for a user

Alias

Genshin.diary.list()

Deprecated

Use through Genshin.diary.list() instead

Parameters

NameTypeDefault value
monthDiaryMonthEnumDiaryMonthEnum.CURRENT

Returns

Promise<IGenshinDiaryInfo>

Defined in

src/client/gi/gi.ts:262


records

records(): Promise<IGenshinRecord>

Get user's Genshin Impact record

Alias

Genshin.record.records()

Deprecated

Use through Genshin.record.records() instead

Returns

Promise<IGenshinRecord>

Defined in

src/client/gi/gi.ts:207


redeemCode

redeemCode(code): Promise<IRedeemCode>

Redeems a code for a specific account.

Alias

Genshin.redeem.claim()

Deprecated

Use through Genshin.redeem.claim() instead

Parameters

NameTypeDescription
codestringstring

Returns

Promise<IRedeemCode>

Defined in

src/client/gi/gi.ts:329


spiralAbyss

spiralAbyss(scheduleType?): Promise<IGenshinSpiralAbyss>

Retrieves information about the player's performance in the Spiral Abyss.

Alias

Genshin.record.spiralAbyss()

Deprecated

Use through Genshin.record.spiralAbyss() instead

Parameters

NameTypeDefault valueDescription
scheduleTypeSpiralAbyssScheduleEnumSpiralAbyssScheduleEnum.CURRENTSpiralAbyssScheduleEnum

Returns

Promise<IGenshinSpiralAbyss>

Defined in

src/client/gi/gi.ts:239


create

Static create(options): Promise<GenshinImpact>

Create a new instance of the GenshinImpact class asynchronously.

Throws

Error Wnen the CookieTokenV2 is not set.

Remarks

If an object is instantiated from this method but options.cookie.cookieTokenV2 is not set, it will throw an error. This method will access an Endpoint that contains a list of game accounts, which requires the cookieTokenV2 option.

Parameters

NameTypeDescription
optionsIGenshinOptionsThe options object used to configure the object.

Returns

Promise<GenshinImpact>

A promise that resolves with a new Genshin instance.

Defined in

src/client/gi/gi.ts:162