Skip to content

Commit

Permalink
fix: 亞服新 18 UID InvalidCookie 錯誤 (#67)
Browse files Browse the repository at this point in the history
  • Loading branch information
KT-Yeh committed Apr 27, 2024
1 parent 29b3233 commit 97f6399
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions cogs/cookie_setting/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,13 @@ async def on_submit(self, interaction: discord.Interaction):
if len(self.ltuid_v2.value) > 0:
if self.ltuid_v2.value.isdigit() is True:
cookie += f" ltuid{v2_str}={self.ltuid_v2.value};"
cookie += f" account_id{v2_str}={self.ltuid_v2.value};"
else: # ltuid_v2 不是數字,可能是 ltmid_v2
cookie += f" ltmid_v2={self.ltuid_v2.value};"
cookie += f" account_mid_v2={self.ltuid_v2.value};"
if len(self.ltmid_v2.value) > 0:
cookie += f" ltmid_v2={self.ltmid_v2.value};"
cookie += f" account_mid_v2={self.ltmid_v2.value};"

LOG.Info(f"設定 {LOG.User(interaction.user)} 的Cookie:{self.cookie.value}")
try:
Expand Down
2 changes: 1 addition & 1 deletion genshin_py/client/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ async def get_client(
case genshin.Game.GENSHIN:
uid = user.uid_genshin or 0
cookie = user.cookie_genshin or user.cookie_default
if str(uid)[0] in ["1", "2", "5"]:
if len(str(uid)) == 9 and str(uid)[0] in ["1", "2", "5"]:
client = genshin.Client(region=genshin.Region.CHINESE, lang="zh-cn")
case genshin.Game.HONKAI:
uid = user.uid_honkai3rd or 0
Expand Down

0 comments on commit 97f6399

Please sign in to comment.