This commit is contained in:
parent
4cbf552204
commit
21c9e28452
1 changed files with 5 additions and 6 deletions
|
@ -184,14 +184,14 @@ class Moderation(commands.Cog):
|
||||||
cursor.execute(f"SELECT moderation_id FROM `moderation_{guild_id}` ORDER BY moderation_id DESC LIMIT 1")
|
cursor.execute(f"SELECT moderation_id FROM `moderation_{guild_id}` ORDER BY moderation_id DESC LIMIT 1")
|
||||||
return cursor.fetchone()[0] + 1
|
return cursor.fetchone()[0] + 1
|
||||||
|
|
||||||
async def embed_factory(self, type: str, guild: discord.Guild, reason: str, moderation_type: str, response: discord.InteractionMessage, duration: timedelta = None):
|
async def embed_factory(self, embed_type: str, guild: discord.Guild, reason: str, moderation_type: str, response: discord.InteractionMessage, duration: timedelta = None):
|
||||||
"""This method creates an embed from set parameters, meant for either moderation logging or contacting the moderated user.
|
"""This method creates an embed from set parameters, meant for either moderation logging or contacting the moderated user.
|
||||||
|
|
||||||
Valid arguments for 'type':
|
Valid arguments for 'embed_type':
|
||||||
- 'message'
|
- 'message'
|
||||||
- 'log' - WIP
|
- 'log' - WIP
|
||||||
- 'case' - WIP"""
|
- 'case' - WIP"""
|
||||||
if type == 'message':
|
if embed_type == 'message':
|
||||||
if moderation_type in ["kicked", "banned", "unbanned"]:
|
if moderation_type in ["kicked", "banned", "unbanned"]:
|
||||||
guild_name = guild.name
|
guild_name = guild.name
|
||||||
else:
|
else:
|
||||||
|
@ -205,8 +205,7 @@ class Moderation(commands.Cog):
|
||||||
embed.set_author(name=guild.name, icon_url=guild.icon.url)
|
embed.set_author(name=guild.name, icon_url=guild.icon.url)
|
||||||
embed.set_footer(text=f"Case #{await self.get_next_case_number(guild.id)}", icon_url="https://cdn.discordapp.com/attachments/1070822161389994054/1159469476773904414/arrow-right-circle-icon-512x512-2p1e2aaw.png?ex=65312319&is=651eae19&hm=3cebdd28e805c13a79ec48ef87c32ca532ffa6b9ede2e48d0cf8e5e81f3a6818&")
|
embed.set_footer(text=f"Case #{await self.get_next_case_number(guild.id)}", icon_url="https://cdn.discordapp.com/attachments/1070822161389994054/1159469476773904414/arrow-right-circle-icon-512x512-2p1e2aaw.png?ex=65312319&is=651eae19&hm=3cebdd28e805c13a79ec48ef87c32ca532ffa6b9ede2e48d0cf8e5e81f3a6818&")
|
||||||
return embed
|
return embed
|
||||||
else:
|
raise(TypeError("'type' argument is invalid!"))
|
||||||
raise(TypeError("'type' argument is invalid!"))
|
|
||||||
|
|
||||||
@app_commands.command(name="warn")
|
@app_commands.command(name="warn")
|
||||||
async def warn(self, interaction: discord.Interaction, target: discord.Member, reason: str):
|
async def warn(self, interaction: discord.Interaction, target: discord.Member, reason: str):
|
||||||
|
@ -228,7 +227,7 @@ class Moderation(commands.Cog):
|
||||||
try:
|
try:
|
||||||
parsed_time = parse(sval=duration, as_timedelta=True, raise_exception=True)
|
parsed_time = parse(sval=duration, as_timedelta=True, raise_exception=True)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
await interaction.response.send_message(f"Please provide a valid duration!", ephemeral=True)
|
await interaction.response.send_message("Please provide a valid duration!", ephemeral=True)
|
||||||
return
|
return
|
||||||
if parsed_time.total_seconds() / 1000 > 2419200000:
|
if parsed_time.total_seconds() / 1000 > 2419200000:
|
||||||
await interaction.response.send_message("Please provide a duration that is less than 28 days.")
|
await interaction.response.send_message("Please provide a duration that is less than 28 days.")
|
||||||
|
|
Loading…
Reference in a new issue