From 83f5bb7476f8606f9dd88469356b4a2053e48cee Mon Sep 17 00:00:00 2001 From: "Dusty.P" Date: Sat, 5 May 2018 20:50:45 -0800 Subject: [PATCH] Added Initial Checks --- exts/imports/checks.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 exts/imports/checks.py diff --git a/exts/imports/checks.py b/exts/imports/checks.py new file mode 100644 index 0000000..cfb2163 --- /dev/null +++ b/exts/imports/checks.py @@ -0,0 +1,17 @@ +import discord + +owner_id = 351794468870946827 + + +async def is_admin(bot, ctx): + admin_roles = await bot.db_con.fetchval("select admin_roles from guild_config where guild_id = $1", ctx.guild.id) + for role in admin_roles: + if discord.utils.get(ctx.guild.roles, id=admin_roles[role]) in ctx.message.author.roles: + return True + return ctx.message.author.id == ctx.guild.owner.id or ctx.message.author.id == owner_id + + +def is_guild_owner(ctx): + if ctx.guild: + return ctx.message.author.id == ctx.guild.owner.id or ctx.message.author.id == owner_id + return False