From 79272ab33015d786d35e59947a2fa3661867af65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B4=9B=E6=B0=B4=E5=B1=85=E5=AE=A4?= Date: Thu, 17 Nov 2022 09:26:10 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20`abyss`=20not=20handling?= =?UTF-8?q?=20`TooManyRequestPublicCookies`=20exception=20correctly?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/genshin/abyss.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/plugins/genshin/abyss.py b/plugins/genshin/abyss.py index 6eae5cea..cd84273b 100644 --- a/plugins/genshin/abyss.py +++ b/plugins/genshin/abyss.py @@ -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):