genshin-kit/genshin-kit-node

[BUG?] 关于xxx的故障/The bug is about getting userinfo

Sureiyaaa opened this issue · 16 comments

I was trying to get the user info again I don't know if this is a bug or what but it says "Data is not public for this user"
Even though it is public on my account

Code:
console.log(this.client.genshin.getUserInfo(800151827).then(console.log, console.error))

Error:
{ code: 10102, message: 'Data is not public for the user' }

  • genshin-kit: 2.4.1
  • Node.js: 16

I tried to use my hoyolab account ID instead but it says a different error now
Code:
console.log(this.client.genshin.getUserInfo(10275214).then(console.log, console.error))
Error:
{ code: 1009, message: '角色信息错误' }
I don't know what it means but I think it says "Role information error"

Did you use your hoyolab account cookies to login? loginWithCookie

I tried to use my hoyolab account ID instead but it says a different error now

P.S. This error was expected. You should use the in-game UID to query.

I tried the in game uid but still it says not public

Did you use your hoyolab account cookies to login? loginWithCookie

I did

Why did he get a Chinese error message. Maybe forgot setServerType?

That will give code 1008

I did set my setServerType and Locale

client.genshin.setServerType('os');
client.genshin.setServerLocale('en-us');

GenshinKit {
  _cache: {},
  cookie: 'ltoken=***; ltuid=***',
  _getApiEndpoint: [Function: _getApiEndpoint],
  _getDS: [Function: _getDS],
  _getHttpHeaders: [Function: _getHttpHeaders],
  _getServer: [Function: _getServer],
  _hoyolabVersion: [Function: _hoyolabVersion],
  request: [AsyncFunction: request],
  serverType: 'os',
  serverLocale: 'en-us',
  getCharacters: [AsyncFunction: getAllCharacters],
  getUserRoles: [AsyncFunction: getAllCharacters],
  getAbyss: [AsyncFunction: getSpiralAbyss],
  getCurAbyss: [AsyncFunction: getCurrentAbyss],
  getPrevAbyss: [AsyncFunction: getPreviousAbyss],
  setCookie: [Function: loginWithCookie]
}

It worked on my side, so I don't know where it goes wrong

But I can't query your info, so it should be your settings

I got a new error tho

node:internal/process/promises:246
          triggerUncaughtException(err, true /* fromPromise */);
          ^

[UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "#<Object>".] {
  code: 'ERR_UNHANDLED_REJECTION'
}

is it my node.js version?
v16.7.0

I don't think it's node.js version

Oh you mean its in my account?

But I can't query your info, so it should be your settings

Since I can query myself, it should be so

Actually it was wrong on my part Thank you!