aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Den4200 <[email protected]>2020-07-01 17:14:46 +0000
committerGravatar Den4200 <[email protected]>2020-07-01 17:14:46 +0000
commit933a154ccbb83c4ee5ad1fa87e1bea9d8c012f27 (patch)
treec3eb8a01b3e74bc353f3885275f7ca3048ec2783
parentForgot an await in the Duration converter (diff)
Catch TypeError when the slowmode delay is 0 seconds
-rw-r--r--bot/cogs/slowmode.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/bot/cogs/slowmode.py b/bot/cogs/slowmode.py
index 898f4bf52..b8b3bb65c 100644
--- a/bot/cogs/slowmode.py
+++ b/bot/cogs/slowmode.py
@@ -29,7 +29,15 @@ 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)
- await ctx.send(f'The slowmode delay for {channel.mention} is {time.humanize_delta(delay, precision=3)}.')
+
+ try:
+ humanized_delay = time.humanize_delta(delay, precision=3)
+
+ except TypeError:
+ humanized_delay = '0 seconds'
+
+ finally:
+ await ctx.send(f'The slowmode delay for {channel.mention} is {humanized_delay}.')
@slowmode_group.command(name='set', aliases=['s'])
@with_role(*MODERATION_ROLES)