From 571a4295ec78d9965df3fbf41c34f2ffa5357934 Mon Sep 17 00:00:00 2001 From: phxntxm Date: Fri, 15 Jul 2016 16:51:28 -0500 Subject: [PATCH] Adding test command to check automatic type hinting --- cogs/core.py | 4 ++++ cogs/utils/checks.py | 10 ++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/cogs/core.py b/cogs/core.py index a8fb673..b776802 100644 --- a/cogs/core.py +++ b/cogs/core.py @@ -174,6 +174,10 @@ class Core: await self.bot.say('I have just removed the tag `{}`'.format(tag)) config.closeConnection() + @commands.command() + async def test(self, *, first, second): + await self.bot.say("First: {}\nSecond: {}".format(first, second)) + def setup(bot): bot.add_cog(Core(bot)) diff --git a/cogs/utils/checks.py b/cogs/utils/checks.py index 805539d..47a78fa 100644 --- a/cogs/utils/checks.py +++ b/cogs/utils/checks.py @@ -13,17 +13,18 @@ def customPermsOrRole(perm): cursor.execute('use {}'.format(config.db_perms)) cmd = str(ctx.command) sid = ctx.message.server.id - f = open("/home/phxntx5/public_html/Bonfire/checkstest.txt","r+") + f = open("/home/phxntx5/public_html/Bonfire/checkstest.txt", "r+") f.write("cmd: {}\nsid: {}".format(cmd, sid)) f.close() - + cursor.execute("show tables like %s", (sid,)) result = cursor.fetchone() if result is not None: - sql = "select perms from `"+sid+"` where command=%s" + sql = "select perms from `" + sid + "` where command=%s" cursor.execute(sql, (cmd,)) result = cursor.fetchone() - perm = result['perms'] + if result is not None: + perm = result['perms'] if perm == "none": return True config.closeConnection() @@ -31,6 +32,7 @@ def customPermsOrRole(perm): if getattr(role, perm): return True return False + return commands.check(predicate)