Skip to content

Commit

Permalink
Fix background task crash
Browse files Browse the repository at this point in the history
  • Loading branch information
Baviaan committed Apr 13, 2020
1 parent 7acac32 commit 0ad8416
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion source/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
launch_on_boot = False

# print version number.
version = "v3.3.0"
version = "v3.3.2"
print("Running " + version)

# Load config file.
Expand Down
5 changes: 3 additions & 2 deletions source/raid_cog.py
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,8 @@ async def background_task(self):
raids = self.raids
save_time = 36 # Save to file every three hours.
expiry_time = datetime.timedelta(seconds=7200) # Delete raids after 2 hours.
notify_time = datetime.timedelta(seconds=300) # Notify raiders 5 minutes before.
notify_seconds = 300 # Notify raiders 5 minutes before.
notify_time = datetime.timedelta(seconds=notify_seconds)
self.counter = self.counter + 1
current_time = datetime.datetime.utcnow() # Raid time is stored in UTC.
# Copy the list to iterate over.
Expand Down Expand Up @@ -686,7 +687,7 @@ async def background_task(self):
raid_start_msg = raid_start_msg + "<@{0}> ".format(player.id)
raid_start_msg = raid_start_msg + _(
"will you answer the call? We are forming for the raid now.")
await channel.send(raid_start_msg, delete_after=notify_time * 2)
await channel.send(raid_start_msg, delete_after=notify_seconds * 2)
if self.counter >= save_time:
self.save() # Save raids to file.
self.counter = 0 # Reset counter to 0.
Expand Down

0 comments on commit 0ad8416

Please sign in to comment.