From 0a0bd10075ab82d132970b5176f5dd4dec90c359 Mon Sep 17 00:00:00 2001 From: cswimr Date: Tue, 18 Feb 2025 15:12:37 -0600 Subject: [PATCH] fix(aurora): fix slowmode erroring when no reason is provided --- aurora/models/moderation_types.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/aurora/models/moderation_types.py b/aurora/models/moderation_types.py index 3d8e613..e49a484 100644 --- a/aurora/models/moderation_types.py +++ b/aurora/models/moderation_types.py @@ -939,7 +939,12 @@ class Slowmode(Type): return cls() if isinstance(target, TextChannel): - await target.edit(slowmode_delay=ceil(timedelta_interval.total_seconds()), reason=f"Slowmode set by {ctx.author.id} for: {reason}") + if reason: + await target.edit(slowmode_delay=ceil(timedelta_interval.total_seconds()), reason=f"Slowmode set by {ctx.author.id} for: {reason}") + else: + await target.edit(slowmode_delay=ceil(timedelta_interval.total_seconds()), reason=f"Slowmode set by {ctx.author.id}") + reason = "No reason given." + assert ctx.guild moderation = await Moderation.log(bot=bot, guild_id=ctx.guild.id, moderator_id=ctx.author.id, moderation_type=cls(), target_type="channel", target_id=target.id, role_id=None, duration=None, reason=reason, metadata={"interval": interval}) await ctx.send(content=f"{ctx.author.mention} has {cls.verb} {target.mention} to {humanize_timedelta(timedelta=timedelta_interval)}!\n{bold(text='Reason:')} {inline(text=reason)}")