🐛 Fix gen gt

This commit is contained in:
xtaodada 2022-10-30 17:12:14 +08:00
parent cd2a426365
commit 08f2e636ef
Signed by: xtaodada
GPG Key ID: 4CBB3F4FA8C85659
2 changed files with 2 additions and 10 deletions

View File

@ -171,7 +171,7 @@ class Sign(Plugin, BasePlugin):
@staticmethod
async def gen_challenge_header(uid: int, validate: str) -> Optional[Dict]:
challenge = await SignRedis.get(uid)
if not challenge:
if not challenge or not validate:
return
return {
"x-rpc-challenge": challenge.decode("utf-8"),
@ -213,14 +213,6 @@ class Sign(Plugin, BasePlugin):
request_daily_reward.get("gt", ""),
request_daily_reward.get("challenge", ""),
)
if not headers:
button = await Sign.gen_challenge_button(
client.uid,
request_daily_reward.get("gt", ""),
request_daily_reward.get("challenge", ""),
)
logger.warning(f"UID {client.uid} 签到失败,触发验证码风控")
return f"UID {client.uid} 签到失败,触发验证码风控,请尝试重新签到。", button
request_daily_reward = await client.request_daily_reward(
"sign",
method="POST",

View File

@ -48,7 +48,7 @@ class StartPlugin(Plugin):
with contextlib.suppress(UserNotFoundError, CookiesNotFoundError):
client = await get_genshin_client(update.effective_user.id)
await update.effective_message.reply_chat_action(ChatAction.TYPING)
headers = await Sign.gen_challenge_header(update.effective_user.id, validate)
headers = await Sign.gen_challenge_header(client.uid, validate)
if not headers:
await update.effective_message.reply_text("验证请求已过期。", allow_sending_without_reply=True)
return