From 7a6e289636c131bf724f82c8f00a008b275eb79c Mon Sep 17 00:00:00 2001 From: scragly <29337040+scragly@users.noreply.github.com> Date: Thu, 27 Dec 2018 04:53:47 +1000 Subject: Ping mod on infr notify failure in modlog. --- bot/cogs/moderation.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/bot/cogs/moderation.py b/bot/cogs/moderation.py index 0fc47c9df..24b60332f 100644 --- a/bot/cogs/moderation.py +++ b/bot/cogs/moderation.py @@ -100,6 +100,9 @@ class Moderation(Scheduler): else: await ctx.send(f"{action} ({reason}).") + if not notified: + await self.log_notify_failure(user, ctx.author, "warning") + @with_role(*MODERATION_ROLES) @command(name="kick") async def kick(self, ctx: Context, user: Member, *, reason: str = None): @@ -130,6 +133,9 @@ class Moderation(Scheduler): else: await ctx.send(f"{action} ({reason}).") + if not notified: + await self.log_notify_failure(user, ctx.author, "kick") + # Send a log message to the mod log await self.mod_log.send_log_message( icon_url=Icons.sign_out, @@ -175,6 +181,9 @@ class Moderation(Scheduler): else: await ctx.send(f"{action} ({reason}).") + if not notified: + await self.log_notify_failure(user, ctx.author, "ban") + # Send a log message to the mod log await self.mod_log.send_log_message( icon_url=Icons.user_ban, @@ -220,6 +229,9 @@ class Moderation(Scheduler): else: await ctx.send(f"{action} ({reason}).") + if not notified: + await self.log_notify_failure(user, ctx.author, "mute") + # Send a log message to the mod log await self.mod_log.send_log_message( icon_url=Icons.user_mute, @@ -274,6 +286,9 @@ class Moderation(Scheduler): else: await ctx.send(f"{action} ({reason}).") + if not notified: + await self.log_notify_failure(user, ctx.author, "mute") + # Send a log message to the mod log await self.mod_log.send_log_message( icon_url=Icons.user_mute, @@ -329,6 +344,9 @@ class Moderation(Scheduler): else: await ctx.send(f"{action} ({reason}).") + if not notified: + await self.log_notify_failure(user, ctx.author, "ban") + # Send a log message to the mod log await self.mod_log.send_log_message( icon_url=Icons.user_ban, @@ -619,6 +637,9 @@ class Moderation(Scheduler): dm_result = ":incoming_envelope: " if notified else "" await ctx.send(f"{dm_result}:ok_hand: Un-muted {user.mention}.") + if not notified: + await self.log_notify_failure(user, ctx.author, "unmute") + # Send a log message to the mod log await self.mod_log.send_log_message( icon_url=Icons.user_unmute, @@ -1144,6 +1165,15 @@ class Moderation(Scheduler): ) return False + async def log_notify_failure(self, target: str, actor: Member, infraction_type: str): + await self.mod_log.send_log_message( + icon_url=Icons.token_removed, + content=actor.mention, + colour=Colour(Colours.soft_red), + title="Notification Failed", + text=f"Direct message was unable to be sent.\nUser: {target.mention}\nType: {infraction_type}" + ) + # endregion async def __error(self, ctx, error): -- cgit v1.2.3