From d9976dfd87dfedbf1b287da1ac16ffb3f429553e Mon Sep 17 00:00:00 2001 From: Phxntxm Date: Fri, 17 Feb 2017 22:14:38 -0600 Subject: [PATCH] Added a debug command for the voice shards --- cogs/music.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/cogs/music.py b/cogs/music.py index c5c41ae..3094f3d 100644 --- a/cogs/music.py +++ b/cogs/music.py @@ -320,6 +320,34 @@ class Music: pass await self.bot.delete_message(message) + @commands.command(pass_context=True) + @commands.check(utils.is_owner) + async def vdebug(self, ctx, *, code : str): + """Evaluates code.""" + code = code.strip('` ') + python = '```py\n{}\n```' + result = None + + env = { + 'bot': self.bot, + 'ctx': ctx, + 'message': ctx.message, + 'server': ctx.message.server, + 'channel': ctx.message.channel, + 'author': ctx.message.author + } + + env.update(globals()) + + try: + result = eval(code, env) + if inspect.isawaitable(result): + result = await result + except Exception as e: + await self.bot.say(python.format(type(e).__name__ + ': ' + str(e))) + return + + await self.bot.say(python.format(result)) @commands.command(pass_context=True, no_pm=True) @utils.custom_perms(send_messages=True)