From a595baa2addd840770d730d92ca3f865ea30252d Mon Sep 17 00:00:00 2001 From: Ave Ozkal Date: Tue, 17 Sep 2019 13:26:41 +0300 Subject: [PATCH] mod: Improve hedgeproofing by also mod blocking actions on bot --- cogs/mod.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/cogs/mod.py b/cogs/mod.py index 183a99a..6c2ec7b 100644 --- a/cogs/mod.py +++ b/cogs/mod.py @@ -40,6 +40,9 @@ class Mod(Cog): # Hedge-proofing the code if target == ctx.author: return await ctx.send("You can't do mod actions on yourself.") + elif target == self.bot.user: + return await ctx.send(f"I'm sorry {ctx.author.mention}, " + "I'm afraid I can't do that.") elif self.check_if_target_is_staff(target): return await ctx.send("I can't mute this user as " "they're a member of staff.") @@ -106,6 +109,9 @@ class Mod(Cog): # Hedge-proofing the code if target == ctx.author: return await ctx.send("You can't do mod actions on yourself.") + elif target == self.bot.user: + return await ctx.send(f"I'm sorry {ctx.author.mention}, " + "I'm afraid I can't do that.") elif self.check_if_target_is_staff(target): return await ctx.send("I can't kick this user as " "they're a member of staff.") @@ -151,6 +157,9 @@ class Mod(Cog): # Hedge-proofing the code if target == ctx.author: return await ctx.send("hedgeberg#7337 is now b&. 👍") + elif target == self.bot.user: + return await ctx.send(f"I'm sorry {ctx.author.mention}, " + "I'm afraid I can't do that.") elif self.check_if_target_is_staff(target): return await ctx.send("I can't ban this user as " "they're a member of staff.") @@ -198,6 +207,9 @@ class Mod(Cog): # Hedge-proofing the code if target == ctx.author.id: return await ctx.send("You can't do mod actions on yourself.") + elif target == self.bot.user: + return await ctx.send(f"I'm sorry {ctx.author.mention}, " + "I'm afraid I can't do that.") elif target_member and self.check_if_target_is_staff(target_member): return await ctx.send("I can't ban this user as " "they're a member of staff.") @@ -232,6 +244,9 @@ class Mod(Cog): # Hedge-proofing the code if target == ctx.author: return await ctx.send("You can't do mod actions on yourself.") + elif target == self.bot.user: + return await ctx.send(f"I'm sorry {ctx.author.mention}, " + "I'm afraid I can't do that.") elif self.check_if_target_is_staff(target): return await ctx.send("I can't ban this user as " "they're a member of staff.") @@ -322,6 +337,9 @@ class Mod(Cog): # Hedge-proofing the code if target == ctx.author: return await ctx.send("You can't do mod actions on yourself.") + elif target == self.bot.user: + return await ctx.send(f"I'm sorry {ctx.author.mention}, " + "I'm afraid I can't do that.") elif self.check_if_target_is_staff(target): return await ctx.send("I can't warn this user as " "they're a member of staff.")