aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Den4200 <[email protected]>2020-07-06 00:52:41 +0000
committerGravatar Den4200 <[email protected]>2020-07-06 00:52:41 +0000
commit9804e84cdf5903c3aac3783a66b81e5865680c62 (patch)
treef7c4f6c8c10f0f4628a4e0043096c901233654ce
parentCreate a constant for the max slowmode delay (diff)
Remove monkeypatch and apply appropriate changes to _stringify_time_unit
-rw-r--r--bot/cogs/slowmode.py7
-rw-r--r--bot/utils/time.py4
2 files changed, 4 insertions, 7 deletions
diff --git a/bot/cogs/slowmode.py b/bot/cogs/slowmode.py
index 830273174..88f19b2f1 100644
--- a/bot/cogs/slowmode.py
+++ b/bot/cogs/slowmode.py
@@ -31,12 +31,7 @@ class Slowmode(Cog):
async def get_slowmode(self, ctx: Context, channel: TextChannel) -> None:
"""Get the slowmode delay for a given text channel."""
delay = relativedelta(seconds=channel.slowmode_delay)
-
- # Say "0 seconds" instead of "less than a second"
- if channel.slowmode_delay == 0:
- humanized_delay = '0 seconds'
- else:
- humanized_delay = time.humanize_delta(delay)
+ humanized_delay = time.humanize_delta(delay)
await ctx.send(f'The slowmode delay for {channel.mention} is {humanized_delay}.')
diff --git a/bot/utils/time.py b/bot/utils/time.py
index 77060143c..47e49904b 100644
--- a/bot/utils/time.py
+++ b/bot/utils/time.py
@@ -20,7 +20,9 @@ def _stringify_time_unit(value: int, unit: str) -> str:
>>> _stringify_time_unit(0, "minutes")
"less than a minute"
"""
- if value == 1:
+ if unit == "seconds" and value == 0:
+ return "0 seconds"
+ elif value == 1:
return f"{value} {unit[:-1]}"
elif value == 0:
return f"less than a {unit[:-1]}"