diff options
author | 2022-01-01 17:02:59 +0000 | |
---|---|---|
committer | 2022-01-01 17:19:40 +0000 | |
commit | d30776a17f058fb526d7fb93fbd3d754d35f2bd5 (patch) | |
tree | 111f982bf33b3f4a043af3a1cd27291281f988a8 | |
parent | Add text indicating when user fetched by message (#2013) (diff) |
Infraction mod-log improvements
- Add infraction id to infraction edit modlog
- Add missing colon in "infraction applied" message
- Utilise defined infraction id variable instead of indexing dict again
-rw-r--r-- | bot/exts/moderation/infraction/_scheduler.py | 4 | ||||
-rw-r--r-- | bot/exts/moderation/infraction/management.py | 5 |
2 files changed, 5 insertions, 4 deletions
diff --git a/bot/exts/moderation/infraction/_scheduler.py b/bot/exts/moderation/infraction/_scheduler.py index 6f379a9a0..57aa2d9b6 100644 --- a/bot/exts/moderation/infraction/_scheduler.py +++ b/bot/exts/moderation/infraction/_scheduler.py @@ -223,7 +223,7 @@ class InfractionScheduler: failed = True if failed: - log.trace(f"Deleted infraction {infraction['id']} from database because applying infraction failed.") + log.trace(f"Trying to delete infraction {id_} from database because applying infraction failed.") try: await self.bot.api_client.delete(f"bot/infractions/{id_}") except ResponseCodeError as e: @@ -265,7 +265,7 @@ class InfractionScheduler: {additional_info} """), content=log_content, - footer=f"ID {infraction['id']}" + footer=f"ID: {id_}" ) log.info(f"Applied {purge}{infr_type} infraction #{id_} to {user}.") diff --git a/bot/exts/moderation/infraction/management.py b/bot/exts/moderation/infraction/management.py index b77c20434..9649ff852 100644 --- a/bot/exts/moderation/infraction/management.py +++ b/bot/exts/moderation/infraction/management.py @@ -176,7 +176,7 @@ class ModManagement(commands.Cog): if 'expires_at' in request_data: # A scheduled task should only exist if the old infraction wasn't permanent if infraction['expires_at']: - self.infractions_cog.scheduler.cancel(new_infraction['id']) + self.infractions_cog.scheduler.cancel(infraction_id) # If the infraction was not marked as permanent, schedule a new expiration task if request_data['expires_at']: @@ -210,7 +210,8 @@ class ModManagement(commands.Cog): Member: {user_text} Actor: <@{new_infraction['actor']}> Edited by: {ctx.message.author.mention}{log_text} - """) + """), + footer=f"ID: {infraction_id}" ) # endregion |