Fixes to mute command and modlog, closes #174
This commit is contained in:
parent
01543145bb
commit
393487946c
2 changed files with 10 additions and 4 deletions
|
@ -151,8 +151,8 @@ class MuteCog(ModcaseCog):
|
||||||
choices=[
|
choices=[
|
||||||
SlashCommandChoice(name="Minute(s)", value=1),
|
SlashCommandChoice(name="Minute(s)", value=1),
|
||||||
SlashCommandChoice(name="Hour(s)", value=60),
|
SlashCommandChoice(name="Hour(s)", value=60),
|
||||||
SlashCommandChoice(name="Day(s)", value=3600),
|
SlashCommandChoice(name="Day(s)", value=1440),
|
||||||
SlashCommandChoice(name="Week(s)", value=604800),
|
SlashCommandChoice(name="Week(s)", value=10080),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
@check(
|
@check(
|
||||||
|
@ -178,8 +178,8 @@ class MuteCog(ModcaseCog):
|
||||||
|
|
||||||
# Max 4 weeks (2419200 seconds) per API
|
# Max 4 weeks (2419200 seconds) per API
|
||||||
duration = time * scale
|
duration = time * scale
|
||||||
if duration > 2419200:
|
if duration > 40320:
|
||||||
await ctx.send("Mute must be less than 4 weeks (2419200 seconds)", ephemeral=True)
|
await ctx.send("Mute must be less than 4 weeks (40,320 minutes)", ephemeral=True)
|
||||||
return
|
return
|
||||||
|
|
||||||
until = datetime.now(tz=timezone.utc) + timedelta(minutes=duration)
|
until = datetime.now(tz=timezone.utc) + timedelta(minutes=duration)
|
||||||
|
|
|
@ -80,6 +80,9 @@ class ModcaseCog(Extension):
|
||||||
description=f"Admin action has been taken against you in {ctx.guild.name}",
|
description=f"Admin action has been taken against you in {ctx.guild.name}",
|
||||||
fields=fields,
|
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}"
|
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_author(name=ctx.guild.name, icon_url=ctx.guild.icon.url, url=guild_url)
|
||||||
embed.set_thumbnail(url=ctx.guild.icon.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
|
name=f"{user.username}#{user.discriminator}", icon_url=user.display_avatar.url
|
||||||
)
|
)
|
||||||
embed.set_footer(text=f"User ID: {user.id}")
|
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)
|
await channel.send(embeds=embed)
|
||||||
|
|
||||||
lookup_key = f"{user.id}|{ctx.guild.id}"
|
lookup_key = f"{user.id}|{ctx.guild.id}"
|
||||||
|
|
Loading…
Add table
Reference in a new issue