mirror of
https://github.com/PaiGramTeam/PamGram.git
synced 2024-11-29 00:42:44 +00:00
🎨 Update Verification
log and reply text
This commit is contained in:
parent
03fded915a
commit
684cba06a3
@ -65,16 +65,17 @@ class VerificationPlugins(Plugin, BasePlugin):
|
|||||||
if context.args and len(context.args) > 0:
|
if context.args and len(context.args) > 0:
|
||||||
validate = context.args[0]
|
validate = context.args[0]
|
||||||
_, challenge = await self.system.get_challenge(client.uid)
|
_, challenge = await self.system.get_challenge(client.uid)
|
||||||
|
logger.info("用户 %s[%s] 请求通过认证 challenge[%s] validate[%s] ", user.full_name, user.id, challenge, validate)
|
||||||
if challenge:
|
if challenge:
|
||||||
try:
|
try:
|
||||||
await verification.verify(challenge, validate)
|
await verification.verify(challenge, validate)
|
||||||
logger.success(f"用户 %s[%s] 验证成功", user.full_name, user.id)
|
logger.success("用户 %s[%s] 验证成功", user.full_name, user.id)
|
||||||
await message.reply_text("验证成功")
|
await message.reply_text("验证成功")
|
||||||
except ResponseException as exc:
|
except ResponseException as exc:
|
||||||
logger.warning(f"用户 %s[%s] 验证失效 API返回 [%s]%s", user.full_name, user.id, exc.code, exc.message)
|
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} 请稍后重试")
|
await message.reply_text(f"验证失败 错误信息为 [{exc.code}]{exc.message}")
|
||||||
else:
|
else:
|
||||||
logger.warning(f"用户 %s[%s] 验证失效 请求已经过期", user.full_name, user.id)
|
logger.warning("用户 %s[%s] 验证失效 请求已经过期", user.full_name, user.id)
|
||||||
await message.reply_text("验证失效 请求已经过期 请稍后重试")
|
await message.reply_text("验证失效 请求已经过期 请稍后重试")
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
@ -87,13 +88,13 @@ class VerificationPlugins(Plugin, BasePlugin):
|
|||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
data = await verification.create()
|
data = await verification.create()
|
||||||
logger.success(f"用户 %s[%s] 创建验证成功", user.full_name, user.id)
|
|
||||||
except ResponseException as exc:
|
|
||||||
logger.warning(f"用户 %s[%s] 创建验证失效 API返回 [%s]%s 请稍后重试", user.full_name, user.id, exc.code, exc.message)
|
|
||||||
await message.reply_text(f"创建验证失败 错误信息为 [{exc.code}]{exc.message} 请稍后重试")
|
|
||||||
return
|
|
||||||
challenge = data["challenge"]
|
challenge = data["challenge"]
|
||||||
gt = data["gt"]
|
gt = data["gt"]
|
||||||
|
logger.success("用户 %s[%s] 创建验证成功 gt[%s] challenge[%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} 请稍后重试")
|
||||||
|
return
|
||||||
try:
|
try:
|
||||||
validate = await verification.ajax(referer="https://webstatic.mihoyo.com/", gt=gt, challenge=challenge)
|
validate = await verification.ajax(referer="https://webstatic.mihoyo.com/", gt=gt, challenge=challenge)
|
||||||
if validate:
|
if validate:
|
||||||
|
@ -144,43 +144,48 @@ class StartPlugin(Plugin):
|
|||||||
else:
|
else:
|
||||||
await message.reply_text("账户正常,无需认证")
|
await message.reply_text("账户正常,无需认证")
|
||||||
return
|
return
|
||||||
await message.reply_text("由于官方对第三方工具限制以及账户安全的考虑,频繁使用第三方工具会导致账号被风控并要求用过验证才能进行访问。\n"
|
await message.reply_text(
|
||||||
|
"由于官方对第三方工具限制以及账户安全的考虑,频繁使用第三方工具会导致账号被风控并要求用过验证才能进行访问。\n"
|
||||||
"如果出现频繁验证请求,建议暂停使用本Bot在内的第三方工具查询功能。\n"
|
"如果出现频繁验证请求,建议暂停使用本Bot在内的第三方工具查询功能。\n"
|
||||||
"在暂停使用期间依然出现频繁认证,建议修改密码以保护账号安全。")
|
"在暂停使用期间依然出现频繁认证,建议修改密码以保护账号安全。"
|
||||||
|
)
|
||||||
verification = Verification(cookies=client.cookie_manager.cookies)
|
verification = Verification(cookies=client.cookie_manager.cookies)
|
||||||
if validate:
|
if validate:
|
||||||
_, challenge = await self.verification_system.get_challenge(client.uid)
|
_, challenge = await self.verification_system.get_challenge(client.uid)
|
||||||
if challenge:
|
if challenge:
|
||||||
|
logger.info(
|
||||||
|
"用户 %s[%s] 请求通过认证 challenge[%s] validate[%s] ", user.full_name, user.id, challenge, validate
|
||||||
|
)
|
||||||
try:
|
try:
|
||||||
await verification.verify(challenge, validate)
|
await verification.verify(challenge, validate)
|
||||||
logger.success(f"用户 %s[%s] 验证成功", user.full_name, user.id)
|
logger.success("用户 %s[%s] 验证成功", user.full_name, user.id)
|
||||||
await message.reply_text("验证成功")
|
await message.reply_text("验证成功")
|
||||||
except ResponseException as exc:
|
except ResponseException as exc:
|
||||||
logger.warning(f"用户 %s[%s] 验证失效 API返回 [%s]%s", user.full_name, user.id, exc.code, exc.message)
|
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} 请稍后重试")
|
await message.reply_text(f"验证失败 错误信息为 [{exc.code}]{exc.message} 请稍后重试")
|
||||||
else:
|
else:
|
||||||
logger.warning(f"用户 %s[%s] 验证失效 请求已经过期", user.full_name, user.id)
|
logger.warning("用户 %s[%s] 验证失效 请求已经过期", user.full_name, user.id)
|
||||||
await message.reply_text("验证失效 请求已经过期 请稍后重试")
|
await message.reply_text("验证失效 请求已经过期 请稍后重试")
|
||||||
return
|
return
|
||||||
if bot_username:
|
if bot_username:
|
||||||
try:
|
try:
|
||||||
data = await verification.create()
|
data = await verification.create()
|
||||||
logger.success(f"用户 %s[%s] 创建验证成功", user.full_name, user.id)
|
|
||||||
except ResponseException as exc:
|
|
||||||
logger.warning(f"用户 %s[%s] 创建验证失效 API返回 [%s]%s", user.full_name, user.id, exc.code, exc.message)
|
|
||||||
await message.reply_text(f"创建验证失败 错误信息为 [{exc.code}]{exc.message} 请稍后重试")
|
|
||||||
return
|
|
||||||
challenge = data["challenge"]
|
challenge = data["challenge"]
|
||||||
gt = data["gt"]
|
gt = data["gt"]
|
||||||
|
logger.success("用户 %s[%s] 创建验证成功 gt[%s] challenge[%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}")
|
||||||
|
return
|
||||||
try:
|
try:
|
||||||
validate = await verification.ajax(referer="https://webstatic.mihoyo.com/", gt=gt, challenge=challenge)
|
validate = await verification.ajax(referer="https://webstatic.mihoyo.com/", gt=gt, challenge=challenge)
|
||||||
if validate:
|
if validate:
|
||||||
await verification.verify(challenge, validate)
|
await verification.verify(challenge, validate)
|
||||||
logger.success(f"用户 %s[%s] 通过 ajax 验证", user.full_name, user.id)
|
logger.success("用户 %s[%s] 通过 ajax 验证", user.full_name, user.id)
|
||||||
await message.reply_text("验证成功")
|
await message.reply_text("验证成功")
|
||||||
return
|
return
|
||||||
except APIHelperException as exc:
|
except APIHelperException as exc:
|
||||||
logger.warning(f"用户 %s[%s] ajax 验证失效 错误信息为 %s", user.full_name, user.id, repr(exc))
|
logger.warning("用户 %s[%s] ajax 验证失效 错误信息为 %s", user.full_name, user.id, repr(exc))
|
||||||
await self.verification_system.set_challenge(client.uid, gt, challenge)
|
await self.verification_system.set_challenge(client.uid, gt, challenge)
|
||||||
url = f"{config.pass_challenge_user_web}?username={bot_username}&command=verify>={gt}&challenge={challenge}&uid={client.uid}"
|
url = f"{config.pass_challenge_user_web}?username={bot_username}&command=verify>={gt}&challenge={challenge}&uid={client.uid}"
|
||||||
button = InlineKeyboardMarkup([[InlineKeyboardButton("验证", url=url)]])
|
button = InlineKeyboardMarkup([[InlineKeyboardButton("验证", url=url)]])
|
||||||
|
Loading…
Reference in New Issue
Block a user