Skip to content

Commit

Permalink
Set default mission waiting time in autoPirate.py
Browse files Browse the repository at this point in the history
getCurrentMissionWaitingTime sometimes fails for some unknown reason so there is now a default waiting time of 10 mins in case it can not find the current mission waiting time.
  • Loading branch information
ikagod authored Sep 29, 2024
1 parent 2371f6c commit af1d8fa
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions ikabot/function/autoPirate.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,8 +390,11 @@ def convertCapturePoints(session, piracyCities, convertPerMission):


def getCurrentMissionWaitingTime(html):
match = re.search(r'ongoingMissionTimeRemaining\\":(\d+),', html)
assert (
match
), "Couldn't find remaining ongoing mission time, did you run a pirate mission manually?"
return int(match.group(1))
try:
match = re.search(r'ongoingMissionTimeRemaining\\":(\d+),', html)
assert (
match
), "Couldn't find remaining ongoing mission time, did you run a pirate mission manually?"
return int(match.group(1))
except: # In case we can not find current mission waiting time, just sleep for 10 mins (Not a perfect solution)
return 10 * 60

0 comments on commit af1d8fa

Please sign in to comment.