🐛 Fix abyss not handling TooManyRequestPublicCookies exception correctly

This commit is contained in:
洛水居室 2022-11-17 09:26:10 +08:00
parent 3c4b24bf25
commit 79272ab330
No known key found for this signature in database
GPG Key ID: C9DE87DA724B88FC

View File

@ -128,9 +128,12 @@ class Abyss(Plugin, BasePlugin):
)
try:
client = await get_genshin_client(user.id)
await client.get_record_cards()
uid = client.uid
try:
client = await get_genshin_client(user.id)
await client.get_record_cards()
uid = client.uid
except CookiesNotFoundError:
client, uid = await get_public_genshin_client(user.id)
except UserNotFoundError: # 若未找到账号
buttons = [[InlineKeyboardButton("点我绑定账号", url=f"https://t.me/{context.bot.username}?start=set_uid")]]
if filters.ChatType.GROUPS.filter(message):
@ -143,8 +146,6 @@ class Abyss(Plugin, BasePlugin):
else:
await message.reply_text("未查询到您所绑定的账号信息,请先绑定账号", reply_markup=InlineKeyboardMarkup(buttons))
return
except CookiesNotFoundError: # 若未找到cookie
client, uid = await get_public_genshin_client(user.id)
except TooManyRequestPublicCookies:
reply_msg = await message.reply_text("查询次数太多,请您稍后重试")
if filters.ChatType.GROUPS.filter(message):