Browse Source

mod: Hedge-proof the code

main
Ave Ozkal 2 years ago
parent
commit
f6ea5fdc73
1 changed files with 18 additions and 0 deletions
  1. +18
    -0
      cogs/mod.py

+ 18
- 0
cogs/mod.py 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:


Loading…
Cancel
Save