diff --git a/bot.py b/bot.py index f465b09..8228ba3 100644 --- a/bot.py +++ b/bot.py @@ -63,9 +63,10 @@ async def on_command_error(error, ctx): fmt = "You can't tell me what to do!" await bot.send_message(ctx.message.channel, fmt) elif isinstance(error, commands.CommandInvokeError): - print('In {0.command.qualified_name}:'.format(ctx), file=sys.stderr) - traceback.print_tb(error.original.__traceback__) - print('{0.__class__.__name__}: {0}'.format(error.original), file=sys.stderr) + fmt = 'In {0.command.qualified_name}:'.format(ctx), file=sys.stderr + fmt += error.original.__traceback__ + fmt += '{0.__class__.__name__}: {0}'.format(error.original), file=sys.stderr + await bot.send_message(ctx.message.channel,"```{}```".format(fmt)) else: fmt = 'An error occurred while processing this request: ```py\n{}: {}\n```' await bot.send_message(ctx.message.channel, fmt.format(type(error).__name__, error))