From 933a154ccbb83c4ee5ad1fa87e1bea9d8c012f27 Mon Sep 17 00:00:00 2001 From: Den4200 Date: Wed, 1 Jul 2020 17:14:46 +0000 Subject: Catch TypeError when the slowmode delay is 0 seconds --- bot/cogs/slowmode.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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) -- cgit v1.2.3