Skip to content

Commit

Permalink
more restrictive prettytimedelta
Browse files Browse the repository at this point in the history
  • Loading branch information
DigiDuncan committed Dec 2, 2023
1 parent 3168a42 commit 52fad63
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
8 changes: 2 additions & 6 deletions sizebot/cogs/help.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,17 +356,13 @@ async def ping(self, ctx, subcommand: str = ""):
await waitMsg.edit(content = response)

@commands.command(
usage = [""],
usage = ["[type]"],
category = "help",
hidden = True
)
@commands.cooldown(1, 5, commands.BucketType.user)
async def pong(self, ctx, subcommand: str = ""):
"""Pong!
Check SizeBot's current latency.
Check the bot's latency with `&ping`, or check the Discord API's latency with `&ping discord`."""
"""Ping!"""
waitMsg = await ctx.send(emojis.loading)

if subcommand.lower() in ["heartbeat", "discord"]:
Expand Down
8 changes: 8 additions & 0 deletions sizebot/lib/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,14 @@ def prettyTimeDelta(totalSeconds, millisecondAccuracy = False, roundeventually =
s += f"{seconds:,d}.{milliseconds:03d} second{'' if seconds == 1 and milliseconds == 0 else 's'}"
else:
s += f"{seconds:,d} second{'s' if seconds != 1 else ''}"
elif inputms >= MILLISECONDS_PER_YEAR * 1_000_000:
if inputms >= MILLISECONDS_PER_YEAR:
s += f"{years:,d} year{'s' if years != 1 else ''}"
elif inputms >= MILLISECONDS_PER_YEAR * 1000:
if inputms >= MILLISECONDS_PER_YEAR:
s += f"{years:,d} year{'s' if years != 1 else ''}, "
if inputms >= MILLISECONDS_PER_DAY:
s += f"{days:,d} day{'s' if days != 1 else ''}"
elif inputms >= MILLISECONDS_PER_YEAR:
if inputms >= MILLISECONDS_PER_YEAR:
s += f"{years:,d} year{'s' if years != 1 else ''}, "
Expand Down

0 comments on commit 52fad63

Please sign in to comment.