diff options
author | 2019-10-03 10:46:51 -0700 | |
---|---|---|
committer | 2019-10-03 10:46:51 -0700 | |
commit | 1eab21123e8d9a72c13a2ffa12f7f490b2de361d (patch) | |
tree | c822de7f9ba7143d0fa093255db35d4ba045b890 | |
parent | Merge remote-tracking branch 'origin/master' into moderation-cleanup (diff) |
Add note instead of failure to mod log during pardon when ban not found
-rw-r--r-- | bot/cogs/moderation/infractions.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/bot/cogs/moderation/infractions.py b/bot/cogs/moderation/infractions.py index 64644ee82..eece4b986 100644 --- a/bot/cogs/moderation/infractions.py +++ b/bot/cogs/moderation/infractions.py @@ -335,7 +335,7 @@ class Infractions(Scheduler, commands.Cog): await guild.unban(user, reason=reason) except discord.NotFound: log.info(f"Failed to unban user {user_id}: no active ban found on Discord") - log_text["Failure"] = "No active ban found on Discord." + log_text["Note"] = "No active ban found on Discord." else: raise ValueError( f"Attempted to deactivate an unsupported infraction #{_id} ({_type})!" @@ -486,7 +486,12 @@ class Infractions(Scheduler, commands.Cog): log.warning(f"Found more than one active {infr_type} infraction for user {user.id}") footer = f"Infraction IDs: {', '.join(str(infr['id']) for infr in response)}" - log_text["Note"] = f"Found multiple **active** {infr_type} infractions in the database." + + log_note = f"Found multiple **active** {infr_type} infractions in the database." + if "Note" in log_text: + log_text["Note"] = f" {log_note}" + else: + log_text["Note"] = log_note # deactivate_infraction() is not called again because: # 1. Discord cannot store multiple active bans or assign multiples of the same role |