1
0
Fork 0
mirror of synced 2024-06-23 08:40:41 +12:00

Updated debug command to print an error

This commit is contained in:
Phxntxm 2016-08-01 10:28:16 -05:00
parent cce19493c1
commit 2e7906fd4a

View file

@ -46,18 +46,21 @@ class Owner:
@commands.check(checks.isOwner)
async def debug(self, ctx):
"""Executes code"""
match_single = getter.findall(ctx.message.content)
match_multi = multi.findall(ctx.message.content)
if not match_multi:
result = eval(match_single[0])
try:
match_single = getter.findall(ctx.message.content)
match_multi = multi.findall(ctx.message.content)
if not match_multi:
result = eval(match_single[0])
if inspect.isawaitable(result):
result = await result
await self.bot.say("```\n{0}```".format(result))
elif match_multi:
def r(v):
self.bot.loop.create_task(self.bot.say("```\n{}```".format(v)))
exec(match_multi[0])
if inspect.isawaitable(result):
result = await result
await self.bot.say("```\n{0}```".format(result))
elif match_multi:
def r(v):
self.bot.loop.create_task(self.bot.say("```\n{}```".format(v)))
exec(match_multi[0])
except Exception as error:
await bot.send_message(ctx.message.channel, fmt.format(type(error).__name__, error))
@commands.command(pass_context=True)
@commands.check(checks.isOwner)