fix(aurora): use timedelta still
This commit is contained in:
parent
44108774e1
commit
ab29c8f6ad
1 changed files with 4 additions and 3 deletions
|
@ -933,15 +933,16 @@ class Slowmode(Type):
|
||||||
async def handler(cls, ctx: commands.Context, target: Messageable, silent: bool, duration: str | None, reason: str, interval: int) -> "Slowmode": # pylint: disable=unused-argument
|
async def handler(cls, ctx: commands.Context, target: Messageable, silent: bool, duration: str | None, reason: str, interval: int) -> "Slowmode": # pylint: disable=unused-argument
|
||||||
"""Set the slowmode in a channel."""
|
"""Set the slowmode in a channel."""
|
||||||
bot = ctx.bot
|
bot = ctx.bot
|
||||||
if ceil(interval) > 21600:
|
timedelta_interval = timedelta(seconds=interval)
|
||||||
|
if ceil(timedelta_interval.total_seconds()) > 21600:
|
||||||
await ctx.send(content=error(text="The slowmode interval cannot exceed 6 hours!"), ephemeral=True)
|
await ctx.send(content=error(text="The slowmode interval cannot exceed 6 hours!"), ephemeral=True)
|
||||||
return cls()
|
return cls()
|
||||||
|
|
||||||
if isinstance(target, TextChannel):
|
if isinstance(target, TextChannel):
|
||||||
await target.edit(slowmode_delay=ceil(interval))
|
await target.edit(slowmode_delay=ceil(timedelta_interval.total_seconds()), reason=f"Slowmode set by {ctx.author.id} for: {reason}")
|
||||||
assert ctx.guild
|
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})
|
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=parsed_time)}!\n{bold(text='Reason:')} {inline(text=reason)}")
|
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)}")
|
||||||
await log(ctx=ctx, moderation_id=moderation.id)
|
await log(ctx=ctx, moderation_id=moderation.id)
|
||||||
return cls()
|
return cls()
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue