Skip to content

Commit

Permalink
fix: Challenge captcha alert
Browse files Browse the repository at this point in the history
  • Loading branch information
dvgamerr committed Jun 9, 2023
1 parent f1a0bfc commit c4e4a0d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 16 deletions.
9 changes: 5 additions & 4 deletions act/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,11 @@ func (e *DailyHoyolab) DailySignIn(hoyo *Hoyolab) (bool, error) {
log.Printf("%s::%+v\n", e.Label, res)
}

risk := res["gt_result"].(map[string]any)
if risk["risk_code"].(float64) > 0 {
return true, nil
if res["gt_result"] != nil {
risk := res["gt_result"].(map[string]any)
if risk["risk_code"].(float64) > 0 {
return true, nil
}
}

return false, nil
}
22 changes: 10 additions & 12 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,15 +133,6 @@ func main() {
log.Printf("%s::DailySignIn : %v", act.Label, err)
continue
}
if isRisk {
if hoyo.Notify.Mini {
getAward = append(getAward, fmt.Sprintf("Challenge captcha (%s)", act.Label))
} else {
getAward = append(getAward, fmt.Sprintf("*[%s]* at day %d challenge captcha", act.Label, resInfo.TotalSignDay+1))
}
continue
}

if getDaySign < 0 {
getDaySign = resInfo.TotalSignDay + 1
}
Expand All @@ -150,11 +141,18 @@ func main() {
log.Printf("%s::GetMonthAward : Today's received %s x%d", act.Label, award.Name, award.Count)

if hoyo.Notify.Mini {
getAward = append(getAward, fmt.Sprintf("*%s x%d* (%s)", award.Name, award.Count, act.Label))
if isRisk {
getAward = append(getAward, fmt.Sprintf("Challenge captcha (%s)", act.Label))
} else {
getAward = append(getAward, fmt.Sprintf("*%s x%d* (%s)", award.Name, award.Count, act.Label))
}
} else {
getAward = append(getAward, fmt.Sprintf("*[%s]* at day %d received %s x%d", act.Label, resInfo.TotalSignDay+1, award.Name, award.Count))
if isRisk {
getAward = append(getAward, fmt.Sprintf("*[%s]* at day %d challenge captcha", act.Label, resInfo.TotalSignDay+1))
} else {
getAward = append(getAward, fmt.Sprintf("*[%s]* at day %d received %s x%d", act.Label, resInfo.TotalSignDay+1, award.Name, award.Count))
}
}

}
if len(getAward) > 0 {
if len(hoyo.Browser) > 1 {
Expand Down

0 comments on commit c4e4a0d

Please sign in to comment.