Fixes to mute command and modlog, closes #174

This commit is contained in:
Zeva Rose 2022-08-21 21:33:14 -06:00
parent 01543145bb
commit 393487946c
2 changed files with 10 additions and 4 deletions

View file

@ -151,8 +151,8 @@ class MuteCog(ModcaseCog):
choices=[
SlashCommandChoice(name="Minute(s)", value=1),
SlashCommandChoice(name="Hour(s)", value=60),
SlashCommandChoice(name="Day(s)", value=3600),
SlashCommandChoice(name="Week(s)", value=604800),
SlashCommandChoice(name="Day(s)", value=1440),
SlashCommandChoice(name="Week(s)", value=10080),
],
)
@check(
@ -178,8 +178,8 @@ class MuteCog(ModcaseCog):
# Max 4 weeks (2419200 seconds) per API
duration = time * scale
if duration > 2419200:
await ctx.send("Mute must be less than 4 weeks (2419200 seconds)", ephemeral=True)
if duration > 40320:
await ctx.send("Mute must be less than 4 weeks (40,320 minutes)", ephemeral=True)
return
until = datetime.now(tz=timezone.utc) + timedelta(minutes=duration)

View file

@ -80,6 +80,9 @@ class ModcaseCog(Extension):
description=f"Admin action has been taken against you in {ctx.guild.name}",
fields=fields,
)
if name == "Mute":
mts = int(user.communication_disabled_until.timestamp())
embed.add_field(name="Muted Until", value=f"<t:{mts}:F> (<t:{mts}:R>)")
guild_url = f"https://discord.com/channels/{ctx.guild.id}"
embed.set_author(name=ctx.guild.name, icon_url=ctx.guild.icon.url, url=guild_url)
embed.set_thumbnail(url=ctx.guild.icon.url)
@ -117,6 +120,9 @@ class ModcaseCog(Extension):
name=f"{user.username}#{user.discriminator}", icon_url=user.display_avatar.url
)
embed.set_footer(text=f"User ID: {user.id}")
if name == "Mute":
mts = int(user.communication_disabled_until.timestamp())
embed.add_field(name="Muted Until", value=f"<t:{mts}:F> (<t:{mts}:R>)")
await channel.send(embeds=embed)
lookup_key = f"{user.id}|{ctx.guild.id}"