Updated debug command to print an error
This commit is contained in:
parent
cce19493c1
commit
2e7906fd4a
1 changed files with 14 additions and 11 deletions
|
@ -46,18 +46,21 @@ class Owner:
|
||||||
@commands.check(checks.isOwner)
|
@commands.check(checks.isOwner)
|
||||||
async def debug(self, ctx):
|
async def debug(self, ctx):
|
||||||
"""Executes code"""
|
"""Executes code"""
|
||||||
match_single = getter.findall(ctx.message.content)
|
try:
|
||||||
match_multi = multi.findall(ctx.message.content)
|
match_single = getter.findall(ctx.message.content)
|
||||||
if not match_multi:
|
match_multi = multi.findall(ctx.message.content)
|
||||||
result = eval(match_single[0])
|
if not match_multi:
|
||||||
|
result = eval(match_single[0])
|
||||||
|
|
||||||
if inspect.isawaitable(result):
|
if inspect.isawaitable(result):
|
||||||
result = await result
|
result = await result
|
||||||
await self.bot.say("```\n{0}```".format(result))
|
await self.bot.say("```\n{0}```".format(result))
|
||||||
elif match_multi:
|
elif match_multi:
|
||||||
def r(v):
|
def r(v):
|
||||||
self.bot.loop.create_task(self.bot.say("```\n{}```".format(v)))
|
self.bot.loop.create_task(self.bot.say("```\n{}```".format(v)))
|
||||||
exec(match_multi[0])
|
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.command(pass_context=True)
|
||||||
@commands.check(checks.isOwner)
|
@commands.check(checks.isOwner)
|
||||||
|
|
Loading…
Reference in a new issue