WIP: Refactor Aurora (3.0.0) #29
1 changed files with 8 additions and 4 deletions
|
@ -803,12 +803,14 @@ class Tempban(Ban):
|
||||||
parsed_time = parse_relativedelta(duration)
|
parsed_time = parse_relativedelta(duration)
|
||||||
if not parsed_time:
|
if not parsed_time:
|
||||||
await ctx.send(content=error("Please provide a valid duration!"), ephemeral=True)
|
await ctx.send(content=error("Please provide a valid duration!"), ephemeral=True)
|
||||||
|
return cls
|
||||||
try:
|
try:
|
||||||
parsed_time = timedelta_from_relativedelta(parsed_time)
|
parsed_time = timedelta_from_relativedelta(parsed_time)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
await ctx.send(content=error("Please provide a valid duration!"), ephemeral=True)
|
await ctx.send(content=error("Please provide a valid duration!"), ephemeral=True)
|
||||||
|
return cls
|
||||||
|
|
||||||
response_message = await ctx.send(content=f"{target.mention} has been {cls.verb} for {humanize_timedelta(parsed_time)}!\n{bold(text='Reason:')} {inline(text=reason)}")
|
response_message = await ctx.send(content=f"{target.mention} has been {cls.verb} for {humanize_timedelta(timedelta=parsed_time)}!\n{bold(text='Reason:')} {inline(text=reason)}")
|
||||||
|
|
||||||
if silent is False:
|
if silent is False:
|
||||||
try:
|
try:
|
||||||
|
@ -838,7 +840,7 @@ class Tempban(Ban):
|
||||||
duration=parsed_time,
|
duration=parsed_time,
|
||||||
reason=reason
|
reason=reason
|
||||||
)
|
)
|
||||||
await response_message.edit(content=f"{target.mention} has been {cls.verb} for {humanize_timedelta(parsed_time)}! (Case {inline(text=f'#{moderation.id}')})\n{bold(text='Reason:')} {inline(reason)}")
|
await response_message.edit(content=f"{target.mention} has been {cls.verb} for {humanize_timedelta(timedelta=parsed_time)}! (Case {inline(text=f'#{moderation.id}')})\n{bold(text='Reason:')} {inline(reason)}")
|
||||||
await log(ctx, moderation.id)
|
await log(ctx, moderation.id)
|
||||||
await send_evidenceformat(ctx, moderation.id)
|
await send_evidenceformat(ctx, moderation.id)
|
||||||
return cls
|
return cls
|
||||||
|
@ -1033,14 +1035,16 @@ class Slowmode(Type):
|
||||||
parsed_time = parse_relativedelta(argument=duration)
|
parsed_time = parse_relativedelta(argument=duration)
|
||||||
if not parsed_time:
|
if not parsed_time:
|
||||||
await ctx.send(content=error(text="Please provide a valid duration!"), ephemeral=True)
|
await ctx.send(content=error(text="Please provide a valid duration!"), ephemeral=True)
|
||||||
|
return cls
|
||||||
try:
|
try:
|
||||||
parsed_time = timedelta_from_relativedelta(relativedelta=parsed_time)
|
parsed_time = timedelta_from_relativedelta(relativedelta=parsed_time)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
await ctx.send(content=error(text="Please provide a valid duration!"), ephemeral=True)
|
await ctx.send(content=error(text="Please provide a valid duration!"), ephemeral=True)
|
||||||
|
return cls
|
||||||
|
|
||||||
if ceil(parsed_time.total_seconds()) > 21600:
|
if ceil(parsed_time.total_seconds()) > 21600:
|
||||||
await ctx.send(content=error(text="The slowmode duration cannot exceed 6 hours!"), ephemeral=True)
|
await ctx.send(content=error(text="The slowmode duration cannot exceed 6 hours!"), ephemeral=True)
|
||||||
return
|
return cls
|
||||||
|
|
||||||
if isinstance(target, TextChannel):
|
if isinstance(target, TextChannel):
|
||||||
await target.edit(slowmode_delay=ceil(parsed_time.total_seconds()))
|
await target.edit(slowmode_delay=ceil(parsed_time.total_seconds()))
|
||||||
|
@ -1055,7 +1059,7 @@ class Slowmode(Type):
|
||||||
duration=parsed_time,
|
duration=parsed_time,
|
||||||
reason=None
|
reason=None
|
||||||
)
|
)
|
||||||
await ctx.send(content=f"{ctx.author.mention} has {cls.verb} {target.mention} to {humanize_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=parsed_time)}!\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…
Reference in a new issue