mod: Hedge-proof the code

This commit is contained in:
Ave Ozkal 2018-12-24 11:26:19 +03:00
parent af446f4cfd
commit 3e86b8d519
No known key found for this signature in database
GPG key ID: 09356ABAA42C842B

View file

@ -47,6 +47,9 @@ class ModCog:
if self.check_if_target_is_staff(target):
return await ctx.send("I can't mute this user as "
"they're a member of staff.")
# Hedge-proofing the code
elif target == ctx.author:
return await ctx.send("You can't do mod actions on yourself.")
safe_name = self.bot.escape_message(str(target))
@ -113,6 +116,9 @@ class ModCog:
if self.check_if_target_is_staff(target):
return await ctx.send("I can't kick this user as "
"they're a member of staff.")
# Hedge-proofing the code
elif target == ctx.author:
return await ctx.send("You can't do mod actions on yourself.")
safe_name = self.bot.escape_message(str(target))
@ -152,6 +158,9 @@ class ModCog:
if self.check_if_target_is_staff(target):
return await ctx.send("I can't ban this user as "
"they're a member of staff.")
# Hedge-proofing the code
elif target == ctx.author:
return await ctx.send("You can't do mod actions on yourself.")
safe_name = self.bot.escape_message(str(target))
@ -189,6 +198,9 @@ class ModCog:
if self.check_if_target_is_staff(target):
return await ctx.send("I can't ban this user as "
"they're a member of staff.")
# Hedge-proofing the code
elif target == ctx.author.id:
return await ctx.send("You can't do mod actions on yourself.")
safe_name = self.bot.escape_message(str(target))
@ -217,6 +229,9 @@ class ModCog:
if self.check_if_target_is_staff(target):
return await ctx.send("I can't ban this user as "
"they're a member of staff.")
# Hedge-proofing the code
elif target == ctx.author:
return await ctx.send("You can't do mod actions on yourself.")
safe_name = self.bot.escape_message(str(target))
@ -365,6 +380,9 @@ class ModCog:
if self.check_if_target_is_staff(target):
return await ctx.send("I can't warn this user as "
"they're a member of staff.")
# Hedge-proofing the code
elif target == ctx.author:
return await ctx.send("You can't do mod actions on yourself.")
log_channel = self.bot.get_channel(config.log_channel)
with open("data/warnsv2.json", "r") as f: