Fix unmute, past dates on mute
This commit is contained in:
parent
278f8b0790
commit
5e51a9a203
1 changed files with 7 additions and 1 deletions
|
@ -109,6 +109,7 @@ class MuteCog(ModcaseCog):
|
||||||
at_settings["PARSERS"] = [x for x in default_parsers if x != "relative-time"]
|
at_settings["PARSERS"] = [x for x in default_parsers if x != "relative-time"]
|
||||||
at_until = parse(until, settings=at_settings)
|
at_until = parse(until, settings=at_settings)
|
||||||
|
|
||||||
|
old_until = until
|
||||||
if rt_until:
|
if rt_until:
|
||||||
until = rt_until
|
until = rt_until
|
||||||
elif at_until:
|
elif at_until:
|
||||||
|
@ -119,6 +120,11 @@ class MuteCog(ModcaseCog):
|
||||||
f"`{until}` is not a parsable date, please try again", ephemeral=True
|
f"`{until}` is not a parsable date, please try again", ephemeral=True
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
if until < datetime.now(tz=timezone.utc):
|
||||||
|
await response.send(
|
||||||
|
f"`{old_until}` is in the past, which isn't allowed", ephemeral=True
|
||||||
|
)
|
||||||
|
return
|
||||||
embed = await self._apply_timeout(ctx, ctx.target, reason, until)
|
embed = await self._apply_timeout(ctx, ctx.target, reason, until)
|
||||||
await response.send(embed=embed)
|
await response.send(embed=embed)
|
||||||
|
|
||||||
|
@ -194,7 +200,7 @@ class MuteCog(ModcaseCog):
|
||||||
await ctx.send("User is not muted", ephemeral=True)
|
await ctx.send("User is not muted", ephemeral=True)
|
||||||
return
|
return
|
||||||
|
|
||||||
await user.timeout(communication_disabled_until=0)
|
await user.timeout(communication_disabled_until=datetime.now(tz=timezone.utc))
|
||||||
|
|
||||||
embed = build_embed(
|
embed = build_embed(
|
||||||
title="User Unmuted",
|
title="User Unmuted",
|
||||||
|
|
Loading…
Add table
Reference in a new issue