diff options
| author | 2018-12-27 04:53:47 +1000 | |
|---|---|---|
| committer | 2018-12-27 04:53:47 +1000 | |
| commit | 7a6e289636c131bf724f82c8f00a008b275eb79c (patch) | |
| tree | ecb175c34f426530c029d30bbabc5c3ee042c34d | |
| parent | Add content kwarg to modlog messages. (diff) | |
Ping mod on infr notify failure in modlog.
| -rw-r--r-- | bot/cogs/moderation.py | 30 | 
1 files changed, 30 insertions, 0 deletions
| 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): | 
