fix(aurora): fix slowmode erroring when no reason is provided
This commit is contained in:
parent
ab29c8f6ad
commit
0a0bd10075
1 changed files with 6 additions and 1 deletions
|
@ -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)}")
|
||||
|
|
Loading…
Add table
Reference in a new issue