🐛 Fix Incorrect Region

This commit is contained in:
洛水居室 2022-12-27 14:30:36 +08:00
parent 6552606cc7
commit 4aa00fc43c
No known key found for this signature in database
GPG Key ID: C9DE87DA724B88FC

View File

@ -95,8 +95,8 @@ class SetUserCookies(Plugin.Conversation, BasePlugin.Conversation):
add_user_command_data: AddUserCommandData = context.chat_data.get("add_user_command_data") add_user_command_data: AddUserCommandData = context.chat_data.get("add_user_command_data")
if add_user_command_data is None: if add_user_command_data is None:
add_user_command_data = AddUserCommandData() add_user_command_data = AddUserCommandData()
add_user_command_data.region = RegionEnum.HYPERION
context.chat_data["add_user_command_data"] = add_user_command_data context.chat_data["add_user_command_data"] = add_user_command_data
add_user_command_data.region = RegionEnum.HYPERION
try: try:
user_info = await self.user_service.get_user_by_id(user.id) user_info = await self.user_service.get_user_by_id(user.id)
except UserNotFoundError: except UserNotFoundError:
@ -238,9 +238,9 @@ class SetUserCookies(Plugin.Conversation, BasePlugin.Conversation):
add_user_command_data: AddUserCommandData = context.chat_data.get("add_user_command_data") add_user_command_data: AddUserCommandData = context.chat_data.get("add_user_command_data")
cookies = add_user_command_data.cookies cookies = add_user_command_data.cookies
if add_user_command_data.region == RegionEnum.HYPERION: if add_user_command_data.region == RegionEnum.HYPERION:
client = genshin.ChineseClient(cookies=cookies) client = genshin.Client(cookies=cookies, region=types.Region.CHINESE)
elif add_user_command_data.region == RegionEnum.HOYOLAB: elif add_user_command_data.region == RegionEnum.HOYOLAB:
client = genshin.GenshinClient(cookies=cookies) client = genshin.Client(cookies=cookies, region=types.Region.OVERSEAS)
else: else:
logger.error("用户 %s[%s] region 异常", user.full_name, user.id) logger.error("用户 %s[%s] region 异常", user.full_name, user.id)
await message.reply_text("数据错误", reply_markup=ReplyKeyboardRemove()) await message.reply_text("数据错误", reply_markup=ReplyKeyboardRemove())