fix(aurora): use timedelta still
Some checks failed
Actions / Build Documentation (MkDocs) (pull_request) Failing after 21s
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 43s

This commit is contained in:
cswimr 2025-02-18 15:08:52 -06:00
parent 44108774e1
commit ab29c8f6ad
Signed by: cswimr
GPG key ID: 0EC431A8DA8F8087

View file

@ -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()