mod: Improve hedgeproofing by also mod blocking actions on bot

This commit is contained in:
Ave Ozkal 2019-09-17 13:26:41 +03:00
parent c91284cd92
commit a595baa2ad
No known key found for this signature in database
GPG key ID: 09356ABAA42C842B

View file

@ -40,6 +40,9 @@ class Mod(Cog):
# Hedge-proofing the code # Hedge-proofing the code
if target == ctx.author: if target == ctx.author:
return await ctx.send("You can't do mod actions on yourself.") 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): elif self.check_if_target_is_staff(target):
return await ctx.send("I can't mute this user as " return await ctx.send("I can't mute this user as "
"they're a member of staff.") "they're a member of staff.")
@ -106,6 +109,9 @@ class Mod(Cog):
# Hedge-proofing the code # Hedge-proofing the code
if target == ctx.author: if target == ctx.author:
return await ctx.send("You can't do mod actions on yourself.") 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): elif self.check_if_target_is_staff(target):
return await ctx.send("I can't kick this user as " return await ctx.send("I can't kick this user as "
"they're a member of staff.") "they're a member of staff.")
@ -151,6 +157,9 @@ class Mod(Cog):
# Hedge-proofing the code # Hedge-proofing the code
if target == ctx.author: if target == ctx.author:
return await ctx.send("hedgeberg#7337 is now b&. 👍") 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): elif self.check_if_target_is_staff(target):
return await ctx.send("I can't ban this user as " return await ctx.send("I can't ban this user as "
"they're a member of staff.") "they're a member of staff.")
@ -198,6 +207,9 @@ class Mod(Cog):
# Hedge-proofing the code # Hedge-proofing the code
if target == ctx.author.id: if target == ctx.author.id:
return await ctx.send("You can't do mod actions on yourself.") 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): elif target_member and self.check_if_target_is_staff(target_member):
return await ctx.send("I can't ban this user as " return await ctx.send("I can't ban this user as "
"they're a member of staff.") "they're a member of staff.")
@ -232,6 +244,9 @@ class Mod(Cog):
# Hedge-proofing the code # Hedge-proofing the code
if target == ctx.author: if target == ctx.author:
return await ctx.send("You can't do mod actions on yourself.") 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): elif self.check_if_target_is_staff(target):
return await ctx.send("I can't ban this user as " return await ctx.send("I can't ban this user as "
"they're a member of staff.") "they're a member of staff.")
@ -322,6 +337,9 @@ class Mod(Cog):
# Hedge-proofing the code # Hedge-proofing the code
if target == ctx.author: if target == ctx.author:
return await ctx.send("You can't do mod actions on yourself.") 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): elif self.check_if_target_is_staff(target):
return await ctx.send("I can't warn this user as " return await ctx.send("I can't warn this user as "
"they're a member of staff.") "they're a member of staff.")