🎨 ask set cookies when public request failed

This commit is contained in:
xtaodada 2023-10-01 20:37:19 +08:00
parent 235f9f349e
commit a778f78c8a
Signed by: xtaodada
GPG Key ID: 4CBB3F4FA8C85659
3 changed files with 6 additions and 8 deletions

View File

@ -216,12 +216,12 @@ class BindAccountPlugin(Plugin.Conversation):
return ConversationHandler.END return ConversationHandler.END
except InvalidCookies: except InvalidCookies:
await self.public_cookies_service.undo(user.id, cookies, CookiesStatusEnum.INVALID_COOKIES) await self.public_cookies_service.undo(user.id, cookies, CookiesStatusEnum.INVALID_COOKIES)
await message.reply_text("出错了呜呜呜 ~ 请稍后重试") await message.reply_text("出错了呜呜呜 ~ 请稍后重试或者绑定 cookie")
return ConversationHandler.END return ConversationHandler.END
except SimnetBadRequest as exc: except SimnetBadRequest as exc:
if exc.ret_code == 1034: if exc.ret_code == 1034:
await self.public_cookies_service.undo(user.id) await self.public_cookies_service.undo(user.id)
await message.reply_text("出错了呜呜呜 ~ 请稍后重试") await message.reply_text("出错了呜呜呜 ~ 请稍后重试或者绑定 cookie")
return ConversationHandler.END return ConversationHandler.END
await message.reply_text("获取账号信息发生错误", reply_markup=ReplyKeyboardRemove()) await message.reply_text("获取账号信息发生错误", reply_markup=ReplyKeyboardRemove())
logger.error("获取账号信息发生错误") logger.error("获取账号信息发生错误")

View File

@ -134,9 +134,8 @@ class AbyssPlugin(Plugin):
async with self.helper.public_genshin(user.id) as client: async with self.helper.public_genshin(user.id) as client:
images = await self.get_rendered_pic(client, uid, floor, total, previous) images = await self.get_rendered_pic(client, uid, floor, total, previous)
except SimnetBadRequest as exc: except SimnetBadRequest as exc:
if exc.ret_code == 1034 and client.player_id != uid: if exc.ret_code == 1034 and uid and uid != client.player_id:
await message.reply_text("出错了呜呜呜 ~ 请稍后重试") raise CookiesNotFoundError(uid) from exc
return
raise exc raise exc
except AbyssUnlocked: # 若深渊未解锁 except AbyssUnlocked: # 若深渊未解锁
await message.reply_text("还未解锁深渊哦~") await message.reply_text("还未解锁深渊哦~")

View File

@ -53,9 +53,8 @@ class PlayerStatsPlugins(Plugin):
async with self.helper.public_genshin(user.id) as client: async with self.helper.public_genshin(user.id) as client:
render_result = await self.render(client, uid) render_result = await self.render(client, uid)
except SimnetBadRequest as exc: except SimnetBadRequest as exc:
if exc.ret_code == 1034 and uid: if exc.ret_code == 1034 and uid and uid != client.player_id:
await message.reply_text("出错了呜呜呜 ~ 请稍后重试") raise CookiesNotFoundError(uid) from exc
return
raise exc raise exc
except TooManyRequestPublicCookies: except TooManyRequestPublicCookies:
await message.reply_text("用户查询次数过多 请稍后重试") await message.reply_text("用户查询次数过多 请稍后重试")