First commit

This commit is contained in:
Twentysix
2017-04-27 00:49:27 +02:00
parent 6251c585e4
commit 2063decbe7
20 changed files with 994 additions and 0 deletions

30
core/global_checks.py Normal file
View File

@@ -0,0 +1,30 @@
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