Add case show and case close
This commit is contained in:
parent
1813c1e4b0
commit
d89e3ea21a
1 changed files with 30 additions and 1 deletions
|
@ -119,7 +119,7 @@ class CaseCog(Cog):
|
||||||
)
|
)
|
||||||
|
|
||||||
embed = build_embed(
|
embed = build_embed(
|
||||||
title=f"Moderation Case [{mod_case.nanoid}]",
|
title=f"Moderation Case [`{mod_case.nanoid}`]",
|
||||||
description=f"{status} case against {user_text} [**opened by {admin_text}**]",
|
description=f"{status} case against {user_text} [**opened by {admin_text}**]",
|
||||||
fields=fields,
|
fields=fields,
|
||||||
timestamp=mod_case.created_at,
|
timestamp=mod_case.created_at,
|
||||||
|
@ -167,3 +167,32 @@ class CaseCog(Cog):
|
||||||
pages = [await self.get_embed(c, ctx.guild) for c in cases]
|
pages = [await self.get_embed(c, ctx.guild) for c in cases]
|
||||||
paginator = Paginator.create_from_embeds(self.bot, *pages, timeout=300)
|
paginator = Paginator.create_from_embeds(self.bot, *pages, timeout=300)
|
||||||
await paginator.send(ctx)
|
await paginator.send(ctx)
|
||||||
|
|
||||||
|
case = SlashCommand(name="case", description="Manage a moderation case")
|
||||||
|
|
||||||
|
@case.subcommand(sub_cmd_name="show", sub_cmd_description="Show a specific case")
|
||||||
|
@slash_option(name="cid", description="Case ID", opt_type=OptionTypes.STRING, required=True)
|
||||||
|
@check(admin_or_permissions(Permissions.BAN_MEMBERS))
|
||||||
|
async def _case_show(self, ctx: InteractionContext, cid: str) -> None:
|
||||||
|
case = await Modlog.find_one(q(guild=ctx.guild.id, nanoid=cid))
|
||||||
|
if not case:
|
||||||
|
await ctx.send(f"Could not find case with ID {cid}", ephemeral=True)
|
||||||
|
return
|
||||||
|
|
||||||
|
embed = await self.get_embed(case, ctx.guild)
|
||||||
|
await ctx.send(embed=embed)
|
||||||
|
|
||||||
|
@case.subcommand(sub_cmd_name="close", sub_cmd_description="Show a specific case")
|
||||||
|
@slash_option(name="cid", description="Case ID", opt_type=OptionTypes.STRING, required=True)
|
||||||
|
@check(admin_or_permissions(Permissions.BAN_MEMBERS))
|
||||||
|
async def _case_close(self, ctx: InteractionContext, cid: str) -> None:
|
||||||
|
case = await Modlog.find_one(q(guild=ctx.guild.id, nanoid=cid))
|
||||||
|
if not case:
|
||||||
|
await ctx.send(f"Could not find case with ID {cid}", ephemeral=True)
|
||||||
|
return
|
||||||
|
|
||||||
|
case.open = False
|
||||||
|
await case.commit()
|
||||||
|
|
||||||
|
embed = await self.get_embed(case, ctx.guild)
|
||||||
|
await ctx.send(embed=embed)
|
||||||
|
|
Loading…
Add table
Reference in a new issue