Skip to content

Commit

Permalink
Adventure Time Adjustment
Browse files Browse the repository at this point in the history
  • Loading branch information
dkoz committed Oct 3, 2024
1 parent 583560c commit a472f67
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions cogs/palgame/adventure.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ def __init__(self, bot):
self.bot = bot
self.cooldowns = {}
self.pals = self.load_pals()
self.COOLDOWN_PERIOD = 5 * 60

def load_pals(self):
with open(os.path.join('gamedata', 'game.json'), 'r') as file:
Expand All @@ -26,9 +27,8 @@ def load_pals(self):
def check_cooldown(self, user_id):
if user_id in self.cooldowns:
time_elapsed = time.time() - self.cooldowns[user_id]
cooldown_period = 6 * 60 * 60
if time_elapsed < cooldown_period:
return cooldown_period - time_elapsed
if time_elapsed < self.COOLDOWN_PERIOD:
return self.COOLDOWN_PERIOD - time_elapsed
return None

def update_cooldown(self, user_id):
Expand Down Expand Up @@ -66,10 +66,10 @@ async def adventure(

remaining_time = self.check_cooldown(user_id)
if remaining_time is not None:
remaining_hours = int(remaining_time // 3600)
remaining_minutes = int((remaining_time % 3600) // 60)
remaining_minutes = int(remaining_time // 60)
remaining_seconds = int(remaining_time % 60)
await interaction.response.send_message(
f"Your Pal is still recovering from their last adventure! Please wait {remaining_hours} hours and {remaining_minutes} minutes.",
f"Your Pal is still recovering from their last adventure! Please wait {remaining_minutes} minutes and {remaining_seconds} seconds.",
ephemeral=True
)
return
Expand Down

0 comments on commit a472f67

Please sign in to comment.