diff --git a/jarvis/cogs/admin/modcase.py b/jarvis/cogs/admin/modcase.py index 1d2f702..d183789 100644 --- a/jarvis/cogs/admin/modcase.py +++ b/jarvis/cogs/admin/modcase.py @@ -119,7 +119,7 @@ class CaseCog(Cog): ) 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}**]", fields=fields, timestamp=mod_case.created_at, @@ -167,3 +167,32 @@ class CaseCog(Cog): pages = [await self.get_embed(c, ctx.guild) for c in cases] paginator = Paginator.create_from_embeds(self.bot, *pages, timeout=300) 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)