mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 11:18:54 -05:00
31 lines
894 B
Python
31 lines
894 B
Python
def init_global_checks(bot):
|
|
|
|
@bot.check
|
|
async def global_perms(ctx):
|
|
if await bot.is_owner(ctx.author):
|
|
return True
|
|
|
|
if bot.db.get_global("whitelist", []):
|
|
return ctx.author.id in bot.db.get_global("whitelist", [])
|
|
|
|
return ctx.author.id not in bot.db.get_global("blacklist", [])
|
|
|
|
@bot.check
|
|
async def local_perms(ctx):
|
|
if await bot.is_owner(ctx.author):
|
|
return True
|
|
elif ctx.message.guild is None:
|
|
return True
|
|
guild_perms = bot.db.get_all(ctx.guild, {})
|
|
local_blacklist = guild_perms.get("blacklist", [])
|
|
local_whitelist = guild_perms.get("whitelist", [])
|
|
|
|
if local_whitelist:
|
|
return ctx.author.id in local_whitelist
|
|
|
|
return ctx.author.id not in local_blacklist
|
|
|
|
@bot.check
|
|
async def bots(ctx):
|
|
return not ctx.author.bot
|