🐛 Fix region

This commit is contained in:
洛水居室 2023-07-19 09:58:37 +08:00
parent 4f686f5284
commit 1c1157da46
No known key found for this signature in database
GPG Key ID: C9DE87DA724B88FC

View File

@ -225,11 +225,10 @@ class GenshinHelper(Plugin):
raise CookiesNotFoundError(user_id) raise CookiesNotFoundError(user_id)
cookies = cookie_model.data cookies = cookie_model.data
region = player.region if player.region == RegionEnum.HYPERION: # 国服
if region == RegionEnum.HYPERION: # 国服 region = Region.CHINESE
game_region = Region.CHINESE elif player.region == RegionEnum.HOYOLAB: # 国际服
elif region == RegionEnum.HOYOLAB: # 国际服 region = Region.OVERSEAS
game_region = Region.OVERSEAS
else: else:
raise TypeError("Region is not None") raise TypeError("Region is not None")
@ -242,7 +241,7 @@ class GenshinHelper(Plugin):
async with GenshinClient( async with GenshinClient(
cookies, cookies,
region=game_region, region=region,
account_id=player.account_id, account_id=player.account_id,
player_id=player.player_id, player_id=player.player_id,
lang="zh-cn", lang="zh-cn",
@ -263,11 +262,10 @@ class GenshinHelper(Plugin):
raise CookiesNotFoundError(user_id) raise CookiesNotFoundError(user_id)
cookies = cookie_model.data cookies = cookie_model.data
region = player.region if player.region == RegionEnum.HYPERION:
if region == RegionEnum.HYPERION: region = Region.CHINESE
game_region = Region.CHINESE elif player.region == RegionEnum.HOYOLAB:
elif region == RegionEnum.HOYOLAB: region = Region.OVERSEAS
game_region = Region.OVERSEAS
else: else:
raise TypeError("Region is not None") raise TypeError("Region is not None")
@ -280,7 +278,7 @@ class GenshinHelper(Plugin):
return GenshinClient( return GenshinClient(
cookies, cookies,
region=game_region, region=region,
account_id=player.account_id, account_id=player.account_id,
player_id=player.player_id, player_id=player.player_id,
lang="zh-cn", lang="zh-cn",
@ -296,10 +294,10 @@ class GenshinHelper(Plugin):
cookies = await self.public_cookies_service.get_cookies(user_id, region) cookies = await self.public_cookies_service.get_cookies(user_id, region)
uid = player.player_id uid = player.player_id
if region is RegionEnum.HYPERION: if player.region == RegionEnum.HYPERION:
game_region = Region.CHINESE region = Region.CHINESE
elif region is RegionEnum.HOYOLAB: elif player.region == RegionEnum.HOYOLAB:
game_region = Region.OVERSEAS region = Region.OVERSEAS
else: else:
raise TypeError("Region is not `RegionEnum.NULL`") raise TypeError("Region is not `RegionEnum.NULL`")
@ -312,7 +310,7 @@ class GenshinHelper(Plugin):
async with GenshinClient( async with GenshinClient(
cookies.data, cookies.data,
region=game_region, region=region,
account_id=player.account_id, account_id=player.account_id,
player_id=uid, player_id=uid,
lang="zh-cn", lang="zh-cn",