🐛 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

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