From 42a3f3f829218ed2e1bd3a94e941999cd892af2f Mon Sep 17 00:00:00 2001 From: phxntxm Date: Tue, 12 Jul 2016 23:30:22 -0500 Subject: [PATCH] Added courutine functionality for live debugging --- cogs/core.py | 4 ++-- cogs/owner.py | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/cogs/core.py b/cogs/core.py index 2839878..4b9a21d 100644 --- a/cogs/core.py +++ b/cogs/core.py @@ -156,7 +156,7 @@ class Core: return sql = 'insert into tags (server_id, tag, result) values (%s, %s, %s)' cursor.execute(sql, (ctx.message.server.id, tag, result)) - await self.bot.say("I have just added the tag '{0}'! You can call this tag by entering !tag {0}".format(tag)) + await self.bot.say("I have just added the tag `{0}`! You can call this tag by entering !tag {0}".format(tag)) config.closeConnection() @tag.command(name='delete', aliases=['remove', 'stop'], pass_context=True) @@ -174,7 +174,7 @@ class Core: config.closeConnection() return cursor.execute('delete from tags where server_id=%s and tag=%s', (ctx.message.server.id, tag)) - await self.bot.say('I have just removed the tag \'{}\''.format(tag)) + await self.bot.say('I have just removed the tag `{}`'.format(tag)) config.closeConnection() diff --git a/cogs/owner.py b/cogs/owner.py index 8d453e2..cceb964 100644 --- a/cogs/owner.py +++ b/cogs/owner.py @@ -5,6 +5,7 @@ import re import os import sys import discord +import inspect getter = re.compile(r'`(?!`)(.*?)`') multi = re.compile(r'```(.*?)```', re.DOTALL) @@ -39,6 +40,8 @@ class Owner: else: if not match_multi: result = eval(match_single[0]) + if inspect.isawaitable(result): + result = await result await self.bot.say("```{0}```".format(result)) else: def r(v):