[V3 Mod/Modlog] prevent self-casing the bot + feedback for heirarchy (#1777)

* prevent the bot from being a modlog target

* prevent heirarchy issues in mod

* modify this comparison to avoid more complex mocking of the guild object in mod test

* spelling
This commit is contained in:
Michael H 2018-06-08 20:27:07 -04:00 committed by Will
parent e15815cd97
commit 8b15053dd4
2 changed files with 9 additions and 0 deletions

View File

@ -316,6 +316,9 @@ class Mod:
)
)
return
elif ctx.guild.me.top_role <= user.top_role or user == ctx.guild.owner:
await ctx.send(_("I cannot do that due to discord hierarchy rules"))
return
audit_reason = get_audit_reason(author, reason)
try:
await guild.kick(user, reason=audit_reason)
@ -369,6 +372,9 @@ class Mod:
)
)
return
elif ctx.guild.me.top_role <= user.top_role or user == ctx.guild.owner:
await ctx.send(_("I cannot do that due to discord hierarchy rules"))
return
if days:
if days.isdigit():

View File

@ -461,6 +461,9 @@ async def create_case(
if not await case_type.is_enabled():
return None
if user == bot.user:
return None
next_case_number = int(await get_next_case_number(guild))
case = Case(