mirror of
https://github.com/PaiGramTeam/SIMNet.git
synced 2024-11-22 14:28:08 +00:00
🎨 Update DailyRewardClient
error handler
This commit is contained in:
parent
cc06be92fb
commit
9970561cf7
@ -80,7 +80,7 @@ class DailyRewardClient(BaseClient):
|
|||||||
|
|
||||||
url = base_url / endpoint
|
url = base_url / endpoint
|
||||||
|
|
||||||
return await self.request_lab(
|
daily_reward = await self.request_lab(
|
||||||
url,
|
url,
|
||||||
method,
|
method,
|
||||||
params=params,
|
params=params,
|
||||||
@ -88,6 +88,20 @@ class DailyRewardClient(BaseClient):
|
|||||||
lang=lang,
|
lang=lang,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if endpoint == "sign":
|
||||||
|
if self.region == Region.CHINESE and daily_reward.get("success", 0) == 1:
|
||||||
|
gt = daily_reward.get("gt", "")
|
||||||
|
challenge = daily_reward.get("challenge", "")
|
||||||
|
raise GeetestTriggered(gt, challenge)
|
||||||
|
if self.region == Region.OVERSEAS:
|
||||||
|
gt_result = daily_reward.get("gt_result")
|
||||||
|
if gt_result is not None and gt_result["success"] != 0:
|
||||||
|
gt = gt_result.get("gt", "")
|
||||||
|
challenge = gt_result.get("challenge", "")
|
||||||
|
raise GeetestTriggered(gt, challenge)
|
||||||
|
|
||||||
|
return daily_reward
|
||||||
|
|
||||||
async def get_reward_info(
|
async def get_reward_info(
|
||||||
self,
|
self,
|
||||||
*,
|
*,
|
||||||
@ -217,7 +231,7 @@ class DailyRewardClient(BaseClient):
|
|||||||
Returns:
|
Returns:
|
||||||
If `reward` is True, a DailyReward object representing the claimed reward. Otherwise, None.
|
If `reward` is True, a DailyReward object representing the claimed reward. Otherwise, None.
|
||||||
"""
|
"""
|
||||||
daily_reward = await self.request_daily_reward(
|
await self.request_daily_reward(
|
||||||
"sign",
|
"sign",
|
||||||
method="POST",
|
method="POST",
|
||||||
game=game or self.game,
|
game=game or self.game,
|
||||||
@ -226,17 +240,6 @@ class DailyRewardClient(BaseClient):
|
|||||||
validate=validate,
|
validate=validate,
|
||||||
)
|
)
|
||||||
|
|
||||||
if self.region == Region.CHINESE and daily_reward.get("success", 0) == 1:
|
|
||||||
gt = daily_reward.get("gt", "")
|
|
||||||
challenge = daily_reward.get("challenge", "")
|
|
||||||
raise GeetestTriggered(gt, challenge)
|
|
||||||
if self.region == Region.OVERSEAS:
|
|
||||||
gt_result = daily_reward.get("gt_result")
|
|
||||||
if gt_result is not None and gt_result["success"] != 0:
|
|
||||||
gt = gt_result.get("gt", "")
|
|
||||||
challenge = gt_result.get("challenge", "")
|
|
||||||
raise GeetestTriggered(gt, challenge)
|
|
||||||
|
|
||||||
if not reward:
|
if not reward:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user