diff options
| author | 2019-01-06 17:22:20 +0100 | |
|---|---|---|
| committer | 2019-01-06 17:22:20 +0100 | |
| commit | 336be0df936513707941566564f6d5e22670a843 (patch) | |
| tree | 20303bac89a8f8cb1c560087877b15af61f3c2c0 | |
| parent | Move by-user infraction search to Django API backend. (diff) | |
Move by-reason infraction search to Django API backend.
| -rw-r--r-- | bot/cogs/moderation.py | 16 | 
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 | 
