mirror of
https://github.com/PaiGramTeam/PaiGram.git
synced 2024-11-25 09:37:30 +00:00
🎨 Catch ValueError
exception in input cookie
This commit is contained in:
parent
ab793a07ce
commit
0ca5f0314e
@ -260,17 +260,17 @@ class SetUserCookies(Plugin.Conversation, BasePlugin.Conversation):
|
||||
if message.text == "退出":
|
||||
await message.reply_text("退出任务", reply_markup=ReplyKeyboardRemove())
|
||||
return ConversationHandler.END
|
||||
|
||||
try:
|
||||
# cookie str to dict
|
||||
wrapped = (
|
||||
ArkoWrapper(message.text.split(";")).map(lambda x: x.strip()).map(lambda x: ((y := x.split("="))[0], y[1]))
|
||||
ArkoWrapper(message.text.split(";"))
|
||||
.map(lambda x: x.strip())
|
||||
.map(lambda x: ((y := x.split("="))[0], y[1]))
|
||||
)
|
||||
cookie = {x[0]: x[1] for x in wrapped}
|
||||
|
||||
try:
|
||||
cookies = self.parse_cookie(cookie)
|
||||
except (AttributeError, ValueError) as exc:
|
||||
logger.info("用户 %s[%s] Cookies解析出现错误", user.full_name, user.id)
|
||||
logger.info("用户 %s[%s] Cookies解析出现错误\ntext:%s", user.full_name, user.id, message.text)
|
||||
logger.debug("解析Cookies出现错误", exc_info=exc)
|
||||
await message.reply_text("解析Cookies出现错误,请检查是否正确", reply_markup=ReplyKeyboardRemove())
|
||||
return ConversationHandler.END
|
||||
|
Loading…
Reference in New Issue
Block a user