diff options
| author | 2019-10-09 22:47:35 -0700 | |
|---|---|---|
| committer | 2019-10-09 23:19:50 -0700 | |
| commit | e120013c4cc04d8063e8d4edc00dacbf4369debb (patch) | |
| tree | dfe5e0a55f6ddbaafccdc1b8f3d3f890f9368643 | |
| parent | Fix #346: display infraction count after giving an infraction (diff) | |
Resolve #357: show ban reason and bb watch status in unban mod log
Diffstat (limited to '')
| -rw-r--r-- | bot/cogs/moderation/infractions.py | 19 | 
1 files changed, 18 insertions, 1 deletions
| diff --git a/bot/cogs/moderation/infractions.py b/bot/cogs/moderation/infractions.py index 105bff0c7..6d20e047a 100644 --- a/bot/cogs/moderation/infractions.py +++ b/bot/cogs/moderation/infractions.py @@ -311,7 +311,8 @@ class Infractions(Scheduler, commands.Cog):          log_content = None          log_text = {              "Member": str(user_id), -            "Actor": str(self.bot.user) +            "Actor": str(self.bot.user), +            "Reason": infraction["reason"]          }          try: @@ -356,6 +357,22 @@ class Infractions(Scheduler, commands.Cog):              log_text["Failure"] = f"HTTPException with code {e.code}."              log_content = mod_role.mention +        # Check if the user is currently being watched by Big Brother. +        try: +            active_watch = await self.bot.api_client.get( +                "bot/infractions", +                params={ +                    "active": "true", +                    "type": "watch", +                    "user__id": user_id +                } +            ) + +            log_text["Watching"] = "Yes" if active_watch else "No" +        except ResponseCodeError: +            log.exception(f"Failed to fetch watch status for user {user_id}") +            log_text["Watching"] = "Unknown - failed to fetch watch status." +          try:              # Mark infraction as inactive in the database.              await self.bot.api_client.patch( | 
