fix(aurora): fix slowmode erroring when no reason is provided
Some checks failed
Actions / Build Documentation (MkDocs) (pull_request) Failing after 0s
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 44s

This commit is contained in:
cswimr 2025-02-18 15:12:37 -06:00
parent ab29c8f6ad
commit 0a0bd10075
Signed by: cswimr
GPG key ID: 0EC431A8DA8F8087

View file

@ -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)}")