mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-12-05 17:02:32 -05:00
[Core] Replaced JsonDB with Config (#770)
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
from discord.ext import commands
|
||||
|
||||
|
||||
def init_global_checks(bot):
|
||||
|
||||
@bot.check
|
||||
@@ -5,20 +8,19 @@ def init_global_checks(bot):
|
||||
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", [])
|
||||
if bot.db.whitelist():
|
||||
return ctx.author.id in bot.db.whitelist()
|
||||
|
||||
return ctx.author.id not in bot.db.get_global("blacklist", [])
|
||||
return ctx.author.id not in bot.db.blacklist()
|
||||
|
||||
@bot.check
|
||||
async def local_perms(ctx):
|
||||
async def local_perms(ctx: commands.Context):
|
||||
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", [])
|
||||
local_blacklist = bot.db.guild(ctx.guild).blacklist()
|
||||
local_whitelist = bot.db.guild(ctx.guild).whitelist()
|
||||
|
||||
if local_whitelist:
|
||||
return ctx.author.id in local_whitelist
|
||||
|
||||
Reference in New Issue
Block a user