mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-22 02:37:57 -05:00
Deprecate is_allowed_by_hierarchy() core util (#4435)
This commit is contained in:
13
redbot/cogs/mod/utils.py
Normal file
13
redbot/cogs/mod/utils.py
Normal 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
|
||||
Reference in New Issue
Block a user