🐛 Remove specify the default game parameter

This commit is contained in:
xtaodada 2024-10-11 10:29:03 +08:00
parent af3f4dcbba
commit 0570e8c79a
Signed by: xtaodada
GPG Key ID: 4CBB3F4FA8C85659

View File

@ -6,7 +6,6 @@ from enum import Enum
from typing import Optional, Tuple, List, TYPE_CHECKING from typing import Optional, Tuple, List, TYPE_CHECKING
from httpx import TimeoutException from httpx import TimeoutException
from simnet import Game
from simnet.errors import BadRequest as SimnetBadRequest, AlreadyClaimed, InvalidCookies, TimedOut as SimnetTimedOut from simnet.errors import BadRequest as SimnetBadRequest, AlreadyClaimed, InvalidCookies, TimedOut as SimnetTimedOut
from sqlalchemy.orm.exc import StaleDataError from sqlalchemy.orm.exc import StaleDataError
from telegram import InlineKeyboardButton, InlineKeyboardMarkup from telegram import InlineKeyboardButton, InlineKeyboardMarkup
@ -115,14 +114,14 @@ class SignSystem(Plugin):
if is_sleep: if is_sleep:
await asyncio.sleep(random.randint(0, 3)) # nosec await asyncio.sleep(random.randint(0, 3)) # nosec
try: try:
rewards = await client.get_monthly_rewards(game=Game.GENSHIN, lang="zh-cn") rewards = await client.get_monthly_rewards(lang="zh-cn")
except SimnetBadRequest as error: except SimnetBadRequest as error:
logger.warning("UID[%s] 获取签到信息失败API返回信息为 %s", client.player_id, str(error)) logger.warning("UID[%s] 获取签到信息失败API返回信息为 %s", client.player_id, str(error))
if is_raise: if is_raise:
raise error raise error
return f"获取签到信息失败API返回信息为 {str(error)}" return f"获取签到信息失败API返回信息为 {str(error)}"
try: try:
daily_reward_info = await client.get_reward_info(game=Game.GENSHIN, lang="zh-cn") # 获取签到信息失败 daily_reward_info = await client.get_reward_info(lang="zh-cn") # 获取签到信息失败
except SimnetBadRequest as error: except SimnetBadRequest as error:
logger.warning("UID[%s] 获取签到状态失败API返回信息为 %s", client.player_id, str(error)) logger.warning("UID[%s] 获取签到状态失败API返回信息为 %s", client.player_id, str(error))
if is_raise: if is_raise:
@ -137,7 +136,6 @@ class SignSystem(Plugin):
request_daily_reward = await client.request_daily_reward( request_daily_reward = await client.request_daily_reward(
"sign", "sign",
method="POST", method="POST",
game=Game.GENSHIN,
lang="zh-cn", lang="zh-cn",
challenge=challenge, challenge=challenge,
validate=validate, validate=validate,
@ -159,7 +157,6 @@ class SignSystem(Plugin):
request_daily_reward = await client.request_daily_reward( request_daily_reward = await client.request_daily_reward(
"sign", "sign",
method="POST", method="POST",
game=Game.GENSHIN,
lang="zh-cn", lang="zh-cn",
challenge=challenge, challenge=challenge,
validate=validate, validate=validate,
@ -179,7 +176,6 @@ class SignSystem(Plugin):
_request_daily_reward = await client.request_daily_reward( _request_daily_reward = await client.request_daily_reward(
"sign", "sign",
method="POST", method="POST",
game=Game.GENSHIN,
lang="zh-cn", lang="zh-cn",
) )
logger.debug("request_daily_reward 返回\n%s", _request_daily_reward) logger.debug("request_daily_reward 返回\n%s", _request_daily_reward)
@ -195,7 +191,6 @@ class SignSystem(Plugin):
request_daily_reward = await client.request_daily_reward( request_daily_reward = await client.request_daily_reward(
"sign", "sign",
method="POST", method="POST",
game=Game.GENSHIN,
lang="zh-cn", lang="zh-cn",
challenge=_challenge, challenge=_challenge,
validate=_validate, validate=_validate,
@ -215,7 +210,7 @@ class SignSystem(Plugin):
logger.success("UID[%s] 通过 recognize 签到成功", client.player_id) logger.success("UID[%s] 通过 recognize 签到成功", client.player_id)
else: else:
request_daily_reward = await client.request_daily_reward( request_daily_reward = await client.request_daily_reward(
"sign", method="POST", game=Game.GENSHIN, lang="zh-cn" "sign", method="POST", lang="zh-cn"
) )
gt = request_daily_reward.get("gt", "") gt = request_daily_reward.get("gt", "")
challenge = request_daily_reward.get("challenge", "") challenge = request_daily_reward.get("challenge", "")
@ -224,9 +219,7 @@ class SignSystem(Plugin):
) )
raise NeedChallenge(uid=client.player_id, gt=gt, challenge=challenge) raise NeedChallenge(uid=client.player_id, gt=gt, challenge=challenge)
else: else:
request_daily_reward = await client.request_daily_reward( request_daily_reward = await client.request_daily_reward("sign", method="POST", lang="zh-cn")
"sign", method="POST", game=Game.GENSHIN, lang="zh-cn"
)
gt = request_daily_reward.get("gt", "") gt = request_daily_reward.get("gt", "")
challenge = request_daily_reward.get("challenge", "") challenge = request_daily_reward.get("challenge", "")
logger.success("UID[%s] 创建验证成功\ngt[%s]\nchallenge[%s]", client.player_id, gt, challenge) logger.success("UID[%s] 创建验证成功\ngt[%s]\nchallenge[%s]", client.player_id, gt, challenge)