From a778f78c8ab638b5fc0f3b6ddc4520ea80dc89c4 Mon Sep 17 00:00:00 2001 From: xtaodada Date: Sun, 1 Oct 2023 20:37:19 +0800 Subject: [PATCH] :art: ask set cookies when public request failed --- plugins/account/account.py | 4 ++-- plugins/genshin/abyss.py | 5 ++--- plugins/genshin/stats.py | 5 ++--- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/plugins/account/account.py b/plugins/account/account.py index 7d72e988..3aaa6d1c 100644 --- a/plugins/account/account.py +++ b/plugins/account/account.py @@ -216,12 +216,12 @@ class BindAccountPlugin(Plugin.Conversation): return ConversationHandler.END except InvalidCookies: await self.public_cookies_service.undo(user.id, cookies, CookiesStatusEnum.INVALID_COOKIES) - await message.reply_text("出错了呜呜呜 ~ 请稍后重试") + await message.reply_text("出错了呜呜呜 ~ 请稍后重试或者绑定 cookie") return ConversationHandler.END except SimnetBadRequest as exc: if exc.ret_code == 1034: await self.public_cookies_service.undo(user.id) - await message.reply_text("出错了呜呜呜 ~ 请稍后重试") + await message.reply_text("出错了呜呜呜 ~ 请稍后重试或者绑定 cookie") return ConversationHandler.END await message.reply_text("获取账号信息发生错误", reply_markup=ReplyKeyboardRemove()) logger.error("获取账号信息发生错误") diff --git a/plugins/genshin/abyss.py b/plugins/genshin/abyss.py index 4173b83c..133a6a89 100644 --- a/plugins/genshin/abyss.py +++ b/plugins/genshin/abyss.py @@ -134,9 +134,8 @@ class AbyssPlugin(Plugin): async with self.helper.public_genshin(user.id) as client: images = await self.get_rendered_pic(client, uid, floor, total, previous) except SimnetBadRequest as exc: - if exc.ret_code == 1034 and client.player_id != uid: - await message.reply_text("出错了呜呜呜 ~ 请稍后重试") - return + if exc.ret_code == 1034 and uid and uid != client.player_id: + raise CookiesNotFoundError(uid) from exc raise exc except AbyssUnlocked: # 若深渊未解锁 await message.reply_text("还未解锁深渊哦~") diff --git a/plugins/genshin/stats.py b/plugins/genshin/stats.py index 83a389ff..9bc6f357 100644 --- a/plugins/genshin/stats.py +++ b/plugins/genshin/stats.py @@ -53,9 +53,8 @@ class PlayerStatsPlugins(Plugin): async with self.helper.public_genshin(user.id) as client: render_result = await self.render(client, uid) except SimnetBadRequest as exc: - if exc.ret_code == 1034 and uid: - await message.reply_text("出错了呜呜呜 ~ 请稍后重试") - return + if exc.ret_code == 1034 and uid and uid != client.player_id: + raise CookiesNotFoundError(uid) from exc raise exc except TooManyRequestPublicCookies: await message.reply_text("用户查询次数过多 请稍后重试")