Deprecate is_allowed_by_hierarchy() core util (#4435)

This commit is contained in:
jack1142
2020-09-28 03:27:22 +02:00
committed by GitHub
parent a74547bb4e
commit a2ae485286
4 changed files with 24 additions and 2 deletions

13
redbot/cogs/mod/utils.py Normal file
View File

@@ -0,0 +1,13 @@
import discord
from redbot.core.bot import Red
from redbot.core.config import Config
async def is_allowed_by_hierarchy(
bot: Red, config: Config, guild: discord.Guild, mod: discord.Member, user: discord.Member
):
if not await config.guild(guild).respect_hierarchy():
return True
is_special = mod == guild.owner or await bot.is_owner(mod)
return mod.top_role.position > user.top_role.position or is_special