🎨 Update verification reply text and log

This commit is contained in:
洛水居室 2022-11-20 19:52:36 +08:00
parent 2b83985efd
commit c4db39c3df
No known key found for this signature in database
GPG Key ID: C9DE87DA724B88FC
3 changed files with 16 additions and 6 deletions

View File

@ -78,7 +78,7 @@ class VerificationPlugins(Plugin, BasePlugin):
data = await verification.create(is_high=is_high)
challenge = data["challenge"]
gt = data["gt"]
logger.success("用户 %s[%s] 创建验证成功 gt[%s] challenge[%s]", user.full_name, user.id, gt, challenge)
logger.success("用户 %s[%s] 创建验证成功\ngt:%s\nchallenge%s", user.full_name, user.id, gt, challenge)
except ResponseException as exc:
logger.warning("用户 %s[%s] 创建验证失效 API返回 [%s]%s", user.full_name, user.id, exc.code, exc.message)
await message.reply_text(f"创建验证失败 错误信息为 [{exc.code}]{exc.message} 请稍后重试")

View File

@ -149,7 +149,7 @@ class StartPlugin(Plugin):
data = await verification.create(is_high=True)
challenge = data["challenge"]
gt = data["gt"]
logger.success("用户 %s[%s] 创建验证成功 gt[%s] challenge[%s]", user.full_name, user.id, gt, challenge)
logger.success("用户 %s[%s] 创建验证成功\ngt:%s\nchallenge%s", user.full_name, user.id, gt, challenge)
except ResponseException as exc:
logger.warning("用户 %s[%s] 创建验证失效 API返回 [%s]%s", user.full_name, user.id, exc.code, exc.message)
await message.reply_text(f"验证失败 错误信息为 [{exc.code}]{exc.message}")

View File

@ -73,7 +73,7 @@ class WebApp(Plugin):
_, challenge = await self.verification_system.get_challenge(client.uid)
if challenge:
logger.info(
"用户 %s[%s] 请求通过认证 challenge[%s] validate[%s] ",
"用户 %s[%s] 请求通过认证\nchallenge:%s\nvalidate:%s",
user.full_name,
user.id,
challenge,
@ -87,7 +87,15 @@ class WebApp(Plugin):
logger.warning(
"用户 %s[%s] 验证失效 API返回 [%s]%s", user.full_name, user.id, exc.code, exc.message
)
await message.reply_text(f"验证失败 错误信息为 [{exc.code}]{exc.message} 请稍后重试", reply_markup=ReplyKeyboardRemove())
if "拼图已过期" in exc.message:
await message.reply_text(
"验证失败,拼图已过期,请稍后重试或更换使用环境进行验证", reply_markup=ReplyKeyboardRemove()
)
else:
await message.reply_text(
f"验证失败,错误信息为 [{exc.code}]{exc.message},请稍后重试",
reply_markup=ReplyKeyboardRemove(),
)
else:
logger.warning("用户 %s[%s] 验证失效 请求已经过期", user.full_name, user.id)
await message.reply_text("验证失效 请求已经过期 请稍后重试", reply_markup=ReplyKeyboardRemove())
@ -104,10 +112,12 @@ class WebApp(Plugin):
data = await verification.create(is_high=True)
challenge = data["challenge"]
gt = data["gt"]
logger.success("用户 %s[%s] 创建验证成功 gt[%s] challenge[%s]", user.full_name, user.id, gt, challenge)
logger.success("用户 %s[%s] 创建验证成功\ngt:%s\nchallenge%s", user.full_name, user.id, gt, challenge)
except ResponseException as exc:
logger.warning("用户 %s[%s] 创建验证失效 API返回 [%s]%s", user.full_name, user.id, exc.code, exc.message)
await message.reply_text(f"创建验证失败 错误信息为 [{exc.code}]{exc.message} 请稍后重试", reply_markup=ReplyKeyboardRemove())
await message.reply_text(
f"创建验证失败 错误信息为 [{exc.code}]{exc.message} 请稍后重试", reply_markup=ReplyKeyboardRemove()
)
return
await self.verification_system.set_challenge(client.uid, gt, challenge)
url = f"{config.pass_challenge_user_web}/webapp?username={context.bot.username}&command=verify&gt={gt}&challenge={challenge}&uid={client.uid}"