aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bot/exts/moderation/infraction/management.py25
1 files changed, 21 insertions, 4 deletions
diff --git a/bot/exts/moderation/infraction/management.py b/bot/exts/moderation/infraction/management.py
index 7f27896d7..223a124d8 100644
--- a/bot/exts/moderation/infraction/management.py
+++ b/bot/exts/moderation/infraction/management.py
@@ -11,6 +11,7 @@ from discord.ext.commands import Context
from discord.utils import escape_markdown
from bot import constants
+from bot.api import ResponseCodeError
from bot.bot import Bot
from bot.converters import Expiry, Infraction, MemberOrUser, Snowflake, UnambiguousUser, allowed_strings
from bot.exts.moderation.infraction.infractions import Infractions
@@ -44,9 +45,25 @@ class ModManagement(commands.Cog):
# region: Edit infraction commands
@commands.group(name='infraction', aliases=('infr', 'infractions', 'inf', 'i'), invoke_without_command=True)
- async def infraction_group(self, ctx: Context) -> None:
- """Infraction manipulation commands."""
- await ctx.send_help(ctx.command)
+ async def infraction_group(self, ctx: Context, infr_id: int = None) -> None:
+ """Infraction manipulation commands. If `infr_id` is passed then this command fetches that infraction."""
+ if infr_id is None:
+ await ctx.send_help(ctx.command)
+ return
+
+ try:
+ infraction_list = [await self.bot.api_client.get(f"bot/infractions/{infr_id}/expanded")]
+ except ResponseCodeError as e:
+ if e.status == 404:
+ await ctx.send(f":x: No infraction with ID `{infr_id}` could be found.")
+ return
+ raise e
+
+ embed = discord.Embed(
+ title=f"Infraction #{infr_id}",
+ colour=discord.Colour.orange()
+ )
+ await self.send_infraction_list(ctx, embed, infraction_list)
@infraction_group.command(name="append", aliases=("amend", "add", "a"))
async def infraction_append(
@@ -210,7 +227,7 @@ class ModManagement(commands.Cog):
else:
await self.search_user(ctx, query)
- @infraction_search_group.command(name="user", aliases=("member", "id"))
+ @infraction_search_group.command(name="user", aliases=("member", "userid"))
async def search_user(self, ctx: Context, user: t.Union[MemberOrUser, discord.Object]) -> None:
"""Search for infractions by member."""
infraction_list = await self.bot.api_client.get(