Skip to content

Commit

Permalink
make cooldown human readable
Browse files Browse the repository at this point in the history
  • Loading branch information
Selyss committed Dec 9, 2023
1 parent 222f49a commit b565ad0
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions cogs/inquiry.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from datetime import datetime
from datetime import datetime, timedelta
import json
from nextcord import slash_command
from nextcord.ext.commands import Bot, Cog
Expand Down Expand Up @@ -34,7 +34,9 @@ class TicketView(nextcord.ui.View):
def __init__(self) -> None:
super().__init__(timeout=None)
self.cooldown = commands.CooldownMapping.from_cooldown(
1, 60 * 1440, commands.BucketType.member # 1 request per day
1,
60 * 1440,
commands.BucketType.member, # 1 request per day
)

@nextcord.ui.button(
Expand All @@ -48,7 +50,7 @@ async def open_inquiry(self, btn: nextcord.ui.Button, inter: nextcord.Interactio
retry = bucket.update_rate_limit()
if retry:
return await inter.response.send_message(
f"Slow down! Try again in {round(retry, 1)} seconds.", ephemeral=True
f"Slow down! Try again in {int(retry // 3600)}h.", ephemeral=True
)
await inter.response.send_modal(QuestionForm())

Expand All @@ -63,7 +65,7 @@ async def advertisement(self, btn: nextcord.ui.Button, inter: nextcord.Interacti
retry = bucket.update_rate_limit()
if retry:
return await inter.response.send_message(
f"Slow down! Try again in {round(retry, 1)} seconds.", ephemeral=True
f"Slow down! Try again in {int(retry // 3600)}h.", ephemeral=True
)
await inter.response.send_modal(AdForm())

Expand Down

0 comments on commit b565ad0

Please sign in to comment.