aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bot/cogs/moderation.py16
1 files changed, 3 insertions, 13 deletions
diff --git a/bot/cogs/moderation.py b/bot/cogs/moderation.py
index 45f35cbe4..1ea19d2df 100644
--- a/bot/cogs/moderation.py
+++ b/bot/cogs/moderation.py
@@ -944,23 +944,13 @@ class Moderation(Scheduler):
Search for infractions by their reason. Use Re2 for matching.
"""
- try:
- response = await self.bot.http_session.get(
- URLs.site_infractions,
- params={"search": reason, "hidden": "True"},
- headers=self.headers
- )
- infraction_list = await response.json()
- except ClientError:
- log.exception(f"Failed to fetch infractions matching reason `{reason}`.")
- await ctx.send(":x: An error occurred while fetching infractions.")
- return
-
+ infraction_list = await self.bot.api_client.get(
+ 'bot/infractions', params={'search': reason}
+ )
embed = Embed(
title=f"Infractions matching `{reason}` ({len(infraction_list)} total)",
colour=Colour.orange()
)
-
await self.send_infraction_list(ctx, embed, infraction_list)
# endregion